#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 *, char *);
int main(int argc, char **argv) {
  int array[5] = {3, 3, 3, 3, 3};
  int *pi = NULL;
  int zero = 0x666666;
  for (pi = &array[0]; pi < &array[5]; ++pi) {
    *pi = 0;
  }
  for (int i = 0; i < 5; ++i) {
    printf("%d", array[i]);
  }
  char str[] = "hello";
  char *str2 = "world";
  char str3[10];
  printf("input the value \n");
  scanf("%s", str);
  printf("str is %s\n", str);
  printf("str2 is %s\n", str2);
  printf("str3 is %s \n", str3);
  printf("\a\a\a\a\a");
  printf("done");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xebe(%rip),%eax
mov    %eax,-0x20(%rbp)
movq   $0x0,-0x38(%rbp)
movl   $0x666666,-0x3c(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
lea    -0x30(%rbp),%rcx
add    $0x14,%rcx
cmp    %rcx,%rax
jae    119c <main+0x7c>
mov    -0x38(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x38(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x38(%rbp)
jmp    116c <main+0x4c>
movl   $0x0,-0x40(%rbp)
cmpl   $0x5,-0x40(%rbp)
jge    11d1 <main+0xb1>
movslq -0x40(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    11a3 <main+0x83>
mov    0xe40(%rip),%eax
mov    %eax,-0x46(%rbp)
mov    0xe3a(%rip),%ax
mov    %ax,-0x42(%rbp)
lea    0xe31(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x46(%rbp),%rsi
lea    0xe2c(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x46(%rbp),%rsi
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%rsi
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x5a(%rbp),%rsi
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    0xec5(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xeaa(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x14(%rsp),%rax
lea    0x4(%rsp),%rcx
cmp    %rcx,%rax
cmova  %rax,%rcx
mov    %rsp,%rdi
mov    %rdi,%rdx
not    %rdx
add    %rcx,%rdx
and    $0xfffffffffffffff0,%rdx
or     $0x4,%rdx
xor    %esi,%esi
call   1050 <memset@plt>
mov    (%rsp),%esi
lea    0xe84(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movw   $0x6f,0x24(%rsp)
movl   $0x6c6c6568,0x20(%rsp)
6c
lea    0xe6d(%rip),%rdi
call   1030 <puts@plt>
lea    0xe2f(%rip),%rdi
lea    0x20(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
lea    0xe1e(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe18(%rip),%rdi
lea    0xdfd(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe0f(%rip),%rdi
lea    0x26(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe09(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe01(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.array = [5 x i32] [i32 3, i32 3, i32 3, i32 3, i32 3]
@.str = [3 x i8] c"%d\00"
@__const.main.str = [6 x i8] c"hello\00"
@.str.1 = [6 x i8] c"world\00"
@.str.2 = [18 x i8] c"input the value \0A\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [11 x i8] c"str is %s\0A\00"
@.str.5 = [12 x i8] c"str2 is %s\0A\00"
@.str.6 = [13 x i8] c"str3 is %s \0A\00"
@.str.7 = [6 x i8] c"\07\07\07\07\07\00"
@.str.8 = [5 x i8] c"done\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [5 x i32]
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca [6 x i8]
%11 = alloca i8*
%12 = alloca [10 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = bitcast [5 x i32]* %6 to i8*
store i32* null, i32** %7
store i32 6710886, i32* %8
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
store i32* %14, i32** %7
br label %15
15: ; preds = %21, %2
%16 = load i32*, i32** %7
%17 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 5
%18 = icmp ult i32* %16, %17
br i1 %18, label %19, label %24
19: ; preds = %15
%20 = load i32*, i32** %7
store i32 0, i32* %20
br label %21
21: ; preds = %19
%22 = load i32*, i32** %7
%23 = getelementptr inbounds i32, i32* %22, i32 1
store i32* %23, i32** %7
br label %15
24: ; preds = %15
store i32 0, i32* %9
br label %25
25: ; preds = %34, %24
%26 = load i32, i32* %9
%27 = icmp slt i32 %26, 5
br i1 %27, label %28, label %37
28: ; preds = %25
%29 = load i32, i32* %9
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %30
%32 = load i32, i32* %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %28
%35 = load i32, i32* %9
%36 = add nsw i32 %35, 1
store i32 %36, i32* %9
br label %25
37: ; preds = %25
%38 = bitcast [6 x i8]* %10 to i8*
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %11
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%40 = getelementptr inbounds [6 x i8], [6 x i8]* %10, i64 0, i64 0
%41 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %40)
%42 = getelementptr inbounds [6 x i8], [6 x i8]* %10, i64 0, i64 0
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %42)
%44 = load i8*, i8** %11
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %44)
%46 = getelementptr inbounds [10 x i8], [10 x i8]* %12, i64 0, i64 0
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* %46)
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.array = [5 x i32] [i32 3, i32 3, i32 3, i32 3, i32 3]
@.str = [3 x i8] c"%d\00"
@__const.main.str = [6 x i8] c"hello\00"
@.str.1 = [6 x i8] c"world\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [11 x i8] c"str is %s\0A\00"
@.str.5 = [12 x i8] c"str2 is %s\0A\00"
@.str.6 = [13 x i8] c"str3 is %s \0A\00"
@.str.7 = [6 x i8] c"\07\07\07\07\07\00"
@.str.8 = [5 x i8] c"done\00"
@str = [17 x i8] c"input the value \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [5 x i32]
%4 = bitcast [5 x i32]* %3 to i8*
%5 = ptrtoint [5 x i32]* %3 to i64
%6 = alloca [6 x i8]
%7 = alloca [10 x i8]
%8 = add i64 %5, 20
%9 = or i64 %5, 4
%10 = call i64 @llvm.umax.i64(i64 %8, i64 %9)
%11 = xor i64 %5, -1
%12 = add i64 %10, %11
%13 = and i64 %12, -16
%14 = or i64 %13, 4
%15 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%16 = load i32, i32* %15
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 1
%19 = load i32, i32* %18
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 2
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 3
%25 = load i32, i32* %24
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 4
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %28)
%30 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 0
%31 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%33 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %30)
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %30)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* %31)
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}