int main(void) {
  int *arr;
  int *parr[5];
  arr = (int *)calloc(10, sizeof(int));
  printf("initlize calloc arr[0]=%d,arr[1]=%d\n", arr[0], arr[1]);
  parr[0] = (int *)calloc(3, sizeof(int));
  parr[1] = (int *)calloc(3, sizeof(int));
  printf("initlize calloc parr[0]=%d,parr[1]=%d\n", parr[0], parr[1]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0xa,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edx
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x3,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,-0x30(%rbp)
mov    $0x3,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x3,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
mov    $0x3,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
lea    0xeca(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"initlize calloc arr[0]=%d,arr[1]=%d\0A\00"
@.str.1 = [39 x i8] c"initlize calloc parr[0]=%d,parr[1]=%d\0A\00"
define i32 @main() {
%1 = alloca i32*
%2 = alloca [5 x i32*]
%3 = call i8* @calloc(i64 10, i64 4)
%4 = bitcast i8* %3 to i32*
store i32* %4, i32** %1
%5 = load i32*, i32** %1
%6 = getelementptr inbounds i32, i32* %5, i64 0
%7 = load i32, i32* %6
%8 = load i32*, i32** %1
%9 = getelementptr inbounds i32, i32* %8, i64 1
%10 = load i32, i32* %9
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %10)
%12 = call i8* @calloc(i64 3, i64 4)
%13 = bitcast i8* %12 to i32*
%14 = getelementptr inbounds [5 x i32*], [5 x i32*]* %2, i64 0, i64 0
store i32* %13, i32** %14
%15 = call i8* @calloc(i64 3, i64 4)
%16 = bitcast i8* %15 to i32*
%17 = getelementptr inbounds [5 x i32*], [5 x i32*]* %2, i64 0, i64 1
store i32* %16, i32** %17
%18 = getelementptr inbounds [5 x i32*], [5 x i32*]* %2, i64 0, i64 0
%19 = load i32*, i32** %18
%20 = getelementptr inbounds [5 x i32*], [5 x i32*]* %2, i64 0, i64 1
%21 = load i32*, i32** %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32* %19, i32* %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [37 x i8] c"initlize calloc arr[0]=%d,arr[1]=%d\0A\00"
@.str.1 = [39 x i8] c"initlize calloc parr[0]=%d,parr[1]=%d\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 0, i32 0)
%2 = tail call dereferenceable_or_null(12) i8* @calloc(i64 3, i64 4)
%3 = tail call dereferenceable_or_null(12) i8* @calloc(i64 3, i64 4)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %2, i8* %3)
ret i32 0
}