xunge/DecIR huggingface dataset:
int DNSServiceRefDeallocate() { return 1; }


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

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

LLVM IR (-O0):
define i32 @DNSServiceRefDeallocate() {
ret i32 1
}

LLVM IR (-O2):
define i32 @DNSServiceRefDeallocate() {
ret i32 1
}
void swap(int *a, int *b) {
  int tmp = 0;
  tmp = *a;
  *a = *b;
  *b = tmp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @swap(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
store i32 %4, i32* %0
store i32 %3, i32* %1
ret void
}
char TestA() {
  char r;
  __asm__("cmp $0, %1" : "=@cca"(r) : "r"(1));
  if (r) {
    __asm__("cmp $2, %1" : "=@ccna"(r) : "r"(1));
    if (r) {
      __asm__("cmp $1, %1" : "=@ccna"(r) : "r"(1));
      if (r)
        return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<TestA>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%eax
cmp    $0x0,%eax
seta   %al
mov    %al,-0x2(%rbp)
cmpb   $0x0,-0x2(%rbp)
je     115f <TestA+0x5f>
mov    $0x1,%eax
cmp    $0x2,%eax
setbe  %al
mov    %al,-0x2(%rbp)
cmpb   $0x0,-0x2(%rbp)
je     115a <TestA+0x5a>
mov    $0x1,%eax
cmp    $0x1,%eax
setbe  %al
mov    %al,-0x2(%rbp)
cmpb   $0x0,-0x2(%rbp)
je     1155 <TestA+0x55>
movb   $0x1,-0x1(%rbp)
jmp    1163 <TestA+0x63>
jmp    115a <TestA+0x5a>
jmp    115f <TestA+0x5f>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TestA>:
mov    $0x1,%eax
cmp    $0x0,%eax
jbe    111c <TestA+0x1c>
cmp    $0x2,%eax
ja     111c <TestA+0x1c>
mov    $0x1,%eax
cmp    $0x1,%eax
mov    $0x1,%al
ja     111c <TestA+0x1c>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define signext i8 @TestA() {
%1 = alloca i8
%2 = alloca i8
%3 = call i8 asm "cmp $$0, $1", "={@cca},r,~{dirflag},~{fpsr},~{flags}"(i32 1)
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = icmp ne i8 %4, 0
br i1 %5, label %6, label %17
6: ; preds = %0
%7 = call i8 asm "cmp $$2, $1", "={@ccna},r,~{dirflag},~{fpsr},~{flags}"(i32 1)
store i8 %7, i8* %2
%8 = load i8, i8* %2
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %6
%11 = call i8 asm "cmp $$1, $1", "={@ccna},r,~{dirflag},~{fpsr},~{flags}"(i32 1)
store i8 %11, i8* %2
%12 = load i8, i8* %2
%13 = icmp ne i8 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %10
store i8 1, i8* %1
br label %18
15: ; preds = %10
br label %16
16: ; preds = %15, %6
br label %17
17: ; preds = %16, %0
store i8 0, i8* %1
br label %18
18: ; preds = %17, %14
%19 = load i8, i8* %1
ret i8 %19
}

LLVM IR (-O2):
define signext i8 @TestA() {
%1 = tail call i8 asm "cmp $$0, $1", "={@cca},r,~{dirflag},~{fpsr},~{flags}"(i32 1)
%2 = icmp eq i8 %1, 0
br i1 %2, label %9, label %3
3: ; preds = %0
%4 = tail call i8 asm "cmp $$2, $1", "={@ccna},r,~{dirflag},~{fpsr},~{flags}"(i32 1)
%5 = icmp eq i8 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i8 asm "cmp $$1, $1", "={@ccna},r,~{dirflag},~{fpsr},~{flags}"(i32 1)
%8 = icmp eq i8 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %3, %6, %0
br label %10
10: ; preds = %6, %9
%11 = phi i8 [ 0, %9 ], [ 1, %6 ]
ret i8 %11
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isxdigit(int);
void t_isxdigit_0xb8() {
  Assert_real((isxdigit(184) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isxdigit.c",
              925, ("isxdigit should be 0 for 0xb8"));
}


x86 assembly (clang, -O0):
<t_isxdigit_0xb8>:
push   %rbp
mov    %rsp,%rbp
mov    $0xb8,%edi
call   1030 <isxdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x39d,%edx
lea    0xf5c(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isxdigit_0xb8>:
push   %rax
mov    $0xb8,%edi
call   1030 <isxdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x39d,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isxdigit.c\00"
@.str.1 = [30 x i8] c"isxdigit should be 0 for 0xb8\00"
define void @t_isxdigit_0xb8() {
%1 = call i64 @isxdigit(i32 184)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 925, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isxdigit.c\00"
@.str.1 = [30 x i8] c"isxdigit should be 0 for 0xb8\00"
define void @t_isxdigit_0xb8() {
%1 = tail call i64 @isxdigit(i32 184)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 925, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
fun() { printf("Yes\n"); }


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

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

LLVM IR (-O0):
@.str = [5 x i8] c"Yes\0A\00"
define i32 @fun() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [4 x i8] c"Yes\00"
define i32 @fun() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
void swap(int array[], int i, int j) {
  int temp = array[i];
  array[i] = array[j];
  array[j] = temp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%ecx
movslq %edx,%rdx
mov    (%rdi,%rdx,4),%esi
mov    %esi,(%rdi,%rax,4)
mov    %ecx,(%rdi,%rdx,4)
ret

LLVM IR (-O0):
define void @swap(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 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = load i32, i32* %11
store i32 %12, i32* %7
%13 = load i32*, i32** %4
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = load i32*, i32** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
store i32 %17, i32* %21
%22 = load i32, i32* %7
%23 = load i32*, i32** %4
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
store i32 %22, i32* %26
ret void
}

LLVM IR (-O2):
define void @swap(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %5
store i32 %6, i32* %8
ret void
}
/* Variables and functions */
int procversion();
int runversion(int argc, char **argv) {
  int rv = procversion();
  return rv;
}


x86 assembly (clang, -O0):
<runversion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <procversion@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @runversion(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @procversion()
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  int a;
  int b;
  a = 6;
  b = 5;
  a > b ? printf("A>B") : (a == b ? printf("A==B") : printf("A<B"));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x6,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    114a <main+0x3a>
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
jmp    117c <main+0x6c>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    116a <main+0x5a>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    %eax,-0x10(%rbp)
jmp    1179 <main+0x69>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"A>B\00"
@.str.1 = [5 x i8] c"A==B\00"
@.str.2 = [4 x i8] c"A<B\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 6, i32* %2
store i32 5, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* %3
%6 = icmp sgt i32 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %19
9: ; preds = %0
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %17
15: ; preds = %9
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %15, %13
%18 = phi i32 [ %14, %13 ], [ %16, %15 ]
br label %19
19: ; preds = %17, %7
%20 = phi i32 [ %8, %7 ], [ %18, %17 ]
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"A>B\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ get_string(char *);
char *getenv(int /*<<< orphan*/);
int /*<<< orphan*/ s_let(char *, char *);
char *macgetenv(char *arg) {
  char *tmp = getenv(get_string(arg));
  if (tmp == NULL)
    *arg = 0;
  else
    s_let(tmp, arg);
  return (arg);
}


x86 assembly (clang, -O0):
<macgetenv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <get_string@plt>
mov    %eax,%edi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1167 <macgetenv+0x37>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
jmp    1174 <macgetenv+0x44>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <s_let@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<macgetenv>:
push   %rbx
mov    %rdi,%rbx
call   1050 <get_string@plt>
mov    %eax,%edi
call   1030 <getenv@plt>
test   %rax,%rax
je     1152 <macgetenv+0x22>
mov    %rax,%rdi
mov    %rbx,%rsi
call   1040 <s_let@plt>
jmp    1155 <macgetenv+0x25>
movb   $0x0,(%rbx)
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @macgetenv(i8* returned %0) {
%2 = tail call i32 @get_string(i8* %0)
%3 = tail call i8* @getenv(i32 %2)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %6
5: ; preds = %1
store i8 0, i8* %0
br label %8
6: ; preds = %1
%7 = tail call i32 @s_let(i8* %3, i8* %0)
br label %8
8: ; preds = %6, %5
ret i8* %0
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char const *);
char *my_strdup(const char *s) {
  int len = strlen(s);
  char *ret = (char *)malloc(len + 1);
  strcpy(ret, s);
  return ret;
}


x86 assembly (clang, -O0):
<my_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @my_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 1
%9 = call i64 @malloc(i32 %8)
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %4
%11 = load i8*, i8** %4
%12 = load i8*, i8** %2
%13 = call i32 @strcpy(i8* %11, i8* %12)
%14 = load i8*, i8** %4
ret i8* %14
}

LLVM IR (-O2):
define i8* @my_strdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @strcpy(i8* %5, i8* %0)
ret i8* %5
}
char *AddHex(char *S, unsigned Val) {
  static const char HexTab[16] = {'0', '1', '2', '3', '4', '5', '6', '7',
                                  '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
  *S++ = HexTab[(Val >> 4) & 0x0F];
  *S++ = HexTab[Val & 0x0F];
  return S;
}


x86 assembly (clang, -O0):
<AddHex>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x4,%eax
and    $0xf,%eax
mov    %eax,%eax
mov    %eax,%ecx
lea    0xee1(%rip),%rax
mov    (%rax,%rcx,1),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
and    $0xf,%eax
mov    %eax,%eax
mov    %eax,%ecx
lea    0xebc(%rip),%rax
mov    (%rax,%rcx,1),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<AddHex>:
mov    %esi,%eax
shr    $0x4,%eax
and    $0xf,%eax
lea    0xef1(%rip),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,(%rdi)
and    $0xf,%esi
mov    (%rsi,%rcx,1),%al
mov    %al,0x1(%rdi)
lea    0x2(%rdi),%rax
ret

LLVM IR (-O0):
@AddHex.HexTab = internal constant [16 x i8] c"0123456789ABCDEF"
define i8* @AddHex(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = lshr i32 %5, 4
%7 = and i32 %6, 15
%8 = zext i32 %7 to i64
%9 = getelementptr inbounds [16 x i8], [16 x i8]* @AddHex.HexTab, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %3
store i8 %10, i8* %11
%13 = load i32, i32* %4
%14 = and i32 %13, 15
%15 = zext i32 %14 to i64
%16 = getelementptr inbounds [16 x i8], [16 x i8]* @AddHex.HexTab, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %3
store i8 %17, i8* %18
%20 = load i8*, i8** %3
ret i8* %20
}

LLVM IR (-O2):
@AddHex.HexTab = internal unnamed_addr constant [16 x i8] c"0123456789ABCDEF"
define i8* @AddHex(i8* writeonly %0, i32 %1) {
%3 = lshr i32 %1, 4
%4 = and i32 %3, 15
%5 = zext i32 %4 to i64
%6 = getelementptr inbounds [16 x i8], [16 x i8]* @AddHex.HexTab, i64 0, i64 %5
%7 = load i8, i8* %6
%8 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %7, i8* %0
%9 = and i32 %1, 15
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds [16 x i8], [16 x i8]* @AddHex.HexTab, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %12, i8* %8
ret i8* %13
}
/* Type definitions */
typedef int mode_t;

/* Variables and functions */
int S_IROTH;
int is_others_read(mode_t mode) { return mode & S_IROTH; }


x86 assembly (clang, -O0):
<is_others_read>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ecf(%rip),%rcx
and    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_others_read>:
mov    %edi,%eax
mov    0x2ed7(%rip),%rcx
and    (%rcx),%eax
ret

LLVM IR (-O0):
@S_IROTH = global i32 0
define i32 @is_others_read(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @S_IROTH
%5 = and i32 %3, %4
ret i32 %5
}

LLVM IR (-O2):
@S_IROTH = global i32 0
define i32 @is_others_read(i32 %0) {
%2 = load i32, i32* @S_IROTH
%3 = and i32 %2, %0
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ buffer;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int main() {
  FILE *pFile;
  char buffer[] = {'x', 'y', 'z'};
  pFile = fopen("ssh3", "rb+");
  fwrite(buffer, sizeof(char), sizeof(buffer), pFile);
  rewind(pFile);
  fclose(pFile);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%ax
mov    %ax,-0x13(%rbp)
mov    0xea2(%rip),%al
mov    %al,-0x11(%rbp)
lea    0xe99(%rip),%rdi
lea    0xe97(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    -0x13(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
mov    $0x3,%edx
call   1060 <fwrite@plt>
mov    -0x10(%rbp),%rdi
call   1040 <rewind@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movb   $0x7a,0xe(%rsp)
movw   $0x7978,0xc(%rsp)
lea    0xeab(%rip),%rdi
lea    0xea9(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
lea    0xc(%rsp),%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    %rax,%rcx
call   1060 <fwrite@plt>
mov    %rbx,%rdi
call   1040 <rewind@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.buffer = [3 x i8] c"xyz"
@.str = [5 x i8] c"ssh3\00"
@.str.1 = [4 x i8] c"rb+\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [3 x i8]
store i32 0, i32* %1
%4 = bitcast [3 x i8]* %3 to i8*
%5 = call i32* @fopen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32* %5, i32** %2
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%7 = load i32*, i32** %2
%8 = call i32 @fwrite(i8* %6, i32 1, i32 3, i32* %7)
%9 = load i32*, i32** %2
%10 = call i32 @rewind(i32* %9)
%11 = load i32*, i32** %2
%12 = call i32 @fclose(i32* %11)
ret i32 0
}

LLVM IR (-O2):
@__const.main.buffer = [3 x i8] c"xyz"
@.str = [5 x i8] c"ssh3\00"
@.str.1 = [4 x i8] c"rb+\00"
define i32 @main() {
%1 = alloca [3 x i8]
%2 = getelementptr inbounds [3 x i8], [3 x i8]* %1, i64 0, i64 0
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @fwrite(i8* %2, i32 1, i32 3, i32* %3)
%5 = tail call i32 @rewind(i32* %3)
%6 = tail call i32 @fclose(i32* %3)
ret i32 0
}
/* Type definitions */
struct Service {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ destroyService(struct Service *);
int /*<<< orphan*/ free(struct Service *);
void deleteService(struct Service *service) {
  destroyService(service);
  free(service);
}


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

x86 assembly (clang, -O2):
<deleteService>:
push   %rbx
mov    %rdi,%rbx
call   1040 <destroyService@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.Service = type { i32 }
define void @deleteService(%struct.Service* %0) {
%2 = alloca %struct.Service*
store %struct.Service* %0, %struct.Service** %2
%3 = load %struct.Service*, %struct.Service** %2
%4 = call i32 @destroyService(%struct.Service* %3)
%5 = load %struct.Service*, %struct.Service** %2
%6 = call i32 @free(%struct.Service* %5)
ret void
}

LLVM IR (-O2):
%struct.Service = type { i32 }
define void @deleteService(%struct.Service* %0) {
%2 = tail call i32 @destroyService(%struct.Service* %0)
%3 = tail call i32 @free(%struct.Service* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
void wakeup(short arg) {
  printf("wakeup begin...\n");
  sleep(3);
  printf("wakeup end...\n");
}


x86 assembly (clang, -O0):
<wakeup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    $0x3,%edi
call   1040 <sleep@plt>
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wakeup>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x3,%edi
call   1040 <sleep@plt>
lea    0xed2(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"wakeup begin...\0A\00"
@.str.1 = [15 x i8] c"wakeup end...\0A\00"
define void @wakeup(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @sleep(i32 3)
%5 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [16 x i8] c"wakeup begin...\00"
@str.2 = [14 x i8] c"wakeup end...\00"
define void @wakeup(i16 signext %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @sleep(i32 3)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.2, i64 0, i64 0))
ret void
}
void d2i_ASN1_T61STRING(void) {}


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

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

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

LLVM IR (-O2):
define void @d2i_ASN1_T61STRING() {
ret void
}
int IsRegConst(int reg) {
  if (reg >= 128)
    return 0;
  if (reg >= 32)
    return 1;
  if (reg == 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<IsRegConst>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x80,-0x8(%rbp)
jl     1120 <IsRegConst+0x20>
movl   $0x0,-0x4(%rbp)
jmp    1153 <IsRegConst+0x53>
cmpl   $0x20,-0x8(%rbp)
jl     1136 <IsRegConst+0x36>
movl   $0x1,-0x4(%rbp)
jmp    1153 <IsRegConst+0x53>
cmpl   $0x0,-0x8(%rbp)
jne    114c <IsRegConst+0x4c>
movl   $0x1,-0x4(%rbp)
jmp    1153 <IsRegConst+0x53>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsRegConst>:
xor    %eax,%eax
cmp    $0x7f,%edi
jg     1118 <IsRegConst+0x18>
mov    $0x1,%eax
cmp    $0x1f,%edi
jg     1118 <IsRegConst+0x18>
xor    %eax,%eax
test   %edi,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @IsRegConst(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 128
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %16
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp sge i32 %8, 32
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 1, i32* %2
br label %16
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 1, i32* %2
br label %16
15: ; preds = %11
store i32 0, i32* %2
br label %16
16: ; preds = %15, %14, %10, %6
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
define i32 @IsRegConst(i32 %0) {
%2 = icmp sgt i32 %0, 127
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = icmp sgt i32 %0, 31
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = icmp eq i32 %0, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %5, %3, %1
%9 = phi i32 [ 0, %1 ], [ 1, %3 ], [ %7, %5 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ nop();
void condition_always_false_bad() {
  if (0) {
    nop();
  }
}


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

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

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

LLVM IR (-O2):
define void @condition_always_false_bad() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int test() {
  printf("hello world\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [12 x i8] c"hello world\00"
define i32 @test() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ OsSchedUnlock();
void CoSchedUnlock(void) { OsSchedUnlock(); }


x86 assembly (clang, -O0):
<CoSchedUnlock>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <OsSchedUnlock@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @CoSchedUnlock() {
%1 = call i32 (...) @OsSchedUnlock()
ret void
}

LLVM IR (-O2):
define void @CoSchedUnlock() {
%1 = tail call i32 (...) @OsSchedUnlock()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint;

/* Variables and functions */
int /*<<< orphan*/ srandom(int /*<<< orphan*/);
void srandom32(uint seed) { srandom(seed); }


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

x86 assembly (clang, -O2):
<srandom32>:
jmp    1030 <srandom@plt>

LLVM IR (-O0):
define void @srandom32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @srandom(i32 %3)
ret void
}

LLVM IR (-O2):
define void @srandom32(i32 %0) {
%2 = tail call i32 @srandom(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(long double *);
void C_Utils_free_longdouble_ptr(long double *item) { free(item); }


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

x86 assembly (clang, -O2):
<C_Utils_free_longdouble_ptr>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @C_Utils_free_longdouble_ptr(x86_fp80* %0) {
%2 = alloca x86_fp80*
store x86_fp80* %0, x86_fp80** %2
%3 = load x86_fp80*, x86_fp80** %2
%4 = call i32 @free(x86_fp80* %3)
ret void
}

LLVM IR (-O2):
define void @C_Utils_free_longdouble_ptr(x86_fp80* nocapture %0) {
%2 = tail call i32 @free(x86_fp80* %0)
ret void
}
int clearSelection_BaseScreen(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @clearSelection_BaseScreen() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *);
void promptValue(int *addr) { scanf("%d", addr); }


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

x86 assembly (clang, -O2):
<promptValue>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <scanf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @promptValue(i32* %0) {
%2 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %0)
ret void
}
void not() { push(!pop()); }


x86 assembly (clang, -O0):
<not>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <pop@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1040 <push@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<not>:
push   %rax
xor    %eax,%eax
call   1030 <pop@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
xor    %eax,%eax
pop    %rcx
jmp    1040 <push@plt>

LLVM IR (-O0):
define void @not() {
%1 = call i32 (...) @pop()
%2 = icmp ne i32 %1, 0
%3 = xor i1 %2, true
%4 = zext i1 %3 to i32
%5 = call i32 (i32, ...) bitcast (i32 (...)* @push to i32 (i32, ...)*)(i32 %4)
ret void
}

LLVM IR (-O2):
define void @not() {
%1 = tail call i32 (...) @pop()
%2 = icmp eq i32 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @push to i32 (i32, ...)*)(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ trimHelp(char *);
void trim(char **a) {
  int i = 0;
  for (i; a[i] != NULL; i++) {
    trimHelp(a[i]);
  }
}


x86 assembly (clang, -O0):
<trim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1155 <trim+0x45>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <trimHelp@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <trim+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trim>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1131 <trim+0x21>
add    $0x8,%rbx
call   1030 <trimHelp@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1120 <trim+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @trim(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
store i8** %0, i8*** %2
store i32 0, i32* %3
%4 = load i32, i32* %3
br label %5
5: ; preds = %19, %1
%6 = load i8**, i8*** %2
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8*, i8** %6, i64 %8
%10 = load i8*, i8** %9
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %22
12: ; preds = %5
%13 = load i8**, i8*** %2
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %13, i64 %15
%17 = load i8*, i8** %16
%18 = call i32 @trimHelp(i8* %17)
br label %19
19: ; preds = %12
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %5
22: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @trim(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %10, %4 ], [ %2, %1 ]
%7 = tail call i32 @trimHelp(i8* %6)
%8 = add nuw i64 %5, 1
%9 = getelementptr inbounds i8*, i8** %0, i64 %8
%10 = load i8*, i8** %9
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_case_begin(char *);
void testFileManagement() {
  test_case_begin("File management test case");
  int error = 0;
}


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

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

LLVM IR (-O0):
@.str = [26 x i8] c"File management test case\00"
define void @testFileManagement() {
%1 = alloca i32
%2 = call i32 @test_case_begin(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"File management test case\00"
define void @testFileManagement() {
%1 = tail call i32 @test_case_begin(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ gzFile;

/* Variables and functions */
int /*<<< orphan*/ ConvertToDouble(unsigned char *, double *);
int gzread(int /*<<< orphan*/, unsigned char *, int);
int ConvertReadDoubleZ(gzFile file, double *val) {
  unsigned char tmp[8];
  if (gzread(file, tmp, 8) != 8)
    return -1;
  ConvertToDouble(tmp, val);
  return 0;
}


x86 assembly (clang, -O0):
<ConvertReadDoubleZ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    $0x8,%edx
call   1040 <gzread@plt>
cmp    $0x8,%eax
je     1155 <ConvertReadDoubleZ+0x35>
movl   $0xffffffff,-0x4(%rbp)
jmp    1169 <ConvertReadDoubleZ+0x49>
lea    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <ConvertToDouble@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConvertReadDoubleZ>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0x8(%rsp),%rsi
mov    $0x8,%edx
call   1040 <gzread@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    $0x8,%ecx
jne    1152 <ConvertReadDoubleZ+0x32>
lea    0x8(%rsp),%rdi
mov    %rbx,%rsi
call   1030 <ConvertToDouble@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ConvertReadDoubleZ(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca double*
%6 = alloca [8 x i8]
store i32 %0, i32* %4
store double* %1, double** %5
%7 = load i32, i32* %4
%8 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%9 = call i32 @gzread(i32 %7, i8* %8, i32 8)
%10 = icmp ne i32 %9, 8
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 -1, i32* %3
br label %16
12: ; preds = %2
%13 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%14 = load double*, double** %5
%15 = call i32 @ConvertToDouble(i8* %13, double* %14)
store i32 0, i32* %3
br label %16
16: ; preds = %12, %11
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @ConvertReadDoubleZ(i32 %0, double* %1) {
%3 = alloca [8 x i8]
%4 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%5 = call i32 @gzread(i32 %0, i8* %4, i32 8)
%6 = icmp eq i32 %5, 8
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = call i32 @ConvertToDouble(i8* %4, double* %1)
br label %9
9: ; preds = %2, %7
%10 = phi i32 [ 0, %7 ], [ -1, %2 ]
ret i32 %10
}
void exchange(int A[], int q, int p) {
  int temp = A[q];
  A[q] = A[p];
  A[p] = temp;
}


x86 assembly (clang, -O0):
<exchange>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<exchange>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%ecx
movslq %edx,%rdx
mov    (%rdi,%rdx,4),%esi
mov    %esi,(%rdi,%rax,4)
mov    %ecx,(%rdi,%rdx,4)
ret

LLVM IR (-O0):
define void @exchange(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 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = load i32, i32* %11
store i32 %12, i32* %7
%13 = load i32*, i32** %4
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = load i32*, i32** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
store i32 %17, i32* %21
%22 = load i32, i32* %7
%23 = load i32*, i32** %4
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
store i32 %22, i32* %26
ret void
}

LLVM IR (-O2):
define void @exchange(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %5
store i32 %6, i32* %8
ret void
}
int Media_DVD_Cell(int size, char *data) { return 0; }


x86 assembly (clang, -O0):
<Media_DVD_Cell>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @Media_DVD_Cell(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
ret i32 0
}

LLVM IR (-O2):
define i32 @Media_DVD_Cell(i32 %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ pause();
int /*<<< orphan*/ write(int, char *, int);
int thread1(void *unused) {
  write(1, "1", 1);
  for (;;)
    pause();
  return 0;
}


x86 assembly (clang, -O0):
<thread1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%edx
lea    0xec8(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
mov    $0x0,%al
call   1040 <pause@plt>
jmp    113f <thread1+0x1f>

x86 assembly (clang, -O2):
<thread1>:
push   %rax
lea    0xed8(%rip),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
call   1030 <write@plt>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <pause@plt>
jmp    1140 <thread1+0x20>

LLVM IR (-O0):
@.str = [2 x i8] c"1\00"
define i32 @thread1(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
br label %4
4: ; preds = %4, %1
%5 = call i32 (...) @pause()
br label %4
}

LLVM IR (-O2):
@.str = [2 x i8] c"1\00"
define i32 @thread1(i8* nocapture readnone %0) {
%2 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
br label %3
3: ; preds = %3, %1
%4 = tail call i32 (...) @pause()
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ free(void **);
void free_matrix(void **m) {
  free(m[0]);
  free(m);
}


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

x86 assembly (clang, -O2):
<free_matrix>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_matrix(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = getelementptr inbounds i8*, i8** %3, i64 0
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i8**
%7 = call i32 @free(i8** %6)
%8 = load i8**, i8*** %2
%9 = call i32 @free(i8** %8)
ret void
}

LLVM IR (-O2):
define void @free_matrix(i8** nocapture %0) {
%2 = bitcast i8** %0 to i8***
%3 = load i8**, i8*** %2
%4 = tail call i32 @free(i8** %3)
%5 = tail call i32 @free(i8** %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _qspalint(long *, long, long, long *);
void qsortlint(long int *a, long int b, long int e) {
  long int p;
  if (b < e) {
    _qspalint(a, b, e, &p);
    qsortlint(a, b, p - 1);
    qsortlint(a, p + 1, e);
  }
}


x86 assembly (clang, -O0):
<qsortlint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    1181 <qsortlint+0x61>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1040 <_qspalint@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
sub    $0x1,%rdx
call   1030 <qsortlint@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
add    $0x1,%rsi
mov    -0x18(%rbp),%rdx
call   1030 <qsortlint@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qsortlint>:
cmp    %rdx,%rsi
jge    1172 <qsortlint+0x52>
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0x8(%rsp),%rcx
call   1040 <_qspalint@plt>
mov    0x8(%rsp),%rdx
add    $0xffffffffffffffff,%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <qsortlint@plt>
mov    0x8(%rsp),%rsi
add    $0x1,%rsi
mov    %r14,%rdi
mov    %r15,%rdx
call   1030 <qsortlint@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @qsortlint(i64* %0, i64 %1, i64 %2) {
%4 = alloca i64*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i64* %0, i64** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%8 = load i64, i64* %5
%9 = load i64, i64* %6
%10 = icmp slt i64 %8, %9
br i1 %10, label %11, label %24
11: ; preds = %3
%12 = load i64*, i64** %4
%13 = load i64, i64* %5
%14 = load i64, i64* %6
%15 = call i32 @_qspalint(i64* %12, i64 %13, i64 %14, i64* %7)
%16 = load i64*, i64** %4
%17 = load i64, i64* %5
%18 = load i64, i64* %7
%19 = sub nsw i64 %18, 1
%20 = load i64*, i64** %4
%21 = load i64, i64* %7
%22 = add nsw i64 %21, 1
%23 = load i64, i64* %6
br label %24
24: ; preds = %11, %3
ret void
}

LLVM IR (-O2):
define void @qsortlint(i64* %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = bitcast i64* %4 to i8*
%6 = icmp slt i64 %1, %2
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = call i32 @_qspalint(i64* %0, i64 %1, i64 %2, i64* %4)
%9 = load i64, i64* %4
%10 = add nsw i64 %9, -1
%11 = load i64, i64* %4
%12 = add nsw i64 %11, 1
br label %13
13: ; preds = %7, %3
ret void
}
/* Variables and functions */
int deterministic_bytes(unsigned char *, int);
int deterministic_pseudorand(unsigned char *buf, int num) {
  return deterministic_bytes(buf, num);
}


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

x86 assembly (clang, -O2):
<deterministic_pseudorand>:
jmp    1030 <deterministic_bytes@plt>

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

LLVM IR (-O2):
define i32 @deterministic_pseudorand(i8* %0, i32 %1) {
%3 = tail call i32 @deterministic_bytes(i8* %0, i32 %1)
ret i32 %3
}
void rop3_243_0_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = ~S;
  stk1 = T | stk2;
  *D = (stk1 & S) | (stk1 & (~T)) | (T & (~S) & *D);
}


x86 assembly (clang, -O0):
<rop3_243_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0x9(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xc(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xc(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
movzbl -0xb(%rbp),%ecx
movzbl -0xa(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
movzbl -0xa(%rbp),%ecx
movzbl -0x9(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
mov    -0x8(%rbp),%rdx
movzbl (%rdx),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_243_0_1>:
mov    %edx,%eax
not    %eax
or     %esi,%eax
not    %esi
mov    %esi,%ecx
or     %edx,%ecx
and    %ecx,%eax
and    %edx,%esi
movzbl (%rdi),%ecx
and    %esi,%ecx
or     %eax,%ecx
mov    %cl,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_243_0_1(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8, i8* %5
%10 = zext i8 %9 to i32
%11 = xor i32 %10, -1
%12 = trunc i32 %11 to i8
store i8 %12, i8* %8
%13 = load i8, i8* %6
%14 = zext i8 %13 to i32
%15 = load i8, i8* %8
%16 = zext i8 %15 to i32
%17 = or i32 %14, %16
%18 = trunc i32 %17 to i8
store i8 %18, i8* %7
%19 = load i8, i8* %7
%20 = zext i8 %19 to i32
%21 = load i8, i8* %5
%22 = zext i8 %21 to i32
%23 = and i32 %20, %22
%24 = load i8, i8* %7
%25 = zext i8 %24 to i32
%26 = load i8, i8* %6
%27 = zext i8 %26 to i32
%28 = xor i32 %27, -1
%29 = and i32 %25, %28
%30 = or i32 %23, %29
%31 = load i8, i8* %6
%32 = zext i8 %31 to i32
%33 = load i8, i8* %5
%34 = zext i8 %33 to i32
%35 = xor i32 %34, -1
%36 = and i32 %32, %35
%37 = load i8*, i8** %4
%38 = load i8, i8* %37
%39 = zext i8 %38 to i32
%40 = and i32 %36, %39
%41 = or i32 %30, %40
%42 = trunc i32 %41 to i8
%43 = load i8*, i8** %4
store i8 %42, i8* %43
ret void
}

LLVM IR (-O2):
define void @rop3_243_0_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = zext i8 %1 to i32
%5 = xor i32 %4, -1
%6 = zext i8 %2 to i32
%7 = trunc i32 %5 to i8
%8 = or i8 %7, %2
%9 = zext i8 %8 to i32
%10 = and i8 %8, %1
%11 = zext i8 %10 to i32
%12 = xor i32 %6, -1
%13 = and i32 %9, %12
%14 = or i32 %13, %11
%15 = and i32 %6, %5
%16 = load i8, i8* %0
%17 = zext i8 %16 to i32
%18 = and i32 %15, %17
%19 = or i32 %14, %18
%20 = trunc i32 %19 to i8
store i8 %20, i8* %0
ret void
}