#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ arr3;
typedef int /*<<< orphan*/ arr2;
typedef int /*<<< orphan*/ arr1;

/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int arr1[5] = {1, 2, 3};
  int arr2[] = {1, 2, 3};
  int *arr3 = (int *)malloc(sizeof(int) * 5);
  printf("sizeof(int) = %d\n", sizeof(int));
  printf("sizeof(int*) = %d\n", sizeof(int *));
  printf("sizeof(arr1) = %d\n", sizeof(arr1));
  printf("sizeof(arr2) = %d\n", sizeof(arr2));
  printf("sizeof(arr3) = %d\n", sizeof(arr3));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec5(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xebf(%rip),%rax
mov    %rax,-0x2c(%rbp)
mov    0xebd(%rip),%eax
mov    %eax,-0x24(%rbp)
mov    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,-0x38(%rbp)
lea    0xea9(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0xeac(%rip),%rdi
mov    $0x14,%esi
call   1030 <printf@plt>
lea    0xeae(%rip),%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x14,%edi
call   1040 <malloc@plt>
lea    0xece(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
mov    $0x14,%esi
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.arr1 = [5 x i32] [i32 1, i32 2, i32 3, i32 0, i32 0]
@__const.main.arr2 = [3 x i32] [i32 1, i32 2, i32 3]
@.str = [18 x i8] c"sizeof(int) = %d\0A\00"
@.str.1 = [19 x i8] c"sizeof(int*) = %d\0A\00"
@.str.2 = [19 x i8] c"sizeof(arr1) = %d\0A\00"
@.str.3 = [19 x i8] c"sizeof(arr2) = %d\0A\00"
@.str.4 = [19 x i8] c"sizeof(arr3) = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca [3 x i32]
%4 = alloca i32*
store i32 0, i32* %1
%5 = bitcast [5 x i32]* %2 to i8*
%6 = bitcast [3 x i32]* %3 to i8*
%7 = call i64 @malloc(i32 20)
%8 = inttoptr i64 %7 to i32*
store i32* %8, i32** %4
%9 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 4)
%10 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 8)
%11 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 20)
%12 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 12)
%13 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 8)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"sizeof(int) = %d\0A\00"
@.str.1 = [19 x i8] c"sizeof(int*) = %d\0A\00"
@.str.2 = [19 x i8] c"sizeof(arr1) = %d\0A\00"
@.str.3 = [19 x i8] c"sizeof(arr2) = %d\0A\00"
@.str.4 = [19 x i8] c"sizeof(arr3) = %d\0A\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 20)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 4)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 8)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 20)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 12)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 8)
ret i32 0
}