#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*/ int_set(int *, int);
int /*<<< orphan*/ printf(char *, int, int);
int main(void) {
  int i;
  int ary1[] = {1, 2, 3, 4, 5};
  int ary2[] = {3, 2, 1};
  int_set(ary1, 5);
  int_set(ary2, 3);
  for (i = 0; i < 5; i++) {
    printf("ary1[%d] = %d \n", i, ary1[i]);
  }
  for (i = 0; i < 3; i++) {
    printf("ary2[%d] = %d \n", i, ary2[i]);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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)
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1040 <int_set@plt>
lea    -0x2c(%rbp),%rdi
mov    $0x3,%esi
call   1040 <int_set@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    11b4 <main+0x94>
mov    -0x8(%rbp),%esi
movslq -0x8(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edx
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1185 <main+0x65>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11ea <main+0xca>
mov    -0x8(%rbp),%esi
movslq -0x8(%rbp),%rax
mov    -0x2c(%rbp,%rax,4),%edx
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11bb <main+0x9b>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    0xee5(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xeca(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    0xedb(%rip),%eax
mov    %eax,0x8(%rsp)
mov    0xec8(%rip),%rax
mov    %rax,(%rsp)
lea    0x10(%rsp),%rdi
mov    $0x5,%esi
call   1040 <int_set@plt>
mov    %rsp,%rdi
mov    $0x3,%esi
call   1040 <int_set@plt>
mov    0x10(%rsp),%edx
lea    0xea9(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    0x14(%rsp),%edx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    0x18(%rsp),%edx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    0x1c(%rsp),%edx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    0x20(%rsp),%edx
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
mov    (%rsp),%edx
lea    0xe61(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.ary1 = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
@__const.main.ary2 = [3 x i32] [i32 3, i32 2, i32 1]
@.str = [16 x i8] c"ary1[%d] = %d \0A\00"
@.str.1 = [16 x i8] c"ary2[%d] = %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [5 x i32]
%4 = alloca [3 x i32]
store i32 0, i32* %1
%5 = bitcast [5 x i32]* %3 to i8*
%6 = bitcast [3 x i32]* %4 to i8*
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%8 = call i32 @int_set(i32* %7, i32 5)
%9 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 0
%10 = call i32 @int_set(i32* %9, i32 3)
store i32 0, i32* %2
br label %11
11: ; preds = %21, %0
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 5
br i1 %13, label %14, label %24
14: ; preds = %11
%15 = load i32, i32* %2
%16 = load i32, i32* %2
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %19)
br label %21
21: ; preds = %14
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
br label %11
24: ; preds = %11
store i32 0, i32* %2
br label %25
25: ; preds = %35, %24
%26 = load i32, i32* %2
%27 = icmp slt i32 %26, 3
br i1 %27, label %28, label %38
28: ; preds = %25
%29 = load i32, i32* %2
%30 = load i32, i32* %2
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %29, i32 %33)
br label %35
35: ; preds = %28
%36 = load i32, i32* %2
%37 = add nsw i32 %36, 1
store i32 %37, i32* %2
br label %25
38: ; preds = %25
ret i32 0
}

LLVM IR (-O2):
@__const.main.ary1 = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
@__const.main.ary2 = [3 x i32] [i32 3, i32 2, i32 1]
@.str = [16 x i8] c"ary1[%d] = %d \0A\00"
@.str.1 = [16 x i8] c"ary2[%d] = %d \0A\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = alloca [3 x i32]
%3 = bitcast [5 x i32]* %1 to i8*
%4 = bitcast [3 x i32]* %2 to i8*
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%6 = call i32 @int_set(i32* %5, i32 5)
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%8 = call i32 @int_set(i32* %7, i32 3)
%9 = load i32, i32* %5
%10 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 0, i32 %9)
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 1, i32 %12)
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 2, i32 %15)
%17 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
%18 = load i32, i32* %17
%19 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 3, i32 %18)
%20 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
%21 = load i32, i32* %20
%22 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 4, i32 %21)
%23 = load i32, i32* %7
%24 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 %23)
%25 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
%26 = load i32, i32* %25
%27 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 %26)
%28 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
%29 = load i32, i32* %28
%30 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 %29)
ret i32 0
}