xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ hasTimerElapsed();
bool shouldForceLanding(bool armed) { return hasTimerElapsed() && armed; }


x86 assembly (clang, -O0):
<shouldForceLanding>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <hasTimerElapsed@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
je     113e <shouldForceLanding+0x2e>
cmpl   $0x0,-0x4(%rbp)
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shouldForceLanding>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <hasTimerElapsed@plt>
test   %rax,%rax
setne  %al
test   %ebx,%ebx
setne  %cl
and    %al,%cl
movzbl %cl,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @shouldForceLanding(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i64 (...) @hasTimerElapsed()
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 0
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @shouldForceLanding(i32 %0) {
%2 = tail call i64 (...) @hasTimerElapsed()
%3 = icmp ne i64 %2, 0
%4 = icmp ne i32 %0, 0
%5 = and i1 %4, %3
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ ol(char *);
doublereg() { ol("ADD  AX,AX"); }


x86 assembly (clang, -O0):
<doublereg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <ol@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doublereg>:
lea    0xee9(%rip),%rdi
jmp    1030 <ol@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"ADD AX,AX\00"
define i32 @doublereg() {
%1 = alloca i32
%2 = call i32 @ol(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [11 x i8] c"ADD AX,AX\00"
define i32 @doublereg() {
%1 = tail call i32 @ol(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ Sys_Error(char *, int);
void TragicDeath(int signal_num) {
  Sys_Error("This death brought to you by the number %d\n", signal_num);
}


x86 assembly (clang, -O0):
<TragicDeath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <Sys_Error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TragicDeath>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <Sys_Error@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"This death brought to you by the number %d\0A\00"
define void @TragicDeath(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @Sys_Error(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [44 x i8] c"This death brought to you by the number %d\0A\00"
define void @TragicDeath(i32 %0) {
%2 = tail call i32 @Sys_Error(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ STDIN_FILENO;
scalar_t__ write(int /*<<< orphan*/, char *, int);
void linenoiseClearScreen(void) {
  if (write(STDIN_FILENO, "\x1b[H\x1b[2J", 7) <= 0) {
  }
}


x86 assembly (clang, -O0):
<linenoiseClearScreen>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
mov    $0x7,%edx
call   1030 <write@plt>
cmp    $0x0,%rax
jg     113d <linenoiseClearScreen+0x2d>
jmp    113d <linenoiseClearScreen+0x2d>
pop    %rbp
ret

x86 assembly (clang, -O2):
<linenoiseClearScreen>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
mov    $0x7,%edx
jmp    1030 <write@plt>

LLVM IR (-O0):
@STDIN_FILENO = global i32 0
@.str = [8 x i8] c"\1B[H\1B[2J\00"
define void @linenoiseClearScreen() {
%1 = load i32, i32* @STDIN_FILENO
%2 = call i64 @write(i32 %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
%3 = icmp sle i64 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %0
br label %5
5: ; preds = %4, %0
ret void
}

LLVM IR (-O2):
@STDIN_FILENO = global i32 0
@.str = [8 x i8] c"\1B[H\1B[2J\00"
define void @linenoiseClearScreen() {
%1 = load i32, i32* @STDIN_FILENO
%2 = tail call i64 @write(i32 %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ run_internal_diagnostics();
void run_diagnostics() {
  if (0) {
    run_internal_diagnostics();
  }
}


x86 assembly (clang, -O0):
<run_diagnostics>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_diagnostics>:
ret

LLVM IR (-O0):
define void @run_diagnostics() {
ret void
}

LLVM IR (-O2):
define void @run_diagnostics() {
ret void
}
int bar() { return -42; }


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffd6,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
mov    $0xffffffd6,%eax
ret

LLVM IR (-O0):
define i32 @bar() {
ret i32 -42
}

LLVM IR (-O2):
define i32 @bar() {
ret i32 -42
}
/* Variables and functions */
int /*<<< orphan*/ joga(int, int **, int);
int /*<<< orphan*/ marca_jodada(int, int, int *);
void play(int matriz[3][3], int vetor_posicao[9], int i, int modo_de_jogo,
          int jogada) {
  marca_jodada(jogada, i, vetor_posicao);
  joga(jogada, matriz, i);
}


x86 assembly (clang, -O0):
<play>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1040 <marca_jodada@plt>
mov    -0x1c(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <joga@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<play>:
push   %rbp
push   %r14
push   %rbx
mov    %r8d,%ebx
mov    %edx,%ebp
mov    %rsi,%rdx
mov    %rdi,%r14
mov    %r8d,%edi
mov    %ebp,%esi
call   1040 <marca_jodada@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %ebp,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <joga@plt>

LLVM IR (-O0):
define void @play([3 x i32]* %0, i32* %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca [3 x i32]*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store [3 x i32]* %0, [3 x i32]** %6
store i32* %1, i32** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32, i32* %10
%12 = load i32, i32* %8
%13 = load i32*, i32** %7
%14 = call i32 @marca_jodada(i32 %11, i32 %12, i32* %13)
%15 = load i32, i32* %10
%16 = load [3 x i32]*, [3 x i32]** %6
%17 = bitcast [3 x i32]* %16 to i32**
%18 = load i32, i32* %8
%19 = call i32 @joga(i32 %15, i32** %17, i32 %18)
ret void
}

LLVM IR (-O2):
define void @play([3 x i32]* %0, i32* %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @marca_jodada(i32 %4, i32 %2, i32* %1)
%7 = bitcast [3 x i32]* %0 to i32**
%8 = tail call i32 @joga(i32 %4, i32** %7, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ quit();
void sigint(int sig) { quit(); }


x86 assembly (clang, -O0):
<sigint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <quit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigint>:
xor    %eax,%eax
jmp    1030 <quit@plt>

LLVM IR (-O0):
define void @sigint(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @quit()
ret void
}

LLVM IR (-O2):
define void @sigint(i32 %0) {
%2 = tail call i32 (...) @quit()
ret void
}
puts(str) char *str;
{
  while (*str)
    putchar(*str++);
  putchar(10);
}


x86 assembly (clang, -O0):
<puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1147 <puts+0x37>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
mov    $0x0,%al
call   1030 <putchar@plt>
jmp    111c <puts+0xc>
mov    $0xa,%edi
mov    $0x0,%al
call   1030 <putchar@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<puts>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1135 <puts+0x25>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
xor    %eax,%eax
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <puts+0x10>
mov    $0xa,%edi
xor    %eax,%eax
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define i32 @puts(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
br label %4
4: ; preds = %8, %1
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %4
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %3
%11 = load i8, i8* %9
%12 = sext i8 %11 to i32
%13 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 %12)
br label %4
14: ; preds = %4
%15 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 10)
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @puts(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
%13 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 10)
ret i32 undef
}
int comp(const void *p1, const void *p2) { return *(int *)p2 - *(int *)p1; }


x86 assembly (clang, -O0):
<comp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<comp>:
mov    (%rsi),%eax
sub    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @comp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %3
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @comp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %0 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ read(int, char *, int);
void doprocessing(int sock) {
  char buff[1024];
  read(sock, buff, 10000);
}


x86 assembly (clang, -O0):
<doprocessing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x2710,%edx
call   1030 <read@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doprocessing>:
sub    $0x408,%rsp
mov    %rsp,%rsi
mov    $0x2710,%edx
call   1030 <read@plt>
add    $0x408,%rsp
ret

LLVM IR (-O0):
define void @doprocessing(i32 %0) {
%2 = alloca i32
%3 = alloca [1024 x i8]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = call i32 @read(i32 %4, i8* %5, i32 10000)
ret void
}

LLVM IR (-O2):
define void @doprocessing(i32 %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = call i32 @read(i32 %0, i8* %3, i32 10000)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
int /*<<< orphan*/ printb(int);
int /*<<< orphan*/ printd(int);
void leftp(int a, int b) {
  int *p;
  printb(a);
  print(" <<= ");
  printd(b);
  print(" -> ");
  p = &a;
  *p <<= b;
  printb(*p);
  print("\r\n");
}


x86 assembly (clang, -O0):
<leftp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <printb@plt>
lea    0xeb3(%rip),%rdi
call   1050 <print@plt>
mov    -0x8(%rbp),%edi
call   1040 <printd@plt>
lea    0xea5(%rip),%rdi
call   1050 <print@plt>
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
shl    %cl,%edx
mov    %edx,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1030 <printb@plt>
lea    0xe7c(%rip),%rdi
call   1050 <print@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<leftp>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <printb@plt>
lea    0xebd(%rip),%rdi
call   1050 <print@plt>
mov    %ebx,%edi
call   1040 <printd@plt>
lea    0xeb0(%rip),%rdi
call   1050 <print@plt>
mov    %ebx,%ecx
shl    %cl,%ebp
mov    %ebp,%edi
call   1030 <printb@plt>
lea    0xe9e(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <print@plt>

LLVM IR (-O0):
@.str = [6 x i8] c" <<= \00"
@.str.1 = [5 x i8] c" -> \00"
@.str.2 = [3 x i8] c"\0D\0A\00"
define void @leftp(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = call i32 @printb(i32 %6)
%8 = call i32 @print(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* %4
%10 = call i32 @printd(i32 %9)
%11 = call i32 @print(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %5
%12 = load i32, i32* %4
%13 = load i32*, i32** %5
%14 = load i32, i32* %13
%15 = shl i32 %14, %12
store i32 %15, i32* %13
%16 = load i32*, i32** %5
%17 = load i32, i32* %16
%18 = call i32 @printb(i32 %17)
%19 = call i32 @print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c" <<= \00"
@.str.1 = [5 x i8] c" -> \00"
@.str.2 = [3 x i8] c"\0D\0A\00"
define void @leftp(i32 %0, i32 %1) {
%3 = tail call i32 @printb(i32 %0)
%4 = tail call i32 @print(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @printd(i32 %1)
%6 = tail call i32 @print(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%7 = shl i32 %0, %1
%8 = tail call i32 @printb(i32 %7)
%9 = tail call i32 @print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
void get_main_memory_size(size_t *totalMem, size_t *availMem) {
  FILE *fp;
  int found = 0;
  size_t size = 0;
  char buff[256], field[256], unit[256];
}


x86 assembly (clang, -O0):
<get_main_memory_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2b0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
movq   $0x0,-0x28(%rbp)
add    $0x2b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_main_memory_size>:
ret

LLVM IR (-O0):
define void @get_main_memory_size(i64* %0, i64* %1) {
%3 = alloca i64*
%4 = alloca i64*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i64
%8 = alloca [256 x i8]
%9 = alloca [256 x i8]
%10 = alloca [256 x i8]
store i64* %0, i64** %3
store i64* %1, i64** %4
store i32 0, i32* %6
store i64 0, i64* %7
ret void
}

LLVM IR (-O2):
define void @get_main_memory_size(i64* nocapture %0, i64* nocapture %1) {
ret void
}
unsigned int _pack_word(unsigned char *buf, unsigned int value) {
  for (int i = 0; i < 4; i++) {
    buf[i] = (unsigned char)((value >> (i * 8)) & 0xff);
  }
}


x86 assembly (clang, -O0):
<_pack_word>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x4,-0x18(%rbp)
jge    1147 <_pack_word+0x47>
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    $0x3,%ecx
shr    %cl,%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <_pack_word+0x12>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_pack_word>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define i32 @_pack_word(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %21, %2
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 4
br i1 %9, label %10, label %24
10: ; preds = %7
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = mul nsw i32 %12, 8
%14 = lshr i32 %11, %13
%15 = and i32 %14, 255
%16 = trunc i32 %15 to i8
%17 = load i8*, i8** %4
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
store i8 %16, i8* %20
br label %21
21: ; preds = %10
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
store i32 %23, i32* %6
br label %7
24: ; preds = %7
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @_pack_word(i8* nocapture writeonly %0, i32 %1) {
%3 = trunc i32 %1 to i8
store i8 %3, i8* %0
%4 = lshr i32 %1, 8
%5 = trunc i32 %4 to i8
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %6
%7 = lshr i32 %1, 16
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %8, i8* %9
%10 = lshr i32 %1, 24
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %11, i8* %12
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char const *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int main() {
  FILE *fp;
  FILE *(*f)(const char *, const char *);
  f = fopen;
  fp = f("test.txt", "a");
  fprintf(fp, "Testing...\n");
  fclose(fp);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb9(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xec6(%rip),%rdi
lea    0xec8(%rip),%rsi
call   *-0x10(%rbp)
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb8(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xeca(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
lea    0xebd(%rip),%rdi
mov    $0xb,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1050 <fwrite@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"test.txt\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [12 x i8] c"Testing...\0A\00"
define i32 @main() {
%1 = alloca i32*
%2 = alloca i32* (i8*, i8*)*
store i32* (i8*, i8*)* @fopen, i32* (i8*, i8*)** %2
%3 = load i32* (i8*, i8*)*, i32* (i8*, i8*)** %2
%4 = call i32* %3(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %1
%5 = load i32*, i32** %1
%6 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%7 = load i32*, i32** %1
%8 = call i32 @fclose(i32* %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"test.txt\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [12 x i8] c"Testing...\0A\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i64 11, i64 1, i32* %1)
%3 = tail call i32 @fclose(i32* %1)
ret i32 0
}
int initmultiplayerscycle(void) { return 0; }


x86 assembly (clang, -O0):
<initmultiplayerscycle>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<initmultiplayerscycle>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @initmultiplayerscycle() {
ret i32 0
}

LLVM IR (-O2):
define i32 @initmultiplayerscycle() {
ret i32 0
}
/* Variables and functions */
int qe_inrange(int, char, char);
int qe_isupper(int c) { return qe_inrange(c, 'A', 'Z'); }


x86 assembly (clang, -O0):
<qe_isupper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x41,%esi
mov    $0x5a,%edx
call   1030 <qe_inrange@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qe_isupper>:
mov    $0x41,%esi
mov    $0x5a,%edx
jmp    1030 <qe_inrange@plt>

LLVM IR (-O0):
define i32 @qe_isupper(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @qe_inrange(i32 %3, i8 signext 65, i8 signext 90)
ret i32 %4
}

LLVM IR (-O2):
define i32 @qe_isupper(i32 %0) {
%2 = tail call i32 @qe_inrange(i32 %0, i8 signext 65, i8 signext 90)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ net_driverlist_remove(void *, int);
int remove_helper(int driver, void *dat) {
  return !net_driverlist_remove(dat, driver);
}


x86 assembly (clang, -O0):
<remove_helper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1030 <net_driverlist_remove@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_helper>:
push   %rax
mov    %edi,%eax
mov    %rsi,%rdi
mov    %eax,%esi
call   1030 <net_driverlist_remove@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @remove_helper(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i32, i32* %3
%7 = call i32 @net_driverlist_remove(i8* %5, i32 %6)
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @remove_helper(i32 %0, i8* %1) {
%3 = tail call i32 @net_driverlist_remove(i8* %1, i32 %0)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
void WebReportAssertionFailure(const char *file, int line, const char *function,
                               const char *assertion) {}


x86 assembly (clang, -O0):
<WebReportAssertionFailure>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<WebReportAssertionFailure>:
ret

LLVM IR (-O0):
define void @WebReportAssertionFailure(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
ret void
}

LLVM IR (-O2):
define void @WebReportAssertionFailure(i8* nocapture %0, i32 %1, i8* nocapture %2, i8* nocapture %3) {
ret void
}
void port_timer_stop_alarm(void) {
  void stStopAlarm(void);
  stStopAlarm();
}


x86 assembly (clang, -O0):
<port_timer_stop_alarm>:
push   %rbp
mov    %rsp,%rbp
call   1030 <stStopAlarm@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<port_timer_stop_alarm>:
jmp    1030 <stStopAlarm@plt>

LLVM IR (-O0):
define void @port_timer_stop_alarm() {
ret void
}

LLVM IR (-O2):
define void @port_timer_stop_alarm() {
tail call void @stStopAlarm()
ret void
}
/* Variables and functions */
char *bf_minimize_file(char *);
char *bf_read_file(char *);
char *bf_read_file_and_minimize(char *filename) {
  char *file_contents = bf_read_file(filename);
  if (!file_contents)
    return NULL;
  file_contents = bf_minimize_file(file_contents);
  return file_contents;
}


x86 assembly (clang, -O0):
<bf_read_file_and_minimize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <bf_read_file@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1151 <bf_read_file_and_minimize+0x31>
movq   $0x0,-0x8(%rbp)
jmp    1166 <bf_read_file_and_minimize+0x46>
mov    -0x18(%rbp),%rdi
call   1040 <bf_minimize_file@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bf_read_file_and_minimize>:
push   %rax
call   1030 <bf_read_file@plt>
test   %rax,%rax
je     1134 <bf_read_file_and_minimize+0x14>
mov    %rax,%rdi
pop    %rax
jmp    1040 <bf_minimize_file@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i8* @bf_read_file_and_minimize(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @bf_read_file(i8* %5)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %10, label %9
9: ; preds = %1
store i8* null, i8** %2
br label %14
10: ; preds = %1
%11 = load i8*, i8** %4
%12 = call i8* @bf_minimize_file(i8* %11)
store i8* %12, i8** %4
%13 = load i8*, i8** %4
store i8* %13, i8** %2
br label %14
14: ; preds = %10, %9
%15 = load i8*, i8** %2
ret i8* %15
}

LLVM IR (-O2):
define i8* @bf_read_file_and_minimize(i8* %0) {
%2 = tail call i8* @bf_read_file(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i8* @bf_minimize_file(i8* %2)
br label %6
6: ; preds = %1, %4
%7 = phi i8* [ %5, %4 ], [ null, %1 ]
ret i8* %7
}
int test_imm_CFuint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0xCF << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_CFuint64_highword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
shr    $0x20,%rdx
and    $0xcf,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_CFuint64_highword_reg>:
movabs $0xcf00000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_CFuint64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 32
%5 = and i64 %4, 207
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_CFuint64_highword_reg(i64 %0) {
%2 = and i64 %0, 889058230272
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int bar(int n) { return n + 1; }


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
lea    0x1(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @bar(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1
ret i32 %4
}

LLVM IR (-O2):
define i32 @bar(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
int foo(volatile *mem, int val, int c) {
  int oldval = __sync_fetch_and_add(mem, val);
  return oldval + c;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%eax
lock xadd %eax,(%rcx)
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
lock xadd %esi,(%rdi)
lea    (%rsi,%rdx,1),%eax
ret

LLVM IR (-O0):
define i32 @foo(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32*, i32** %4
%9 = load i32, i32* %5
%10 = atomicrmw add i32* %8, i32 %9 seq_cst
store i32 %10, i32* %7
%11 = load i32, i32* %7
%12 = load i32, i32* %6
%13 = add nsw i32 %11, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @foo(i32* nocapture %0, i32 %1, i32 %2) {
%4 = atomicrmw add i32* %0, i32 %1 seq_cst
%5 = add nsw i32 %4, %2
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
char *logtime();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sleep(int);
void term(int sig) {
  printf("%s Received INT signal. Exiting.\n", logtime());
  fflush(NULL);
  sleep(1);
  exit(0);
}


x86 assembly (clang, -O0):
<term>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <logtime@plt>
mov    %rax,%rsi
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <fflush@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<term>:
push   %rax
xor    %eax,%eax
call   1040 <logtime@plt>
lea    0xea1(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <fflush@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"%s Received INT signal. Exiting.\0A\00"
define void @term(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i8* (...) @logtime()
%4 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @fflush(i32* null)
%6 = call i32 @sleep(i32 1)
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [34 x i8] c"%s Received INT signal. Exiting.\0A\00"
define void @term(i32 %0) {
%2 = tail call i8* (...) @logtime()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = tail call i32 @fflush(i32* null)
%5 = tail call i32 @sleep(i32 1)
%6 = tail call i32 @exit(i32 0)
unreachable
}
void cswap(char *c1, char *c2) {
  char cc;
  cc = *c1;
  *c1 = *c2;
  *c2 = cc;
}


x86 assembly (clang, -O0):
<cswap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x11(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cswap>:
mov    (%rdi),%al
mov    (%rsi),%cl
mov    %cl,(%rdi)
mov    %al,(%rsi)
ret

LLVM IR (-O0):
define void @cswap(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
store i8 %7, i8* %5
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = load i8*, i8** %3
store i8 %9, i8* %10
%11 = load i8, i8* %5
%12 = load i8*, i8** %4
store i8 %11, i8* %12
ret void
}

LLVM IR (-O2):
define void @cswap(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
store i8 %4, i8* %0
store i8 %3, i8* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void badcnt(const char *s) {
  (void)fprintf(stderr,
                ("hexdump: bad byte count for conversion character %s.\n"), s);
  exit(1);
}


x86 assembly (clang, -O0):
<badcnt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<badcnt>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [54 x i8] c"hexdump: bad byte count for conversion character %s.\0A\00"
define void @badcnt(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [54 x i8] c"hexdump: bad byte count for conversion character %s.\0A\00"
define void @badcnt(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
struct p_lastlog {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ getlluid(int);
struct p_lastlog *ll2p(int /*<<< orphan*/);
extern struct p_lastlog *p_getlluid(int uid) { return ll2p(getlluid(uid)); }


x86 assembly (clang, -O0):
<p_getlluid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <getlluid@plt>
mov    %eax,%edi
call   1040 <ll2p@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<p_getlluid>:
push   %rax
call   1030 <getlluid@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <ll2p@plt>

LLVM IR (-O0):
%struct.p_lastlog = type { i32 }
define %struct.p_lastlog* @p_getlluid(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @getlluid(i32 %3)
%5 = call %struct.p_lastlog* @ll2p(i32 %4)
ret %struct.p_lastlog* %5
}

LLVM IR (-O2):
%struct.p_lastlog = type { i32 }
define %struct.p_lastlog* @p_getlluid(i32 %0) {
%2 = tail call i32 @getlluid(i32 %0)
%3 = tail call %struct.p_lastlog* @ll2p(i32 %2)
ret %struct.p_lastlog* %3
}
/* Variables and functions */
int maxof3(int, int, int);
int /*<<< orphan*/ printf(char *, int, int, int, int);
int main() {
  int a = 98765432, b = 123123123, c = 12322;
  printf("Max of %d, %d, and %d is %d\n", a, b, c, maxof3(a, b, c));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5e30a78,-0x8(%rbp)
movl   $0x756b5b3,-0xc(%rbp)
movl   $0x3022,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <maxof3@plt>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    %eax,%r8d
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x5e30a78,%edi
mov    $0x756b5b3,%esi
mov    $0x3022,%edx
call   1030 <maxof3@plt>
lea    0xec4(%rip),%rdi
mov    $0x5e30a78,%esi
mov    $0x756b5b3,%edx
mov    $0x3022,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Max of %d, %d, and %d is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 98765432, i32* %2
store i32 123123123, i32* %3
store i32 12322, i32* %4
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call i32 @maxof3(i32 %8, i32 %9, i32 %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6, i32 %7, i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"Max of %d, %d, and %d is %d\0A\00"
define i32 @main() {
%1 = tail call i32 @maxof3(i32 98765432, i32 123123123, i32 12322)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 98765432, i32 123123123, i32 12322, i32 %1)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ xcb_get_property_reply_t;
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ xcb_ewmh_get_cardinal_from_reply(int /*<<< orphan*/ *,
                                                    int /*<<< orphan*/ *);
uint8_t xcb_ewmh_get_showing_desktop_from_reply(uint32_t *desktop,
                                                xcb_get_property_reply_t *r) {
  return xcb_ewmh_get_cardinal_from_reply(desktop, r);
}


x86 assembly (clang, -O0):
<xcb_ewmh_get_showing_desktop_from_reply>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <xcb_ewmh_get_cardinal_from_reply@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcb_ewmh_get_showing_desktop_from_reply>:
jmp    1030 <xcb_ewmh_get_cardinal_from_reply@plt>

LLVM IR (-O0):
define i32 @xcb_ewmh_get_showing_desktop_from_reply(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %3
%6 = load i32*, i32** %4
%7 = call i32 @xcb_ewmh_get_cardinal_from_reply(i32* %5, i32* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @xcb_ewmh_get_showing_desktop_from_reply(i32* %0, i32* %1) {
%3 = tail call i32 @xcb_ewmh_get_cardinal_from_reply(i32* %0, i32* %1)
ret i32 %3
}
void UI_get_result_minsize(void) {}


x86 assembly (clang, -O0):
<UI_get_result_minsize>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UI_get_result_minsize>:
ret

LLVM IR (-O0):
define void @UI_get_result_minsize() {
ret void
}

LLVM IR (-O2):
define void @UI_get_result_minsize() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LOG_INFO;
int SIGTERM;
int /*<<< orphan*/ closelog();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *);
void sig_term(int signo) {
  if (signo == SIGTERM) {
    syslog(LOG_INFO, "log4j-agent program terminated.");
    closelog();
    exit(0);
  }
}


x86 assembly (clang, -O0):
<sig_term>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ea3(%rip),%rcx
cmp    (%rcx),%eax
jne    1170 <sig_term+0x40>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
lea    0xea3(%rip),%rsi
call   1040 <syslog@plt>
mov    $0x0,%al
call   1030 <closelog@plt>
xor    %edi,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_term>:
push   %rax
mov    0x2eb0(%rip),%rax
cmp    %edi,(%rax)
je     113e <sig_term+0xe>
pop    %rax
ret
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
lea    0xeb2(%rip),%rsi
call   1040 <syslog@plt>
xor    %eax,%eax
call   1030 <closelog@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@SIGTERM = global i32 0
@LOG_INFO = global i32 0
@.str = [32 x i8] c"log4j-agent program terminated.\00"
define void @sig_term(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGTERM
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i32, i32* @LOG_INFO
%8 = call i32 @syslog(i32 %7, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (...) @closelog()
%10 = call i32 @exit(i32 0)
unreachable
11: ; preds = %1
ret void
}

LLVM IR (-O2):
@SIGTERM = global i32 0
@LOG_INFO = global i32 0
@.str = [32 x i8] c"log4j-agent program terminated.\00"
define void @sig_term(i32 %0) {
%2 = load i32, i32* @SIGTERM
%3 = icmp eq i32 %2, %0
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = load i32, i32* @LOG_INFO
%6 = tail call i32 @syslog(i32 %5, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (...) @closelog()
%8 = tail call i32 @exit(i32 0)
unreachable
9: ; preds = %1
ret void
}
/* Type definitions */
typedef int uint64_t;
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ error(char *);
int64_t convert_to_signed(uint64_t temp) {
  ++temp;
  if (temp == 0)
    error("signed value too big (more than 63 bits)");
  if (temp & 1)
    return -(temp >> 1);
  else
    return temp >> 1;
}


x86 assembly (clang, -O0):
<convert_to_signed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    113a <convert_to_signed+0x2a>
lea    0xecb(%rip),%rdi
call   1030 <error@plt>
mov    -0x8(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     115b <convert_to_signed+0x4b>
mov    -0x8(%rbp),%ecx
sar    $0x1,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1164 <convert_to_signed+0x54>
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_to_signed>:
push   %rbx
mov    %edi,%ebx
inc    %ebx
jne    1123 <convert_to_signed+0x13>
lea    0xee2(%rip),%rdi
call   1030 <error@plt>
mov    %ebx,%ecx
sar    %ecx
mov    %ecx,%eax
neg    %eax
test   $0x1,%bl
cmove  %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [41 x i8] c"signed value too big (more than 63 bits)\00"
define i32 @convert_to_signed(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = add nsw i32 %4, 1
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @error(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i32, i32* %3
%12 = and i32 %11, 1
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i32, i32* %3
%16 = ashr i32 %15, 1
%17 = sub nsw i32 0, %16
store i32 %17, i32* %2
br label %21
18: ; preds = %10
%19 = load i32, i32* %3
%20 = ashr i32 %19, 1
store i32 %20, i32* %2
br label %21
21: ; preds = %18, %14
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
@.str = [41 x i8] c"signed value too big (more than 63 bits)\00"
define i32 @convert_to_signed(i32 %0) {
%2 = add nsw i32 %0, 1
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @error(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = and i32 %2, 1
%8 = icmp eq i32 %7, 0
%9 = ashr i32 %2, 1
%10 = sub nsw i32 0, %9
%11 = select i1 %8, i32 %9, i32 %10
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int XUninstallColormap() {
  printf("XUninstallColormap called\n");
  return 0;
}


x86 assembly (clang, -O0):
<XUninstallColormap>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<XUninstallColormap>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"XUninstallColormap called\0A\00"
define i32 @XUninstallColormap() {
%1 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [26 x i8] c"XUninstallColormap called\00"
define i32 @XUninstallColormap() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ commandControl();
int /*<<< orphan*/ displayMenu();
int main(int argc, char **argv) {
  displayMenu();
  commandControl();
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <displayMenu@plt>
mov    $0x0,%al
call   1040 <commandControl@plt>
mov    0x2e95(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <displayMenu@plt>
xor    %eax,%eax
call   1040 <commandControl@plt>
mov    0x2eaa(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @displayMenu()
%7 = call i32 (...) @commandControl()
%8 = load i32, i32* @EXIT_SUCCESS
ret i32 %8
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @displayMenu()
%4 = tail call i32 (...) @commandControl()
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}
/* Variables and functions */
unsigned long long read_num(char const *, int, char *);
unsigned long long read_bin(const char *s) { return read_num(s, 2, "binary"); }


x86 assembly (clang, -O0):
<read_bin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2,%esi
lea    0xed4(%rip),%rdx
call   1030 <read_num@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_bin>:
lea    0xee9(%rip),%rdx
mov    $0x2,%esi
jmp    1030 <read_num@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"binary\00"
define i64 @read_bin(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @read_num(i8* %3, i32 2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i64 %4
}

LLVM IR (-O2):
@.str = [7 x i8] c"binary\00"
define i64 @read_bin(i8* %0) {
%2 = tail call i64 @read_num(i8* %0, i32 2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i64 %2
}
/* Type definitions */
struct timeval {
  int tv_sec;
  scalar_t__ tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_SNDTIMEO;
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, struct timeval *,
               int);
int set_send_timeout(int sock, int seconds) {
  struct timeval tmo;
  tmo.tv_sec = seconds;
  tmo.tv_usec = 0;
  return setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, &tmo,
                    sizeof(struct timeval));
}


x86 assembly (clang, -O0):
<set_send_timeout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eaa(%rip),%rax
mov    (%rax),%esi
mov    0x2eb1(%rip),%rax
mov    (%rax),%edx
lea    -0x18(%rbp),%rcx
mov    $0x10,%r8d
call   1030 <setsockopt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_send_timeout>:
sub    $0x18,%rsp
mov    %esi,0x8(%rsp)
movq   $0x0,0x10(%rsp)
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
mov    0x2ebf(%rip),%rax
mov    (%rax),%edx
lea    0x8(%rsp),%rcx
mov    $0x10,%r8d
call   1030 <setsockopt@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
@SOL_SOCKET = global i32 0
@SO_SNDTIMEO = global i32 0
define i32 @set_send_timeout(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.timeval
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
store i32 %6, i32* %7
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 1
store i64 0, i64* %8
%9 = load i32, i32* %3
%10 = load i32, i32* @SOL_SOCKET
%11 = load i32, i32* @SO_SNDTIMEO
%12 = call i32 @setsockopt(i32 %9, i32 %10, i32 %11, %struct.timeval* %5, i32 16)
ret i32 %12
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
@SOL_SOCKET = global i32 0
@SO_SNDTIMEO = global i32 0
define i32 @set_send_timeout(i32 %0, i32 %1) {
%3 = alloca %struct.timeval
%4 = bitcast %struct.timeval* %3 to i8*
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
store i32 %1, i32* %5
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
store i64 0, i64* %6
%7 = load i32, i32* @SOL_SOCKET
%8 = load i32, i32* @SO_SNDTIMEO
%9 = call i32 @setsockopt(i32 %0, i32 %7, i32 %8, %struct.timeval* %3, i32 16)
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void intro(void) {
  printf("The perfect numbers from 1 to 10,000 will be printed below:\n\n");
  printf("This is proven by the summation of all factors - excl. the number "
         "itself.\n\n");
}


x86 assembly (clang, -O0):
<intro>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
lea    0xf17(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<intro>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf19(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [62 x i8] c"The perfect numbers from 1 to 10,000 will be printed below:\0A\0A\00"
@.str.1 = [76 x i8] c"This is proven by the summation of all factors - excl. the number itself.\0A\0A\00"
define void @intro() {
%1 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [61 x i8] c"The perfect numbers from 1 to 10,000 will be printed below:\0A\00"
@str.2 = [75 x i8] c"This is proven by the summation of all factors - excl. the number itself.\0A\00"
define void @intro() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @str.2, i64 0, i64 0))
ret void
}