#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*/ maopao(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int num;
  printf("array size:\n");
  scanf("%d", &num);
  int array[num];
  printf("array elements:\n");
  for (int i = 0; i < num; i++)
    scanf("%d", &array[i]);
  for (int i = 0; i < num; i++)
    printf("%3d", array[i]);
  printf("\n");
  maopao(array, num);
  for (int i = 0; i < num; i++)
    printf("%3d", array[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ce <main+0x9e>
mov    -0x30(%rbp),%rsi
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe52(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1199 <main+0x69>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1208 <main+0xd8>
mov    -0x30(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11d5 <main+0xa5>
lea    0xdfc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <maopao@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    125c <main+0x12c>
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1229 <main+0xf9>
lea    0xda8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xea2(%rip),%rdi
call   1050 <puts@plt>
lea    0xe8f(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1070 <scanf@plt>
mov    %rsp,%r12
mov    -0x2c(%rbp),%eax
mov    %rsp,%r15
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
lea    0xe77(%rip),%rdi
call   1050 <puts@plt>
cmpl   $0x0,-0x2c(%rbp)
jle    120b <main+0xbb>
xor    %r13d,%r13d
lea    0xe4f(%rip),%r14
mov    %r15,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
add    $0x1,%r13
movslq -0x2c(%rbp),%rax
add    $0x4,%rbx
cmp    %rax,%r13
jl     11c0 <main+0x70>
test   %eax,%eax
jle    120b <main+0xbb>
lea    0xe1c(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbx
movslq -0x2c(%rbp),%rax
cmp    %rax,%rbx
jl     11f0 <main+0xa0>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x2c(%rbp),%esi
mov    %r15,%rdi
call   1040 <maopao@plt>
cmpl   $0x0,-0x2c(%rbp)
jle    124b <main+0xfb>
lea    0xdd6(%rip),%r14
xor    %ebx,%ebx
nop
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbx
movslq -0x2c(%rbp),%rax
cmp    %rax,%rbx
jl     1230 <main+0xe0>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r12,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"array size:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [17 x i8] c"array elements:\0A\00"
@.str.3 = [4 x i8] c"%3d\00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %3
%13 = alloca i32, i64 %11
store i64 %11, i64* %4
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %5
br label %15
15: ; preds = %24, %0
%16 = load i32, i32* %5
%17 = load i32, i32* %2
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %27
19: ; preds = %15
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %13, i64 %21
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
br label %24
24: ; preds = %19
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %15
27: ; preds = %15
store i32 0, i32* %6
br label %28
28: ; preds = %38, %27
%29 = load i32, i32* %6
%30 = load i32, i32* %2
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %41
32: ; preds = %28
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %13, i64 %34
%36 = load i32, i32* %35
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %32
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
br label %28
41: ; preds = %28
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%43 = load i32, i32* %2
%44 = call i32 @maopao(i32* %13, i32 %43)
store i32 0, i32* %7
br label %45
45: ; preds = %55, %41
%46 = load i32, i32* %7
%47 = load i32, i32* %2
%48 = icmp slt i32 %46, %47
br i1 %48, label %49, label %58
49: ; preds = %45
%50 = load i32, i32* %7
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i32, i32* %13, i64 %51
%53 = load i32, i32* %52
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %53)
br label %55
55: ; preds = %49
%56 = load i32, i32* %7
%57 = add nsw i32 %56, 1
store i32 %57, i32* %7
br label %45
58: ; preds = %45
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%60 = load i8*, i8** %3
%61 = load i32, i32* %1
ret i32 %61
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"%3d\00"
@str = [12 x i8] c"array size:\00"
@str.5 = [16 x i8] c"array elements:\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = zext i32 %5 to i64
%7 = call i8* @llvm.stacksave()
%8 = alloca i32, i64 %6
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.5, i64 0, i64 0))
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, 0
br i1 %11, label %14, label %22
12: ; preds = %14
%13 = icmp sgt i32 %19, 0
br i1 %13, label %28, label %22
14: ; preds = %0, %14
%15 = phi i64 [ %18, %14 ], [ 0, %0 ]
%16 = getelementptr inbounds i32, i32* %8, i64 %15
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = add nuw nsw i64 %15, 1
%19 = load i32, i32* %1
%20 = sext i32 %19 to i64
%21 = icmp slt i64 %18, %20
br i1 %21, label %14, label %12
22: ; preds = %28, %0, %12
%23 = call i32 @putchar(i32 10)
%24 = load i32, i32* %1
%25 = call i32 @maopao(i32* %8, i32 %24)
%26 = load i32, i32* %1
%27 = icmp sgt i32 %26, 0
br i1 %27, label %39, label %37
28: ; preds = %12, %28
%29 = phi i64 [ %33, %28 ], [ 0, %12 ]
%30 = getelementptr inbounds i32, i32* %8, i64 %29
%31 = load i32, i32* %30
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %31)
%33 = add nuw nsw i64 %29, 1
%34 = load i32, i32* %1
%35 = sext i32 %34 to i64
%36 = icmp slt i64 %33, %35
br i1 %36, label %28, label %22
37: ; preds = %39, %22
%38 = call i32 @putchar(i32 10)
ret i32 0
39: ; preds = %22, %39
%40 = phi i64 [ %44, %39 ], [ 0, %22 ]
%41 = getelementptr inbounds i32, i32* %8, i64 %40
%42 = load i32, i32* %41
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %42)
%44 = add nuw nsw i64 %40, 1
%45 = load i32, i32* %1
%46 = sext i32 %45 to i64
%47 = icmp slt i64 %44, %46
br i1 %47, label %39, label %37
}