'Why the first two lines in the main function in LLVM IR?

main.c

int main()
{
    return 0;
}

clang -S -emit-llvm main.c generates:

define dso_local i32 @main() #0 {
%1 = alloca i32, align 4          ; (why?)
store i32 0, i32* %1, align 4     ; (why?)
ret i32 0
}

why the first two lines? This also gets generated only for the main function. (Using clang-12 && LLVM-12)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source