#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 */
scalar_t__ EOF;
scalar_t__ getint(int *);
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ swap(int *, int *);
int main(void) {
  int a = 1, b = 2;
  swap(&a, &b);
  printf("a -> %d and b -> %d\n\n", a, b);
  int n, array[100];
  for (n = 0; n < 100 && getint(&array[n]) != EOF; n++)
    printf("%d ", array[n]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <swap@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
xor    %eax,%eax
cmpl   $0x64,-0x10(%rbp)
mov    %al,-0x1a1(%rbp)
jge    11b4 <main+0x84>
movslq -0x10(%rbp),%rax
lea    -0x1a0(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
call   1040 <getint@plt>
mov    0x2e40(%rip),%rcx
cmp    (%rcx),%rax
setne  %al
mov    %al,-0x1a1(%rbp)
mov    -0x1a1(%rbp),%al
test   $0x1,%al
jne    11c7 <main+0x97>
jmp    11ee <main+0xbe>
movslq -0x10(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%esi
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1178 <main+0x48>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x1a0,%rsp
movl   $0x1,0xc(%rsp)
movl   $0x2,0x8(%rsp)
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1050 <swap@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
lea    0xe96(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e70(%rip),%r15
lea    0xe97(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    (%rsp,%rbx,1),%rdi
add    $0x10,%rdi
call   1040 <getint@plt>
cmp    (%r15),%rax
je     11bd <main+0x8d>
mov    0x10(%rsp,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x4,%rbx
cmp    $0x190,%rbx
jne    1190 <main+0x60>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [22 x i8] c"a -> %d and b -> %d\0A\0A\00"
@EOF = global i64 0
@.str.1 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [100 x i32]
store i32 0, i32* %1
store i32 1, i32* %2
store i32 2, i32* %3
%6 = call i32 @swap(i32* %2, i32* %3)
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8)
store i32 0, i32* %4
br label %10
10: ; preds = %28, %0
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 100
br i1 %12, label %13, label %20
13: ; preds = %10
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 %15
%17 = call i64 @getint(i32* %16)
%18 = load i64, i64* @EOF
%19 = icmp ne i64 %17, %18
br label %20
20: ; preds = %13, %10
%21 = phi i1 [ false, %10 ], [ %19, %13 ]
br i1 %21, label %22, label %31
22: ; preds = %20
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %22
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
br label %10
31: ; preds = %20
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"a -> %d and b -> %d\0A\0A\00"
@EOF = global i64 0
@.str.1 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100 x i32]
%4 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%5 = bitcast i32* %2 to i8*
store i32 2, i32* %2
%6 = call i32 @swap(i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8)
%10 = bitcast [100 x i32]* %3 to i8*
br label %11
11: ; preds = %0, %17
%12 = phi i64 [ 0, %0 ], [ %20, %17 ]
%13 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %12
%14 = call i64 @getint(i32* %13)
%15 = load i64, i64* @EOF
%16 = icmp eq i64 %14, %15
br i1 %16, label %22, label %17
17: ; preds = %11
%18 = load i32, i32* %13
%19 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = add nuw nsw i64 %12, 1
%21 = icmp eq i64 %20, 100
br i1 %21, label %22, label %11
22: ; preds = %17, %11
ret i32 0
}