#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*/ test_ptr;
typedef int /*<<< orphan*/ test;
typedef int /*<<< orphan*/ t_ptr;
typedef int /*<<< orphan*/ numfruits;
typedef int /*<<< orphan*/ fruits;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  const char *fruits[] = {"apple",  "pear",   "banana",
                          "orange", "cherry", "apricot"};
  unsigned int numfruits;
  printf("sizeof(fruits) : %d\n", sizeof(fruits));
  printf("sizeof(*fruits) : %d\n", sizeof(*fruits));
  printf("sizeof(**fruits) : %d\n", sizeof(**fruits));
  printf("sizeof(numfruits) : %d\n", sizeof(numfruits));
  numfruits = sizeof(fruits) / sizeof(numfruits);
  printf("numfruits: %d\n", numfruits);
  int test[10] = {};
  printf("sizeof(test):%d\n", sizeof(test));
  printf("sizeof(test[0]):%d\n", sizeof(test[0]));
  printf("sizeof(test) /sizeof(test[0]): %d\n", sizeof(test) / sizeof(test[0]));
  int *t_ptr;
  printf("sizeof(t_ptr): %d\n", sizeof(t_ptr));
  printf("sizeof(*t_ptr): %d\n", sizeof(*t_ptr));
  int *test_ptr[10];
  printf("sizeof(test_ptr): %d\n", sizeof(test_ptr));
  printf("sizeof(*test_ptr): %d\n", sizeof(*test_ptr));
  printf("sizeof(**test_ptr): %d\n", sizeof(**test_ptr));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1040 <memset@plt>
lea    0xeb7(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xeb2(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xeac(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xea8(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xea4(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xea0(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xe9d(%rip),%rdi
mov    $0x30,%esi
call   1030 <printf@plt>
lea    0xea1(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0xea6(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
lea    0xeac(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
movl   $0xc,-0x44(%rbp)
mov    -0x44(%rbp),%esi
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
lea    0xe9c(%rip),%rdi
mov    $0x28,%esi
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
lea    0xe9f(%rip),%rdi
mov    $0xa,%esi
call   1030 <printf@plt>
lea    0xeb1(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0xeb3(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
mov    $0x50,%esi
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x30,%esi
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
lea    0xef7(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
lea    0xefe(%rip),%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
lea    0xefc(%rip),%rdi
mov    $0x28,%esi
call   1030 <printf@plt>
lea    0xefc(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
mov    $0xa,%esi
call   1030 <printf@plt>
lea    0xf11(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0xf13(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
lea    0xf16(%rip),%rdi
mov    $0x50,%esi
call   1030 <printf@plt>
lea    0xf1b(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0xf21(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"apple\00"
@.str.1 = [5 x i8] c"pear\00"
@.str.2 = [7 x i8] c"banana\00"
@.str.3 = [7 x i8] c"orange\00"
@.str.4 = [7 x i8] c"cherry\00"
@.str.5 = [8 x i8] c"apricot\00"
@.str.6 = [21 x i8] c"sizeof(fruits) : %d\0A\00"
@.str.7 = [22 x i8] c"sizeof(*fruits) : %d\0A\00"
@.str.8 = [23 x i8] c"sizeof(**fruits) : %d\0A\00"
@.str.9 = [24 x i8] c"sizeof(numfruits) : %d\0A\00"
@.str.10 = [15 x i8] c"numfruits: %d\0A\00"
@.str.11 = [17 x i8] c"sizeof(test):%d\0A\00"
@.str.12 = [20 x i8] c"sizeof(test[0]):%d\0A\00"
@.str.13 = [35 x i8] c"sizeof(test) /sizeof(test[0]): %d\0A\00"
@.str.14 = [19 x i8] c"sizeof(t_ptr): %d\0A\00"
@.str.15 = [20 x i8] c"sizeof(*t_ptr): %d\0A\00"
@.str.16 = [22 x i8] c"sizeof(test_ptr): %d\0A\00"
@.str.17 = [23 x i8] c"sizeof(*test_ptr): %d\0A\00"
@.str.18 = [24 x i8] c"sizeof(**test_ptr): %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i8*]
%3 = alloca i32
%4 = alloca [10 x i32]
%5 = alloca i32*
%6 = alloca [10 x i32*]
store i32 0, i32* %1
%7 = bitcast [6 x i8*]* %2 to i8*
%8 = bitcast i8* %7 to [6 x i8*]*
%9 = getelementptr inbounds [6 x i8*], [6 x i8*]* %8, i32 0, i32 0
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8** %9
%10 = getelementptr inbounds [6 x i8*], [6 x i8*]* %8, i32 0, i32 1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8** %10
%11 = getelementptr inbounds [6 x i8*], [6 x i8*]* %8, i32 0, i32 2
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8** %11
%12 = getelementptr inbounds [6 x i8*], [6 x i8*]* %8, i32 0, i32 3
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i32 0, i32 0), i8** %12
%13 = getelementptr inbounds [6 x i8*], [6 x i8*]* %8, i32 0, i32 4
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i32 0, i32 0), i8** %13
%14 = getelementptr inbounds [6 x i8*], [6 x i8*]* %8, i32 0, i32 5
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i32 0, i32 0), i8** %14
%15 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i32 48)
%16 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i32 8)
%17 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i32 1)
%18 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0), i32 4)
store i32 12, i32* %3
%19 = load i32, i32* %3
%20 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), i32 %19)
%21 = bitcast [10 x i32]* %4 to i8*
%22 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i32 40)
%23 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0), i32 4)
%24 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.13, i64 0, i64 0), i32 10)
%25 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.14, i64 0, i64 0), i32 8)
%26 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0), i32 4)
%27 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.16, i64 0, i64 0), i32 80)
%28 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.17, i64 0, i64 0), i32 8)
%29 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0), i32 4)
ret i32 0
}

LLVM IR (-O2):
@.str.6 = [21 x i8] c"sizeof(fruits) : %d\0A\00"
@.str.7 = [22 x i8] c"sizeof(*fruits) : %d\0A\00"
@.str.8 = [23 x i8] c"sizeof(**fruits) : %d\0A\00"
@.str.9 = [24 x i8] c"sizeof(numfruits) : %d\0A\00"
@.str.10 = [15 x i8] c"numfruits: %d\0A\00"
@.str.11 = [17 x i8] c"sizeof(test):%d\0A\00"
@.str.12 = [20 x i8] c"sizeof(test[0]):%d\0A\00"
@.str.13 = [35 x i8] c"sizeof(test) /sizeof(test[0]): %d\0A\00"
@.str.14 = [19 x i8] c"sizeof(t_ptr): %d\0A\00"
@.str.15 = [20 x i8] c"sizeof(*t_ptr): %d\0A\00"
@.str.16 = [22 x i8] c"sizeof(test_ptr): %d\0A\00"
@.str.17 = [23 x i8] c"sizeof(*test_ptr): %d\0A\00"
@.str.18 = [24 x i8] c"sizeof(**test_ptr): %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i32 48)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i32 8)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i32 1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0), i32 4)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), i32 12)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i32 40)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0), i32 4)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.13, i64 0, i64 0), i32 10)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.14, i64 0, i64 0), i32 8)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0), i32 4)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.16, i64 0, i64 0), i32 80)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.17, i64 0, i64 0), i32 8)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0), i32 4)
ret i32 0
}