#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, size_t *);
int main() {
  char my_char_array[20] = {'\0'};
  int my_int_array[20] = {0};
  char my_array[20] = {0};
  my_array[0];
  my_array[1] = 2;
  printf("%d\n", my_array[1]);
  printf("Enter the array size: ");
  size_t size = 0;
  scanf("%lu", &size);
  int var_length_array[size];
  printf("sizeof array = %lu\n", sizeof var_length_array);
  char a_string[20] = "This is a string";
  printf("%s\n", a_string);
  printf("%d\n", a_string[16]);
  int cha = 'a';
  char chb = 'a';
  int multi_array[2][5] = {{1, 2, 3, 4, 5}, {6, 7, 8, 9, 0}};
  int array_int = multi_array[0][2];
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1040 <memset@plt>
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1040 <memset@plt>
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1040 <memset@plt>
movb   $0x2,-0x8f(%rbp)
movsbl -0x8f(%rbp),%esi
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x0,-0x98(%rbp)
lea    0xe5a(%rip),%rdi
lea    -0x98(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x98(%rbp),%rsi
mov    %rsp,%rax
mov    %rax,-0xa0(%rbp)
mov    %rsi,-0xa8(%rbp)
shl    $0x2,%rsi
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xe42(%rip),%rax
mov    %rax,-0xc0(%rbp)
mov    0xe3c(%rip),%rax
mov    %rax,-0xb8(%rbp)
mov    0xe37(%rip),%eax
mov    %eax,-0xb0(%rbp)
lea    -0xc0(%rbp),%rsi
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0xb0(%rbp),%esi
lea    0xdbe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x61,-0xc4(%rbp)
movb   $0x61,-0xc5(%rbp)
lea    -0xf0(%rbp),%rdi
lea    0xdf8(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
mov    -0xe8(%rbp),%eax
mov    %eax,-0xf4(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0xa0(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0xec2(%rip),%r14
mov    %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movq   $0x0,0x8(%rsp)
lea    0xeb0(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rsp,%rbx
mov    0x8(%rsp),%rsi
shl    $0x2,%rsi
lea    0xe97(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movaps 0xeaa(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x20(%rsp)
lea    0x10(%rsp),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rsp
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [23 x i8] c"Enter the array size: \00"
@.str.2 = [4 x i8] c"%lu\00"
@.str.3 = [20 x i8] c"sizeof array = %lu\0A\00"
@__const.main.a_string = [20 x i8] c"This is a string\00\00\00\00"
@.str.4 = [4 x i8] c"%s\0A\00"
@__const.main.multi_array = [2 x [5 x i32]] [[5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5], [5 x i32] [i32 6, i32 7, i32 8, i32 9, i32 0]]
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca [20 x i32]
%4 = alloca [20 x i8]
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i64
%8 = alloca [20 x i8]
%9 = alloca i32
%10 = alloca i8
%11 = alloca [2 x [5 x i32]]
%12 = alloca i32
store i32 0, i32* %1
%13 = bitcast [20 x i8]* %2 to i8*
%14 = bitcast [20 x i32]* %3 to i8*
%15 = bitcast [20 x i8]* %4 to i8*
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%17 = load i8, i8* %16
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 1
store i8 2, i8* %18
%19 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 1
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
store i64 0, i64* %5
%24 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64* %5)
%25 = load i64, i64* %5
%26 = call i8* @llvm.stacksave()
store i8* %26, i8** %6
%27 = alloca i32, i64 %25
store i64 %25, i64* %7
%28 = mul nuw i64 4, %25
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i64 %28)
%30 = bitcast [20 x i8]* %8 to i8*
%31 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 0
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %31)
%33 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 16
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %35)
store i32 97, i32* %9
store i8 97, i8* %10
%37 = bitcast [2 x [5 x i32]]* %11 to i8*
%38 = getelementptr inbounds [2 x [5 x i32]], [2 x [5 x i32]]* %11, i64 0, i64 0
%39 = getelementptr inbounds [5 x i32], [5 x i32]* %38, i64 0, i64 2
%40 = load i32, i32* %39
store i32 %40, i32* %12
store i32 0, i32* %1
%41 = load i8*, i8** %6
%42 = load i32, i32* %1
ret i32 %42
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [23 x i8] c"Enter the array size: \00"
@.str.2 = [4 x i8] c"%lu\00"
@.str.3 = [20 x i8] c"sizeof array = %lu\0A\00"
@__const.main.a_string = [20 x i8] c"This is a string\00\00\00\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca [20 x i8]
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 2)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%5 = bitcast i64* %1 to i8*
store i64 0, i64* %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64* %1)
%7 = load i64, i64* %1
%8 = call i8* @llvm.stacksave()
%9 = shl nuw i64 %7, 2
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i64 %9)
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%12 = call i32 @puts(i8* %11)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
ret i32 0
}