void main() {
  int array[10] = {0};
  printf("address of array[0] in main function:%x\n", &array[0]);
  input(array, 10);
  printf("The input number is:\n");
  output(array, 10);
  swap(array, 10);
  printf("---------main-----------\n");
  printf("array[0]:%d\n", array[0]);
  printf("array[9]:%d\n", array[9]);
  printf("The swaped number is:\n");
  output(array, 10);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1060 <memset@plt>
lea    -0x30(%rbp),%rsi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
mov    $0x0,%al
call   1030 <input@plt>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
mov    $0x0,%al
call   1040 <output@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
mov    $0x0,%al
call   1070 <swap@plt>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x30(%rbp),%esi
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
mov    $0x0,%al
call   1040 <output@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x20(%rsp)
lea    0xe8f(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1030 <input@plt>
lea    0xeaf(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1050 <output@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1070 <swap@plt>
lea    0xe9a(%rip),%rdi
call   1040 <puts@plt>
mov    (%rsp),%esi
lea    0xe5c(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x24(%rsp),%esi
lea    0xe57(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe84(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1050 <output@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [41 x i8] c"address of array[0] in main function:%x\0A\00"
@.str.1 = [22 x i8] c"The input number is:\0A\00"
@.str.2 = [26 x i8] c"---------main-----------\0A\00"
@.str.3 = [13 x i8] c"array[0]:%d\0A\00"
@.str.4 = [13 x i8] c"array[9]:%d\0A\00"
@.str.5 = [23 x i8] c"The swaped number is:\0A\00"
define void @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32* %3)
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%6 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @input to i32 (i32*, i32, ...)*)(i32* %5, i32 10)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%9 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @output to i32 (i32*, i32, ...)*)(i32* %8, i32 10)
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%11 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @swap to i32 (i32*, i32, ...)*)(i32* %10, i32 10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%14 = load i32, i32* %13
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%17 = load i32, i32* %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%21 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @output to i32 (i32*, i32, ...)*)(i32* %20, i32 10)
ret void
}

LLVM IR (-O2):
@.str = [41 x i8] c"address of array[0] in main function:%x\0A\00"
@.str.3 = [13 x i8] c"array[0]:%d\0A\00"
@.str.4 = [13 x i8] c"array[9]:%d\0A\00"
@str = [21 x i8] c"The input number is:\00"
@str.6 = [25 x i8] c"---------main-----------\00"
@str.7 = [22 x i8] c"The swaped number is:\00"
define void @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32* %3)
%5 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @input to i32 (i32*, i32, ...)*)(i32* %3, i32 10)
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%7 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @output to i32 (i32*, i32, ...)*)(i32* %3, i32 10)
%8 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @swap to i32 (i32*, i32, ...)*)(i32* %3, i32 10)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.6, i64 0, i64 0))
%10 = load i32, i32* %3
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%13 = load i32, i32* %12
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %13)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.7, i64 0, i64 0))
%16 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @output to i32 (i32*, i32, ...)*)(i32* %3, i32 10)
ret void
}