#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 atoi(char const *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ swap(int *, int *);
int main(int argc, const char *argv[]) {
  int a, b;
  if (argc == 1) {
    a = 10;
    b = 20;
  } else if (argc == 3) {
    a = atoi(argv[1]);
    b = atoi(argv[2]);
  }
  printf("after :");
  printf("a = %d, b = %d\n", a, b);
  swap(&a, &b);
  printf("before:");
  printf("a = %d, b = %d\n", a, b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1163 <main+0x33>
movl   $0xa,-0x14(%rbp)
movl   $0x14,-0x18(%rbp)
jmp    1192 <main+0x62>
cmpl   $0x3,-0x8(%rbp)
jne    118d <main+0x5d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    1192 <main+0x62>
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x14(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <swap@plt>
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
cmp    $0x3,%edi
je     115e <main+0x2e>
cmp    $0x1,%edi
jne    117f <main+0x4f>
movl   $0xa,0xc(%rsp)
movl   $0x14,0x8(%rsp)
mov    $0xa,%ebx
mov    $0x14,%ebp
jmp    117f <main+0x4f>
mov    %rsi,%rbp
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
mov    %eax,%ebx
mov    %eax,0xc(%rsp)
mov    0x10(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,%ebp
mov    %eax,0x8(%rsp)
lea    0xe7a(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe74(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1050 <swap@plt>
lea    0xe60(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"after :\00"
@.str.1 = [16 x i8] c"a = %d, b = %d\0A\00"
@.str.2 = [8 x i8] c"before:\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 10, i32* %6
store i32 20, i32* %7
br label %24
11: ; preds = %2
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 3
br i1 %13, label %14, label %23
14: ; preds = %11
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @atoi(i8* %17)
store i32 %18, i32* %6
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
store i32 %22, i32* %7
br label %23
23: ; preds = %14, %11
br label %24
24: ; preds = %23, %10
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%26 = load i32, i32* %6
%27 = load i32, i32* %7
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %26, i32 %27)
%29 = call i32 @swap(i32* %6, i32* %7)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%31 = load i32, i32* %6
%32 = load i32, i32* %7
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %31, i32 %32)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"after :\00"
@.str.1 = [16 x i8] c"a = %d, b = %d\0A\00"
@.str.2 = [8 x i8] c"before:\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
switch i32 %0, label %15 [
i32 1, label %7
i32 3, label %8
]
7: ; preds = %2
store i32 10, i32* %3
store i32 20, i32* %4
br label %15
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
store i32 %11, i32* %3
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32 @atoi(i8* %13)
store i32 %14, i32* %4
br label %15
15: ; preds = %2, %8, %7
%16 = phi i32 [ undef, %2 ], [ %14, %8 ], [ 20, %7 ]
%17 = phi i32 [ undef, %2 ], [ %11, %8 ], [ 10, %7 ]
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %17, i32 %16)
%20 = call i32 @swap(i32* %3, i32* %4)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%22 = load i32, i32* %3
%23 = load i32, i32* %4
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %22, i32 %23)
ret i32 0
}