#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*/ exchange(unsigned long *, unsigned long *);
int /*<<< orphan*/ printf(char *, unsigned long, unsigned long);
int main() {
  unsigned long array[2] = {99999, 88888};
  printf("Zeroth element is %lu first is %lu \n", array[0], array[1]);
  exchange(&array[0], &array[1]);
  printf("Zeroth element is %lu first is %lu \n", array[0], array[1]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
lea    -0x10(%rbp),%rdi
lea    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1040 <exchange@plt>
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movaps 0xed2(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x8(%rsp),%r14
lea    0xed2(%rip),%rbx
mov    $0x1869f,%esi
mov    $0x15b38,%edx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    %rsp,%rdi
mov    %r14,%rsi
call   1040 <exchange@plt>
mov    (%rsp),%rsi
mov    0x8(%rsp),%rdx
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.array = [2 x i64] [i64 99999, i64 88888]
@.str = [37 x i8] c"Zeroth element is %lu first is %lu \0A\00"
define i32 @main() {
%1 = alloca [2 x i64]
%2 = bitcast [2 x i64]* %1 to i8*
%3 = getelementptr inbounds [2 x i64], [2 x i64]* %1, i64 0, i64 0
%4 = load i64, i64* %3
%5 = getelementptr inbounds [2 x i64], [2 x i64]* %1, i64 0, i64 1
%6 = load i64, i64* %5
%7 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i64 %4, i64 %6)
%8 = getelementptr inbounds [2 x i64], [2 x i64]* %1, i64 0, i64 0
%9 = getelementptr inbounds [2 x i64], [2 x i64]* %1, i64 0, i64 1
%10 = call i32 @exchange(i64* %8, i64* %9)
%11 = getelementptr inbounds [2 x i64], [2 x i64]* %1, i64 0, i64 0
%12 = load i64, i64* %11
%13 = getelementptr inbounds [2 x i64], [2 x i64]* %1, i64 0, i64 1
%14 = load i64, i64* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i64 %12, i64 %14)
ret i32 0
}

LLVM IR (-O2):
@__const.main.array = [2 x i64] [i64 99999, i64 88888]
@.str = [37 x i8] c"Zeroth element is %lu first is %lu \0A\00"
define i32 @main() {
%1 = alloca [2 x i64]
%2 = bitcast [2 x i64]* %1 to i8*
%3 = getelementptr inbounds [2 x i64], [2 x i64]* %1, i64 0, i64 0
%4 = getelementptr inbounds [2 x i64], [2 x i64]* %1, i64 0, i64 1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i64 99999, i64 88888)
%6 = call i32 @exchange(i64* %3, i64* %4)
%7 = load i64, i64* %3
%8 = load i64, i64* %4
%9 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i64 %7, i64 %8)
ret i32 0
}