xunge/DecIR huggingface dataset:
unsigned int node_stack_at(unsigned int index, unsigned int *stack,
                           unsigned int stack_size) {
  if (!stack_size || ((stack_size - index) <= 0)) {
    return 0xFFFFFFFF;
  }
  return stack[stack_size - index - 1];
}


x86 assembly (clang, -O0):
<node_stack_at>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1127 <node_stack_at+0x27>
mov    -0x14(%rbp),%eax
sub    -0x8(%rbp),%eax
cmp    $0x0,%eax
ja     1133 <node_stack_at+0x33>
movl   $0xffffffff,-0x4(%rbp)
jmp    1148 <node_stack_at+0x48>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    -0x8(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<node_stack_at>:
mov    $0xffffffff,%eax
test   %edx,%edx
je     1113 <node_stack_at+0x13>
sub    %edi,%edx
je     1113 <node_stack_at+0x13>
add    $0xffffffff,%edx
mov    (%rsi,%rdx,4),%eax
ret

LLVM IR (-O0):
define i32 @node_stack_at(i32 %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32 %2, i32* %7
%8 = load i32, i32* %7
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %3
%11 = load i32, i32* %7
%12 = load i32, i32* %5
%13 = sub i32 %11, %12
%14 = icmp ule i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %10, %3
store i32 -1, i32* %4
br label %25
16: ; preds = %10
%17 = load i32*, i32** %6
%18 = load i32, i32* %7
%19 = load i32, i32* %5
%20 = sub i32 %18, %19
%21 = sub i32 %20, 1
%22 = zext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %17, i64 %22
%24 = load i32, i32* %23
store i32 %24, i32* %4
br label %25
25: ; preds = %16, %15
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
define i32 @node_stack_at(i32 %0, i32* nocapture %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %13, label %5
5: ; preds = %3
%6 = sub i32 %2, %0
%7 = icmp eq i32 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %5
%9 = add i32 %6, -1
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %1, i64 %10
%12 = load i32, i32* %11
br label %13
13: ; preds = %3, %5, %8
%14 = phi i32 [ %12, %8 ], [ -1, %5 ], [ -1, %3 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ ttflush();
int /*<<< orphan*/ ttputc(int);
int ansibeep() {
  ttputc(0x07);
  ttflush();
  return 0;
}


x86 assembly (clang, -O0):
<ansibeep>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7,%edi
call   1040 <ttputc@plt>
mov    $0x0,%al
call   1030 <ttflush@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ansibeep>:
push   %rax
mov    $0x7,%edi
call   1040 <ttputc@plt>
xor    %eax,%eax
call   1030 <ttflush@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @ansibeep() {
%1 = call i32 @ttputc(i32 7)
%2 = call i32 (...) @ttflush()
ret i32 0
}

LLVM IR (-O2):
define i32 @ansibeep() {
%1 = tail call i32 @ttputc(i32 7)
%2 = tail call i32 (...) @ttflush()
ret i32 0
}
/* Variables and functions */
size_t dae_count_string_int32s(char const *);
size_t dae_count_string_int16s(const char *str) {
  return dae_count_string_int32s(str);
}


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

x86 assembly (clang, -O2):
<dae_count_string_int16s>:
jmp    1030 <dae_count_string_int32s@plt>

LLVM IR (-O0):
define i64 @dae_count_string_int16s(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @dae_count_string_int32s(i8* %3)
ret i64 %4
}

LLVM IR (-O2):
define i64 @dae_count_string_int16s(i8* %0) {
%2 = tail call i64 @dae_count_string_int32s(i8* %0)
ret i64 %2
}
/* Variables and functions */
int do_auth();
int /*<<< orphan*/ log_error(int, char *);
int main(void) {
  switch (do_auth()) {
  case -1:
    log_error(0x01 | 0x02, "Unable to login");
    break;
  default:
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
call   1040 <do_auth@plt>
sub    $0xffffffff,%eax
jne    115a <main+0x3a>
jmp    1144 <main+0x24>
mov    $0x3,%edi
lea    0xeb0(%rip),%rsi
call   1030 <log_error@plt>
jmp    115f <main+0x3f>
jmp    115f <main+0x3f>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <do_auth@plt>
cmp    $0xffffffff,%eax
jne    113e <main+0x1e>
lea    0xecc(%rip),%rsi
mov    $0x3,%edi
call   1030 <log_error@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Unable to login\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @do_auth()
switch i32 %2, label %5 [
i32 -1, label %3
]
3: ; preds = %0
%4 = call i32 @log_error(i32 3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %6
5: ; preds = %0
br label %6
6: ; preds = %5, %3
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"Unable to login\00"
define i32 @main() {
%1 = tail call i32 (...) @do_auth()
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @log_error(i32 3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %0, %3
ret i32 0
}
int test_imm_68int8_reg(signed char val) {
  return ((val) & (0x68 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_68int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0x68,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_68int8_reg>:
test   $0x68,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_68int8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, 104
%6 = icmp ne i32 %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_68int8_reg(i8 signext %0) {
%2 = and i8 %0, 104
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int cmp(const void *key, const void *member) {
  return *(int *)key - *(int *)member;
}


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

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

LLVM IR (-O0):
define i32 @cmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%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 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
uint64_t OptickAPI_PushEvent(uint64_t inEventDescription) {}


x86 assembly (clang, -O0):
<OptickAPI_PushEvent>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @OptickAPI_PushEvent(i32 %0) {
ret i32 undef
}
main() {
  int yyparse();
  return (yyparse());
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @yyparse()
ret i32 %2
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @yyparse()
ret i32 %1
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int dep = 0;
#pragma omp target device(0) nowait map(tofrom : dep) depend(out : dep)
  { dep++; }
#pragma omp target device(1) nowait map(tofrom : dep) depend(in : dep)
  { dep++; }
#pragma omp taskwait
  if (dep == 2) {
    printf("completed with 0 errors\n");
  } else {
    printf("completed with a error:\n");
    printf("dep should be 2, but is %d\n", dep);
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jne    115c <main+0x4c>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    117b <main+0x6b>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e5e(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [25 x i8] c"completed with 0 errors\0A\00"
@.str.1 = [25 x i8] c"completed with a error:\0A\00"
@.str.2 = [28 x i8] c"dep should be 2, but is %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = load i32, i32* %6
%8 = add nsw i32 %7, 1
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = add nsw i32 %9, 1
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp eq i32 %11, 2
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %19
15: ; preds = %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%17 = load i32, i32* %6
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %15, %13
%20 = load i32, i32* @EXIT_SUCCESS
ret i32 %20
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [24 x i8] c"completed with 0 errors\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}
unsigned char APPL_StartInputHandler(void) { return 0; }


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

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

LLVM IR (-O0):
define zeroext i8 @APPL_StartInputHandler() {
ret i8 0
}

LLVM IR (-O2):
define zeroext i8 @APPL_StartInputHandler() {
ret i8 0
}
/* Variables and functions */
unsigned char tolower(unsigned char c) {
  if (c <= 'Z' && c >= 'A')
    return (c + 32);
  return (c);
}


x86 assembly (clang, -O0):
<tolower>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
cmp    $0x5a,%eax
jg     1133 <tolower+0x33>
movzbl -0x2(%rbp),%eax
cmp    $0x41,%eax
jl     1133 <tolower+0x33>
movzbl -0x2(%rbp),%eax
add    $0x20,%eax
mov    %al,-0x1(%rbp)
jmp    1139 <tolower+0x39>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tolower>:
lea    -0x41(%rdi),%eax
lea    0x20(%rdi),%ecx
cmp    $0x1a,%al
movzbl %cl,%eax
cmovae %edi,%eax
ret

LLVM IR (-O0):
define zeroext i8 @tolower(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = icmp sle i32 %5, 90
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = load i8, i8* %3
%9 = zext i8 %8 to i32
%10 = icmp sge i32 %9, 65
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = add nsw i32 %13, 32
%15 = trunc i32 %14 to i8
store i8 %15, i8* %2
br label %18
16: ; preds = %7, %1
%17 = load i8, i8* %3
store i8 %17, i8* %2
br label %18
18: ; preds = %16, %11
%19 = load i8, i8* %2
ret i8 %19
}

LLVM IR (-O2):
define zeroext i8 @tolower(i8 zeroext %0) {
%2 = add i8 %0, -65
%3 = icmp ult i8 %2, 26
%4 = add i8 %0, 32
%5 = select i1 %3, i8 %4, i8 %0
ret i8 %5
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ foo(int *);
int /*<<< orphan*/ printf(char *, void *, int);
int main(void) {
  int num = 20;
  int *p = &num;
  printf("Address before foo() function: %p: %d\n", (void *)p, *p);
  foo(p);
  printf(" Address after foo() function: %p: %d\n", (void *)p, *p);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x14,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <foo@plt>
mov    -0x10(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e66(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x14,0xc(%rsp)
lea    0xecc(%rip),%rdi
lea    0xc(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x14,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <foo@plt>
mov    0xc(%rsp),%edx
lea    0xece(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [39 x i8] c"Address before foo() function: %p: %d\0A\00"
@.str.1 = [39 x i8] c" Address after foo() function: %p: %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 0, i32* %1
store i32 20, i32* %2
store i32* %2, i32** %3
%4 = load i32*, i32** %3
%5 = bitcast i32* %4 to i8*
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
%8 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %7)
%9 = load i32*, i32** %3
%10 = call i32 @foo(i32* %9)
%11 = load i32*, i32** %3
%12 = bitcast i32* %11 to i8*
%13 = load i32*, i32** %3
%14 = load i32, i32* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %12, i32 %14)
%16 = load i32, i32* @EXIT_SUCCESS
ret i32 %16
}

LLVM IR (-O2):
@.str = [39 x i8] c"Address before foo() function: %p: %d\0A\00"
@.str.1 = [39 x i8] c" Address after foo() function: %p: %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 20, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %2, i32 20)
%4 = call i32 @foo(i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %2, i32 %5)
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ addbyte(int);
void MMX_OR(int dst_reg, int src_reg) {
  addbyte(0x66);
  addbyte(0x0f);
  addbyte(0xeb);
  addbyte(0xc0 | (dst_reg << 3) | src_reg);
}


x86 assembly (clang, -O0):
<MMX_OR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x66,%edi
call   1030 <addbyte@plt>
mov    $0xf,%edi
call   1030 <addbyte@plt>
mov    $0xeb,%edi
call   1030 <addbyte@plt>
mov    -0x4(%rbp),%edi
shl    $0x3,%edi
or     $0xc0,%edi
or     -0x8(%rbp),%edi
call   1030 <addbyte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MMX_OR>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x66,%edi
call   1030 <addbyte@plt>
mov    $0xf,%edi
call   1030 <addbyte@plt>
mov    $0xeb,%edi
call   1030 <addbyte@plt>
shl    $0x3,%ebp
or     %ebx,%ebp
or     $0xc0,%ebp
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <addbyte@plt>

LLVM IR (-O0):
define void @MMX_OR(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @addbyte(i32 102)
%6 = call i32 @addbyte(i32 15)
%7 = call i32 @addbyte(i32 235)
%8 = load i32, i32* %3
%9 = shl i32 %8, 3
%10 = or i32 192, %9
%11 = load i32, i32* %4
%12 = or i32 %10, %11
%13 = call i32 @addbyte(i32 %12)
ret void
}

LLVM IR (-O2):
define void @MMX_OR(i32 %0, i32 %1) {
%3 = tail call i32 @addbyte(i32 102)
%4 = tail call i32 @addbyte(i32 15)
%5 = tail call i32 @addbyte(i32 235)
%6 = shl i32 %0, 3
%7 = or i32 %6, %1
%8 = or i32 %7, 192
%9 = tail call i32 @addbyte(i32 %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void sys_sleep(int msec) { usleep(msec * 1000); }


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

x86 assembly (clang, -O2):
<sys_sleep>:
imul   $0x3e8,%edi,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @sys_sleep(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 1000
%5 = call i32 @usleep(i32 %4)
ret void
}

LLVM IR (-O2):
define void @sys_sleep(i32 %0) {
%2 = mul nsw i32 %0, 1000
%3 = tail call i32 @usleep(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ showInput(char *);
int main(int argc, char *argv[]) {
  if (argc != 2)
    printf("EXPLOIT THE ARGUMENT!\n");
  else
    showInput(argv[1]);
  return 1;
}


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)
cmpl   $0x2,-0x8(%rbp)
je     1151 <main+0x31>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
jmp    115e <main+0x3e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <showInput@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1131 <main+0x11>
mov    0x8(%rsi),%rdi
call   1040 <showInput@plt>
jmp    113d <main+0x1d>
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"EXPLOIT THE ARGUMENT!\0A\00"
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 = load i32, i32* %4
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @showInput(i8* %13)
br label %15
15: ; preds = %10, %8
ret i32 1
}

LLVM IR (-O2):
@str = [22 x i8] c"EXPLOIT THE ARGUMENT!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br label %10
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @showInput(i8* %8)
br label %10
10: ; preds = %6, %4
ret i32 1
}
void main() {
  int x = 0;
  while (x < 100) {
    x = x + 1;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jge    1123 <main+0x23>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <main+0xb>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %5, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 100
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* %1
%7 = add nsw i32 %6, 1
store i32 %7, i32* %1
br label %2
8: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @main() {
ret void
}
/* Type definitions */
struct drm_device {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ DRM_ERROR(char *, int);
void mach64_disable_vblank(struct drm_device *dev, int crtc) {
  if (crtc != 0) {
    DRM_ERROR("tried to disable vblank on non-existent crtc %d\n", crtc);
    return;
  }
}


x86 assembly (clang, -O0):
<mach64_disable_vblank>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1138 <mach64_disable_vblank+0x28>
mov    -0xc(%rbp),%esi
lea    0xecd(%rip),%rdi
call   1030 <DRM_ERROR@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mach64_disable_vblank>:
test   %esi,%esi
je     1120 <mach64_disable_vblank+0x10>
lea    0xee5(%rip),%rdi
jmp    1030 <DRM_ERROR@plt>
ret

LLVM IR (-O0):
%struct.drm_device = type { i32 }
@.str = [49 x i8] c"tried to disable vblank on non-existent crtc %d\0A\00"
define void @mach64_disable_vblank(%struct.drm_device* %0, i32 %1) {
%3 = alloca %struct.drm_device*
%4 = alloca i32
store %struct.drm_device* %0, %struct.drm_device** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %4
%9 = call i32 @DRM_ERROR(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %10
10: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
%struct.drm_device = type { i32 }
@.str = [49 x i8] c"tried to disable vblank on non-existent crtc %d\0A\00"
define void @mach64_disable_vblank(%struct.drm_device* nocapture readnone %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @DRM_ERROR(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 %1)
br label %6
6: ; preds = %4, %2
ret void
}
int max(int ans, int sum) { return (ans > sum ? ans : sum); }


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1121 <max+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <max+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
mov    %esi,%eax
cmp    %esi,%edi
cmovg  %edi,%eax
ret

LLVM IR (-O0):
define i32 @max(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 = icmp sgt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @max(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ carrier_send(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strlen(char *);
void send(int id, char *msg) {
  int32_t send = carrier_send("core", msg, strlen(msg));
  fflush(stdout);
}


x86 assembly (clang, -O0):
<send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
lea    0xea3(%rip),%rdi
call   1050 <carrier_send@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send>:
push   %rbx
mov    %rsi,%rbx
mov    %rsi,%rdi
call   1030 <strlen@plt>
lea    0xebd(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1050 <carrier_send@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
pop    %rbx
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"core\00"
@stdout = global i32 0
define void @send(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @carrier_send(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %6, i32 %8)
store i32 %9, i32* %5
%10 = load i32, i32* @stdout
%11 = call i32 @fflush(i32 %10)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"core\00"
@stdout = global i32 0
define void @send(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @carrier_send(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %3)
%5 = load i32, i32* @stdout
%6 = tail call i32 @fflush(i32 %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lt_fatal(char *, int, char *);
scalar_t__ malloc(size_t);
void *xmalloc(size_t num) {
  void *p = (void *)malloc(num);
  if (!p)
    lt_fatal("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/gmadkat/getdns0.3.3win/refs/heads/"
             "master/src/test/.libs/lt-getdns_query.c",
             332, "memory exhausted");
  return p;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115c <xmalloc+0x3c>
lea    0xeb5(%rip),%rdi
mov    $0x14c,%esi
lea    0xf4d(%rip),%rdx
call   1030 <lt_fatal@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rbx
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1146 <xmalloc+0x26>
lea    0xecb(%rip),%rdi
lea    0xf68(%rip),%rdx
mov    $0x14c,%esi
call   1030 <lt_fatal@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [164 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/gmadkat/getdns0.3.3win/refs/heads/master/src/test/.libs/lt-getdns_query.c\00"
@.str.1 = [17 x i8] c"memory exhausted\00"
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i64 @malloc(i64 %4)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %1
%10 = call i32 @lt_fatal(i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str, i64 0, i64 0), i32 332, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@.str = [164 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/gmadkat/getdns0.3.3win/refs/heads/master/src/test/.libs/lt-getdns_query.c\00"
@.str.1 = [17 x i8] c"memory exhausted\00"
define i8* @xmalloc(i64 %0) {
%2 = tail call i64 @malloc(i64 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @lt_fatal(i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str, i64 0, i64 0), i32 332, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = inttoptr i64 %2 to i8*
ret i8* %7
}
char *strcat(char *dest, const char *src) {
  char *ret = dest;
  while (*dest)
    dest++;
  while ((*dest++ = *src++))
    ;
  return ret;
}


x86 assembly (clang, -O0):
<strcat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1132 <strcat+0x32>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1114 <strcat+0x14>
jmp    1137 <strcat+0x37>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     1166 <strcat+0x66>
jmp    1137 <strcat+0x37>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat>:
mov    %rdi,%rax
mov    %rdi,%rcx
cs nopw 0x0(%rax,%rax,1)
cmpb   $0x0,(%rcx)
lea    0x1(%rcx),%rcx
jne    1110 <strcat+0x10>
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
movzbl (%rsi,%rdx,1),%edi
mov    %dil,-0x1(%rcx,%rdx,1)
add    $0x1,%rdx
test   %dil,%dil
jne    1120 <strcat+0x20>
ret

LLVM IR (-O0):
define i8* @strcat(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
store i8* %6, i8** %5
br label %7
7: ; preds = %11, %2
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %3
br label %7
14: ; preds = %7
br label %15
15: ; preds = %22, %14
%16 = load i8*, i8** %4
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %4
%18 = load i8, i8* %16
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %3
store i8 %18, i8* %19
%21 = icmp ne i8 %18, 0
br i1 %21, label %22, label %23
22: ; preds = %15
br label %15
23: ; preds = %15
%24 = load i8*, i8** %5
ret i8* %24
}

LLVM IR (-O2):
define i8* @strcat(i8* returned %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %7, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %6, label %8, label %3
8: ; preds = %3, %8
%9 = phi i8* [ %11, %8 ], [ %1, %3 ]
%10 = phi i8* [ %13, %8 ], [ %4, %3 ]
%11 = getelementptr inbounds i8, i8* %9, i64 1
%12 = load i8, i8* %9
%13 = getelementptr inbounds i8, i8* %10, i64 1
store i8 %12, i8* %10
%14 = icmp eq i8 %12, 0
br i1 %14, label %15, label %8
15: ; preds = %8
ret i8* %0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int get_wl_physical_medium(void *data) {
  uint8_t *wpm = (uint8_t *)data;
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @get_wl_physical_medium(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %3
ret i32 0
}

LLVM IR (-O2):
define i32 @get_wl_physical_medium(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void copyright(void) {
  fprintf(stderr, "\n Written by: Gerald Tamayo, 2004\n");
}


x86 assembly (clang, -O0):
<copyright>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<copyright>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"\0A Written by: Gerald Tamayo, 2004\0A\00"
define void @copyright() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"\0A Written by: Gerald Tamayo, 2004\0A\00"
define void @copyright() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
ret void
}
int TimeToSendAPRS(long GPS_Seconds, long APRS_Period, long APRS_Offset) {
  return ((GPS_Seconds + APRS_Period - APRS_Offset) % APRS_Period) <= 1;
}


x86 assembly (clang, -O0):
<TimeToSendAPRS>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
sub    -0x18(%rbp),%rax
cqto
idivq  -0x10(%rbp)
cmp    $0x1,%rdx
setle  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimeToSendAPRS>:
mov    %rdi,%rax
add    %rsi,%rax
sub    %rdx,%rax
mov    %rax,%rcx
or     %rsi,%rcx
shr    $0x20,%rcx
je     111c <TimeToSendAPRS+0x1c>
cqto
idiv   %rsi
jmp    1120 <TimeToSendAPRS+0x20>
xor    %edx,%edx
div    %esi
xor    %eax,%eax
cmp    $0x2,%rdx
setl   %al
ret

LLVM IR (-O0):
define i32 @TimeToSendAPRS(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %4
%8 = load i64, i64* %5
%9 = add nsw i64 %7, %8
%10 = load i64, i64* %6
%11 = sub nsw i64 %9, %10
%12 = load i64, i64* %5
%13 = srem i64 %11, %12
%14 = icmp sle i64 %13, 1
%15 = zext i1 %14 to i32
ret i32 %15
}

LLVM IR (-O2):
define i32 @TimeToSendAPRS(i64 %0, i64 %1, i64 %2) {
%4 = add nsw i64 %1, %0
%5 = sub i64 %4, %2
%6 = srem i64 %5, %1
%7 = icmp slt i64 %6, 2
%8 = zext i1 %7 to i32
ret i32 %8
}
void image_window_redraw_thumbnail() {}


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

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

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

LLVM IR (-O2):
define void @image_window_redraw_thumbnail() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bar(int /*<<< orphan*/, int);
int foo(int k, int N) {
  while (k < N) {
    bar(0, k);
    k = k + 1;
  }
  return k;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1142 <foo+0x32>
mov    -0x4(%rbp),%esi
xor    %edi,%edi
call   1030 <bar@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111e <foo+0xe>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
cmp    %esi,%edi
jge    1132 <foo+0x22>
mov    %esi,%ebp
nopl   0x0(%rax,%rax,1)
xor    %edi,%edi
mov    %ebx,%esi
call   1030 <bar@plt>
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    1120 <foo+0x10>
mov    %ebp,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @foo(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
br label %5
5: ; preds = %9, %2
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %14
9: ; preds = %5
%10 = load i32, i32* %3
%11 = call i32 @bar(i32 0, i32 %10)
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %5
14: ; preds = %5
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
br i1 %3, label %4, label %9
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %0, %2 ]
%6 = tail call i32 @bar(i32 0, i32 %5)
%7 = add i32 %5, 1
%8 = icmp eq i32 %7, %1
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ %0, %2 ], [ %1, %4 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ test_rbtree_delete();
int /*<<< orphan*/ test_rbtree_delete_all();
int /*<<< orphan*/ test_rbtree_is_empty();
int /*<<< orphan*/ test_rbtree_search();
int /*<<< orphan*/ test_rbtree_walk();
int main() {
  test_rbtree_delete();
  test_rbtree_delete_all();
  test_rbtree_search();
  test_rbtree_is_empty();
  test_rbtree_walk();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <test_rbtree_delete@plt>
mov    $0x0,%al
call   1070 <test_rbtree_delete_all@plt>
mov    $0x0,%al
call   1050 <test_rbtree_search@plt>
mov    $0x0,%al
call   1030 <test_rbtree_is_empty@plt>
mov    $0x0,%al
call   1040 <test_rbtree_walk@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <test_rbtree_delete@plt>
xor    %eax,%eax
call   1070 <test_rbtree_delete_all@plt>
xor    %eax,%eax
call   1050 <test_rbtree_search@plt>
xor    %eax,%eax
call   1030 <test_rbtree_is_empty@plt>
xor    %eax,%eax
call   1040 <test_rbtree_walk@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test_rbtree_delete()
%3 = call i32 (...) @test_rbtree_delete_all()
%4 = call i32 (...) @test_rbtree_search()
%5 = call i32 (...) @test_rbtree_is_empty()
%6 = call i32 (...) @test_rbtree_walk()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_rbtree_delete()
%2 = tail call i32 (...) @test_rbtree_delete_all()
%3 = tail call i32 (...) @test_rbtree_search()
%4 = tail call i32 (...) @test_rbtree_is_empty()
%5 = tail call i32 (...) @test_rbtree_walk()
ret i32 0
}
/* Type definitions */
struct option_a {
  int dummy;
};

/* Variables and functions */
int _getopt_internal_a(int, char *const *, char const *,
                       struct option_a const *, int *, int, int /*<<< orphan*/);
int getopt_long_only_a(int argc, char *const *argv, const char *options,
                       const struct option_a *long_options, int *opt_index) {
  return _getopt_internal_a(argc, argv, options, long_options, opt_index, 1, 0);
}


x86 assembly (clang, -O0):
<getopt_long_only_a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    $0x1,%r9d
xor    %eax,%eax
movl   $0x0,(%rsp)
call   1030 <_getopt_internal_a@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getopt_long_only_a>:
push   %rax
movl   $0x0,(%rsp)
mov    $0x1,%r9d
call   1030 <_getopt_internal_a@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.option_a = type { i32 }
define i32 @getopt_long_only_a(i32 %0, i8** %1, i8* %2, %struct.option_a* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca %struct.option_a*
%10 = alloca i32*
store i32 %0, i32* %6
store i8** %1, i8*** %7
store i8* %2, i8** %8
store %struct.option_a* %3, %struct.option_a** %9
store i32* %4, i32** %10
%11 = load i32, i32* %6
%12 = load i8**, i8*** %7
%13 = load i8*, i8** %8
%14 = load %struct.option_a*, %struct.option_a** %9
%15 = load i32*, i32** %10
%16 = call i32 @_getopt_internal_a(i32 %11, i8** %12, i8* %13, %struct.option_a* %14, i32* %15, i32 1, i32 0)
ret i32 %16
}

LLVM IR (-O2):
%struct.option_a = type { i32 }
define i32 @getopt_long_only_a(i32 %0, i8** %1, i8* %2, %struct.option_a* %3, i32* %4) {
%6 = tail call i32 @_getopt_internal_a(i32 %0, i8** %1, i8* %2, %struct.option_a* %3, i32* %4, i32 1, i32 0)
ret i32 %6
}
void RTAvlrGCPtrDestroy(void) {}


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

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

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

LLVM IR (-O2):
define void @RTAvlrGCPtrDestroy() {
ret void
}
int data_iszerocost(int *cost) {
  int i;
  int free = 1;
  for (i = 0; i < 7; i++)
    if (cost[i] > 0)
      free = 0;
  return free;
}


x86 assembly (clang, -O0):
<data_iszerocost>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x7,-0xc(%rbp)
jge    114c <data_iszerocost+0x4c>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jle    1139 <data_iszerocost+0x39>
movl   $0x0,-0x10(%rbp)
jmp    113e <data_iszerocost+0x3e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <data_iszerocost+0x16>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<data_iszerocost>:
cmpl   $0x0,(%rdi)
setle  %r8b
cmpl   $0x0,0x4(%rdi)
setle  %cl
cmpl   $0x0,0x8(%rdi)
setle  %dl
movdqu 0xc(%rdi),%xmm0
pxor   %xmm1,%xmm1
pcmpgtd %xmm1,%xmm0
movmskps %xmm0,%esi
test   %esi,%esi
sete   %al
and    %cl,%dl
and    %r8b,%dl
and    %al,%dl
movzbl %dl,%eax
ret

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

LLVM IR (-O2):
define i32 @data_iszerocost(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp slt i32 %2, 1
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = icmp slt i32 %5, 1
%7 = getelementptr inbounds i32, i32* %0, i64 2
%8 = load i32, i32* %7
%9 = icmp slt i32 %8, 1
%10 = getelementptr inbounds i32, i32* %0, i64 3
%11 = bitcast i32* %10 to <4 x i32>*
%12 = load <4 x i32>, <4 x i32>* %11
%13 = freeze <4 x i32> %12
%14 = icmp sgt <4 x i32> %13, zeroinitializer
%15 = bitcast <4 x i1> %14 to i4
%16 = icmp eq i4 %15, 0
%17 = select i1 %16, i1 %9, i1 false
%18 = select i1 %17, i1 %6, i1 false
%19 = select i1 %18, i1 %3, i1 false
%20 = zext i1 %19 to i32
ret i32 %20
}
/* Variables and functions */
int f(int);
int main(void) {
  int *x, *y;
  for (int i = 0; i < 100; i++) {
    x[9] = 45;
    x[i] = f(y[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x64,-0x1c(%rbp)
jge    1166 <main+0x56>
mov    -0x10(%rbp),%rax
movl   $0x2d,0x24(%rax)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1030 <f@plt>
mov    %eax,%edx
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1126 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
br label %5
5: ; preds = %21, %0
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 100
br i1 %7, label %8, label %24
8: ; preds = %5
%9 = load i32*, i32** %2
%10 = getelementptr inbounds i32, i32* %9, i64 9
store i32 45, i32* %10
%11 = load i32*, i32** %3
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 @f(i32 %15)
%17 = load i32*, i32** %2
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
store i32 %16, i32* %20
br label %21
21: ; preds = %8
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %5
24: ; preds = %5
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
void thickness_limit(double *thickness, double *brightness, double limit) {
  if (*thickness < limit) {
    *brightness *= *thickness / limit;
    *thickness = limit;
  }
}


x86 assembly (clang, -O0):
<thickness_limit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    114e <thickness_limit+0x4e>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
divsd  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<thickness_limit>:
movsd  (%rdi),%xmm1
ucomisd %xmm1,%xmm0
jbe    111a <thickness_limit+0x1a>
divsd  %xmm0,%xmm1
mulsd  (%rsi),%xmm1
movsd  %xmm1,(%rsi)
movsd  %xmm0,(%rdi)
ret

LLVM IR (-O0):
define void @thickness_limit(double* %0, double* %1, double %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store double %2, double* %6
%7 = load double*, double** %4
%8 = load double, double* %7
%9 = load double, double* %6
%10 = fcmp olt double %8, %9
br i1 %10, label %11, label %21
11: ; preds = %3
%12 = load double*, double** %4
%13 = load double, double* %12
%14 = load double, double* %6
%15 = fdiv double %13, %14
%16 = load double*, double** %5
%17 = load double, double* %16
%18 = fmul double %17, %15
store double %18, double* %16
%19 = load double, double* %6
%20 = load double*, double** %4
store double %19, double* %20
br label %21
21: ; preds = %11, %3
ret void
}

LLVM IR (-O2):
define void @thickness_limit(double* nocapture %0, double* nocapture %1, double %2) {
%4 = load double, double* %0
%5 = fcmp olt double %4, %2
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = fdiv double %4, %2
%8 = load double, double* %1
%9 = fmul double %7, %8
store double %9, double* %1
store double %2, double* %0
br label %10
10: ; preds = %6, %3
ret void
}
/* Type definitions */
struct linked_list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _llist_destroy_content(struct linked_list *,
                                          void (*)(struct ll_node *, void *),
                                          void *);
int /*<<< orphan*/ free(struct linked_list *);
void llist_destroy(struct linked_list *list,
                   void (*destroy_callback)(struct ll_node *node, void *p),
                   void *param) {
  _llist_destroy_content(list, destroy_callback, param);
  free(list);
}


x86 assembly (clang, -O0):
<llist_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <_llist_destroy_content@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.linked_list = type { i32 }
%struct.ll_node = type opaque
%struct.ll_node.0 = type opaque
define void @llist_destroy(%struct.linked_list* %0, void (%struct.ll_node*, i8*)* %1, i8* %2) {
%4 = alloca %struct.linked_list*
%5 = alloca void (%struct.ll_node*, i8*)*
%6 = alloca i8*
store %struct.linked_list* %0, %struct.linked_list** %4
store void (%struct.ll_node*, i8*)* %1, void (%struct.ll_node*, i8*)** %5
store i8* %2, i8** %6
%7 = load %struct.linked_list*, %struct.linked_list** %4
%8 = load void (%struct.ll_node*, i8*)*, void (%struct.ll_node*, i8*)** %5
%9 = bitcast void (%struct.ll_node*, i8*)* %8 to void (%struct.ll_node.0*, i8*)*
%10 = load i8*, i8** %6
%11 = call i32 @_llist_destroy_content(%struct.linked_list* %7, void (%struct.ll_node.0*, i8*)* %9, i8* %10)
%12 = load %struct.linked_list*, %struct.linked_list** %4
%13 = call i32 @free(%struct.linked_list* %12)
ret void
}

LLVM IR (-O2):
%struct.linked_list = type { i32 }
%struct.ll_node = type opaque
%struct.ll_node.0 = type opaque
define void @llist_destroy(%struct.linked_list* %0, void (%struct.ll_node*, i8*)* %1, i8* %2) {
%4 = bitcast void (%struct.ll_node*, i8*)* %1 to void (%struct.ll_node.0*, i8*)*
%5 = tail call i32 @_llist_destroy_content(%struct.linked_list* %0, void (%struct.ll_node.0*, i8*)* %4, i8* %2)
%6 = tail call i32 @free(%struct.linked_list* %0)
ret void
}