xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ init_builtin_variables();
void basic_init() { init_builtin_variables(); }


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

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

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

LLVM IR (-O2):
define void @basic_init() {
%1 = tail call i32 (...) @init_builtin_variables()
ret void
}
void PrintFactPNGetVar2(void *theEnv, const char *logicalName, void *theValue) {

}


x86 assembly (clang, -O0):
<PrintFactPNGetVar2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @PrintFactPNGetVar2(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
ret void
}

LLVM IR (-O2):
define void @PrintFactPNGetVar2(i8* nocapture %0, i8* nocapture %1, i8* nocapture %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ app_debug_putchar(char const);
void app_debug_print(const char *arg) {
  while (*arg != '\0') {
    app_debug_putchar(*arg);
    arg++;
  }
}


x86 assembly (clang, -O0):
<app_debug_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1149 <app_debug_print+0x39>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <app_debug_putchar@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <app_debug_print+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<app_debug_print>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <app_debug_print+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <app_debug_putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <app_debug_print+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @app_debug_print(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call i32 @app_debug_putchar(i8 signext %5)
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int MPI_Send(void *buf, int count, int datatype, int dest, int tag, int comm) {
  printf("MPI Stub WARNING: Should not send message to self\n");
  return 0;
}


x86 assembly (clang, -O0):
<MPI_Send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [51 x i8] c"MPI Stub WARNING: Should not send message to self\0A\00"
define i32 @MPI_Send(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [50 x i8] c"MPI Stub WARNING: Should not send message to self\00"
define i32 @MPI_Send(i8* nocapture readnone %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void isr_usage_fault(void) {
  puts("##### USAGE FAULT #####");
  while (1) {
    asm("nop");
  }
}


x86 assembly (clang, -O0):
<isr_usage_fault>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
nop
jmp    1122 <isr_usage_fault+0x12>

x86 assembly (clang, -O2):
<isr_usage_fault>:
push   %rax
lea    0xee8(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
nop
nop
jmp    1120 <isr_usage_fault+0x10>

LLVM IR (-O0):
@.str = [24 x i8] c"##### USAGE FAULT #####\00"
define void @isr_usage_fault() {
%1 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
br label %2
}

LLVM IR (-O2):
@.str = [24 x i8] c"##### USAGE FAULT #####\00"
define void @isr_usage_fault() {
%1 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"()
br label %2
}
/* Variables and functions */
int tgt_getchar();
int getchar() { return tgt_getchar(); }


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

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

LLVM IR (-O0):
define i32 @getchar() {
%1 = call i32 (...) @tgt_getchar()
ret i32 %1
}

LLVM IR (-O2):
define i32 @getchar() {
%1 = tail call i32 (...) @tgt_getchar()
ret i32 %1
}
int lessThan(double x, double y) {
  int i;
  if (x < y) {
    i = 1;
  } else {
    i = 0;
  }
  return i;
}


x86 assembly (clang, -O0):
<lessThan>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    112e <lessThan+0x2e>
movl   $0x1,-0x14(%rbp)
jmp    1135 <lessThan+0x35>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lessThan>:
xor    %eax,%eax
ucomisd %xmm0,%xmm1
seta   %al
ret

LLVM IR (-O0):
define i32 @lessThan(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i32
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %3
%7 = load double, double* %4
%8 = fcmp olt double %6, %7
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 1, i32* %5
br label %11
10: ; preds = %2
store i32 0, i32* %5
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %5
ret i32 %12
}

LLVM IR (-O2):
define i32 @lessThan(double %0, double %1) {
%3 = fcmp olt double %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_smoother_new() {
  printf("NOT IMPLEMENTED:"
         "pa_smoother_new"
         "\n");
}


x86 assembly (clang, -O0):
<pa_smoother_new>:
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):
<pa_smoother_new>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@str = [32 x i8] c"NOT IMPLEMENTED:pa_smoother_new\00"
define i32 @pa_smoother_new() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
void do_miniht_load(int ht, int rh) {}


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

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

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

LLVM IR (-O2):
define void @do_miniht_load(i32 %0, i32 %1) {
ret void
}
/* Type definitions */
typedef scalar_t__ mqd_t;

/* Variables and functions */
scalar_t__ mq_open(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
mqd_t open_queue(char *qname, int oflag, int mode) {
  mqd_t queue;
  queue = mq_open(qname, oflag, mode, NULL);
  if (queue == (mqd_t)-1) {
    perror("unexpected error: "
           "mq_close"
           " "
           "2-1"
           ": "
           "mq_open");
  }
  return queue;
}


x86 assembly (clang, -O0):
<open_queue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <mq_open@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0xffffffffffffffff,-0x18(%rbp)
jne    1160 <open_queue+0x40>
lea    0xea5(%rip),%rdi
call   1040 <perror@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_queue>:
push   %rbx
xor    %ecx,%ecx
call   1030 <mq_open@plt>
mov    %rax,%rbx
cmp    $0xffffffffffffffff,%rax
je     1136 <open_queue+0x16>
mov    %rbx,%rax
pop    %rbx
ret
lea    0xec3(%rip),%rdi
call   1040 <perror@plt>
jmp    1131 <open_queue+0x11>

LLVM IR (-O0):
@.str = [40 x i8] c"unexpected error: mq_close 2-1: mq_open\00"
define i64 @open_queue(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i64 @mq_open(i8* %8, i32 %9, i32 %10, i32* null)
store i64 %11, i64* %7
%12 = load i64, i64* %7
%13 = icmp eq i64 %12, -1
br i1 %13, label %14, label %16
14: ; preds = %3
%15 = call i32 @perror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14, %3
%17 = load i64, i64* %7
ret i64 %17
}

LLVM IR (-O2):
@.str = [40 x i8] c"unexpected error: mq_close 2-1: mq_open\00"
define i64 @open_queue(i8* %0, i32 %1, i32 %2) {
%4 = tail call i64 @mq_open(i8* %0, i32 %1, i32 %2, i32* null)
%5 = icmp eq i64 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @perror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret i64 %4
}
void gdk_x11_screen_get_window_manager_name() {}


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

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

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

LLVM IR (-O2):
define void @gdk_x11_screen_get_window_manager_name() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  char sMyName[20];
  strcpy(sMyName, "Toad B. dePond");
  printf("%s \n", sMyName);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
lea    0xec6(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x20(%rbp),%rsi
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xed4(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xed1(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Toad B. dePond\00"
@.str.1 = [5 x i8] c"%s \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%4 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%6 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Toad B. dePond\00"
@.str.1 = [5 x i8] c"%s \0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret i32 0
}
int link(char *old, char *new) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @link(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ safeTester();
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  if (argc != 1)
    usage();
  safeTester();
  return 0;
}


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   $0x1,-0x8(%rbp)
je     1147 <main+0x27>
mov    $0x0,%al
call   1040 <usage@plt>
mov    $0x0,%al
call   1030 <safeTester@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x1,%edi
je     112d <main+0xd>
xor    %eax,%eax
call   1040 <usage@plt>
xor    %eax,%eax
call   1030 <safeTester@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
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, 1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (...) @usage()
br label %10
10: ; preds = %8, %2
%11 = call i32 (...) @safeTester()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (...) @usage()
br label %6
6: ; preds = %4, %2
%7 = tail call i32 (...) @safeTester()
ret i32 0
}
void f6(double *x __attribute__((unused))) {}


x86 assembly (clang, -O0):
<f6>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f6(double* %0) {
%2 = alloca double*
store double* %0, double** %2
ret void
}

LLVM IR (-O2):
define void @f6(double* nocapture %0) {
ret void
}
void skip_spaces(const char **pp) {
  const char *p;
  p = *pp;
  while (*p == ' ' || *p == '\t')
    p++;
  *pp = p;
}


x86 assembly (clang, -O0):
<skip_spaces>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x11(%rbp)
je     1138 <skip_spaces+0x38>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1148 <skip_spaces+0x48>
jmp    1159 <skip_spaces+0x59>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1113 <skip_spaces+0x13>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_spaces>:
mov    (%rdi),%rax
jmp    1114 <skip_spaces+0x14>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0x20,%cl
je     1110 <skip_spaces+0x10>
cmp    $0x9,%cl
je     1110 <skip_spaces+0x10>
mov    %rax,(%rdi)
ret

LLVM IR (-O0):
define void @skip_spaces(i8** %0) {
%2 = alloca i8**
%3 = alloca i8*
store i8** %0, i8*** %2
%4 = load i8**, i8*** %2
%5 = load i8*, i8** %4
store i8* %5, i8** %3
br label %6
6: ; preds = %18, %1
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 32
br i1 %10, label %16, label %11
11: ; preds = %6
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 9
br label %16
16: ; preds = %11, %6
%17 = phi i1 [ true, %6 ], [ %15, %11 ]
br i1 %17, label %18, label %21
18: ; preds = %16
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %3
br label %6
21: ; preds = %16
%22 = load i8*, i8** %3
%23 = load i8**, i8*** %2
store i8* %22, i8** %23
ret void
}

LLVM IR (-O2):
define void @skip_spaces(i8** nocapture %0) {
%2 = load i8*, i8** %0
br label %3
3: ; preds = %6, %1
%4 = phi i8* [ %2, %1 ], [ %7, %6 ]
%5 = load i8, i8* %4
switch i8 %5, label %8 [
i8 32, label %6
i8 9, label %6
]
6: ; preds = %3, %3
%7 = getelementptr inbounds i8, i8* %4, i64 1
br label %3
8: ; preds = %3
store i8* %4, i8** %0
ret void
}
int GCD(int a, int b) {
  if (a == 0)
    return b;
  if (b == 0)
    return a;
  while (a != b) {
    if (a > b)
      a = a - b;
    else
      b = b - a;
  }
  return a;
}


x86 assembly (clang, -O0):
<GCD>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111f <GCD+0x1f>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1173 <GCD+0x73>
cmpl   $0x0,-0xc(%rbp)
jne    1134 <GCD+0x34>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1173 <GCD+0x73>
jmp    1139 <GCD+0x39>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     116d <GCD+0x6d>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    115f <GCD+0x5f>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1168 <GCD+0x68>
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1139 <GCD+0x39>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GCD>:
test   %edi,%edi
je     1128 <GCD+0x28>
mov    %edi,%eax
test   %esi,%esi
je     1127 <GCD+0x27>
cmp    %esi,%eax
je     1127 <GCD+0x27>
xor    %ecx,%ecx
cmp    %eax,%esi
mov    $0x0,%edx
cmovl  %esi,%edx
mov    %eax,%edi
cmovl  %ecx,%edi
sub    %edx,%eax
sub    %edi,%esi
cmp    %esi,%eax
jne    1110 <GCD+0x10>
ret
mov    %esi,%eax
ret

LLVM IR (-O0):
define i32 @GCD(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %5
store i32 %9, i32* %3
br label %35
10: ; preds = %2
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = load i32, i32* %4
store i32 %14, i32* %3
br label %35
15: ; preds = %10
br label %16
16: ; preds = %32, %15
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = icmp ne i32 %17, %18
br i1 %19, label %20, label %33
20: ; preds = %16
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = icmp sgt i32 %21, %22
br i1 %23, label %24, label %28
24: ; preds = %20
%25 = load i32, i32* %4
%26 = load i32, i32* %5
%27 = sub nsw i32 %25, %26
store i32 %27, i32* %4
br label %32
28: ; preds = %20
%29 = load i32, i32* %5
%30 = load i32, i32* %4
%31 = sub nsw i32 %29, %30
store i32 %31, i32* %5
br label %32
32: ; preds = %28, %24
br label %16
33: ; preds = %16
%34 = load i32, i32* %4
store i32 %34, i32* %3
br label %35
35: ; preds = %33, %13, %8
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
define i32 @GCD(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %17, label %4
4: ; preds = %2
%5 = icmp eq i32 %1, 0
%6 = icmp eq i32 %0, %1
%7 = or i1 %5, %6
br i1 %7, label %17, label %8
8: ; preds = %4, %8
%9 = phi i32 [ %15, %8 ], [ %1, %4 ]
%10 = phi i32 [ %13, %8 ], [ %0, %4 ]
%11 = icmp slt i32 %9, %10
%12 = select i1 %11, i32 %9, i32 0
%13 = sub nsw i32 %10, %12
%14 = select i1 %11, i32 0, i32 %10
%15 = sub nsw i32 %9, %14
%16 = icmp eq i32 %13, %15
br i1 %16, label %17, label %8
17: ; preds = %8, %4, %2
%18 = phi i32 [ %1, %2 ], [ %0, %4 ], [ %13, %8 ]
ret i32 %18
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
int recv(int, char *, int, int /*<<< orphan*/);
ssize_t read_tcp_server_stream(int connFd, char *recv_data, int len) {
  ssize_t bytes_read = 0;
  if (connFd > 0) {
    bytes_read = recv(connFd, recv_data, len, 0);
    return bytes_read;
  }
  return -1;
}


x86 assembly (clang, -O0):
<read_tcp_server_stream>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1152 <read_tcp_server_stream+0x42>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1159 <read_tcp_server_stream+0x49>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_tcp_server_stream>:
test   %edi,%edi
jle    111b <read_tcp_server_stream+0xb>
xor    %ecx,%ecx
jmp    1030 <recv@plt>
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @read_tcp_server_stream(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 0, i32* %8
%9 = load i32, i32* %5
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %3
%12 = load i32, i32* %5
%13 = load i8*, i8** %6
%14 = load i32, i32* %7
%15 = call i32 @recv(i32 %12, i8* %13, i32 %14, i32 0)
store i32 %15, i32* %8
%16 = load i32, i32* %8
store i32 %16, i32* %4
br label %18
17: ; preds = %3
store i32 -1, i32* %4
br label %18
18: ; preds = %17, %11
%19 = load i32, i32* %4
ret i32 %19
}

LLVM IR (-O2):
define i32 @read_tcp_server_stream(i32 %0, i8* %1, i32 %2) {
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @recv(i32 %0, i8* %1, i32 %2, i32 0)
br label %7
7: ; preds = %3, %5
%8 = phi i32 [ %6, %5 ], [ -1, %3 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_idxset_string_compare_func() {
  printf("NOT IMPLEMENTED:"
         "pa_idxset_string_compare_func"
         "\n");
}


x86 assembly (clang, -O0):
<pa_idxset_string_compare_func>:
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):
<pa_idxset_string_compare_func>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@str = [46 x i8] c"NOT IMPLEMENTED:pa_idxset_string_compare_func\00"
define i32 @pa_idxset_string_compare_func() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ sigcatch_setup();
int /*<<< orphan*/ sigreceive_setup();
int /*<<< orphan*/ sigsend_setup();
int /*<<< orphan*/ sigthrow_setup();
void d_global_setup(void) {
  sigsend_setup();
  sigreceive_setup();
  sigcatch_setup();
  sigthrow_setup();
}


x86 assembly (clang, -O0):
<d_global_setup>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <sigsend_setup@plt>
mov    $0x0,%al
call   1030 <sigreceive_setup@plt>
mov    $0x0,%al
call   1060 <sigcatch_setup@plt>
mov    $0x0,%al
call   1040 <sigthrow_setup@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_global_setup>:
push   %rax
xor    %eax,%eax
call   1050 <sigsend_setup@plt>
xor    %eax,%eax
call   1030 <sigreceive_setup@plt>
xor    %eax,%eax
call   1060 <sigcatch_setup@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <sigthrow_setup@plt>

LLVM IR (-O0):
define void @d_global_setup() {
%1 = call i32 (...) @sigsend_setup()
%2 = call i32 (...) @sigreceive_setup()
%3 = call i32 (...) @sigcatch_setup()
%4 = call i32 (...) @sigthrow_setup()
ret void
}

LLVM IR (-O2):
define void @d_global_setup() {
%1 = tail call i32 (...) @sigsend_setup()
%2 = tail call i32 (...) @sigreceive_setup()
%3 = tail call i32 (...) @sigcatch_setup()
%4 = tail call i32 (...) @sigthrow_setup()
ret void
}
void conditionals(int a, int b) {
  if (a) {
    a = b++;
  } else {
    a = b++ + 1;
  };
}


x86 assembly (clang, -O0):
<conditionals>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1127 <conditionals+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
mov    %eax,-0x4(%rbp)
jmp    1138 <conditionals+0x38>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @conditionals(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 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %4
%9 = add nsw i32 %8, 1
store i32 %9, i32* %4
store i32 %8, i32* %3
br label %14
10: ; preds = %2
%11 = load i32, i32* %4
%12 = add nsw i32 %11, 1
store i32 %12, i32* %4
%13 = add nsw i32 %11, 1
store i32 %13, i32* %3
br label %14
14: ; preds = %10, %7
ret void
}

LLVM IR (-O2):
define void @conditionals(i32 %0, i32 %1) {
ret void
}
int cpu_accel(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @cpu_accel() {
ret i32 0
}
void machine_init() {}


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

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

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

LLVM IR (-O2):
define void @machine_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ mSort(int *, int *, int /*<<< orphan*/, int);
int *malloc(int);
void mergeSort(int a[], int n) {
  int *tmpArray = malloc(sizeof(int) * n);
  mSort(a, tmpArray, 0, n - 1);
  free(tmpArray);
}


x86 assembly (clang, -O0):
<mergeSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
xor    %edx,%edx
call   1040 <mSort@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mergeSort>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %rdi,%r14
lea    0x0(,%rbx,4),%edi
call   1050 <malloc@plt>
mov    %rax,%r15
add    $0xffffffff,%ebx
mov    %r14,%rdi
mov    %rax,%rsi
xor    %edx,%edx
mov    %ebx,%ecx
call   1040 <mSort@plt>
mov    %r15,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @mergeSort(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32*
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = mul i64 4, %7
%9 = trunc i64 %8 to i32
%10 = call i32* @malloc(i32 %9)
store i32* %10, i32** %5
%11 = load i32*, i32** %3
%12 = load i32*, i32** %5
%13 = load i32, i32* %4
%14 = sub nsw i32 %13, 1
%15 = call i32 @mSort(i32* %11, i32* %12, i32 0, i32 %14)
%16 = load i32*, i32** %5
%17 = call i32 @free(i32* %16)
ret void
}

LLVM IR (-O2):
define void @mergeSort(i32* %0, i32 %1) {
%3 = shl i32 %1, 2
%4 = tail call i32* @malloc(i32 %3)
%5 = add nsw i32 %1, -1
%6 = tail call i32 @mSort(i32* %0, i32* %4, i32 0, i32 %5)
%7 = tail call i32 @free(i32* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void xfree(void *ptr) { free(ptr); }


x86 assembly (clang, -O0):
<xfree>:
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):
<xfree>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @xfree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
int is_odd(const void *i) {
  int v = *(const int *)i;
  return ((v % 2) == 1);
}


x86 assembly (clang, -O0):
<is_odd>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_odd>:
mov    (%rdi),%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
and    $0xfffffffe,%eax
sub    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
sete   %al
ret

LLVM IR (-O0):
define i32 @is_odd(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
%6 = load i32, i32* %5
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = srem i32 %7, 2
%9 = icmp eq i32 %8, 1
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @is_odd(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = srem i32 %3, 2
%5 = icmp eq i32 %4, 1
%6 = zext i1 %5 to i32
ret i32 %6
}
void TIM1_OC1_IRQHandler(void) {}


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

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

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

LLVM IR (-O2):
define void @TIM1_OC1_IRQHandler() {
ret void
}
void RTStrAllocTag(void) {}


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

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

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

LLVM IR (-O2):
define void @RTStrAllocTag() {
ret void
}
/* Variables and functions */
int remove(char *);
int su_delete(char *file) {
  int ret = remove(file);
  if (ret == 0) {
    return 0;
  } else {
    return -1;
  }
}


x86 assembly (clang, -O0):
<su_delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <remove@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    113e <su_delete+0x2e>
movl   $0x0,-0x4(%rbp)
jmp    1145 <su_delete+0x35>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<su_delete>:
push   %rax
call   1030 <remove@plt>
neg    %eax
sbb    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @su_delete(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @remove(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %11
10: ; preds = %1
store i32 -1, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @su_delete(i8* nocapture %0) {
%2 = tail call i32 @remove(i8* %0)
%3 = icmp ne i32 %2, 0
%4 = sext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ ExtractParameters(char *, char *, char *);
void ToneStatement(char *Text) { ExtractParameters("TONE", "II", Text); }


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

x86 assembly (clang, -O2):
<ToneStatement>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
lea    0xee4(%rip),%rsi
jmp    1030 <ExtractParameters@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"TONE\00"
@.str.1 = [3 x i8] c"II\00"
define void @ToneStatement(i8* %0) {
%2 = tail call i32 @ExtractParameters(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gen_strchr(char *, int, char *);
int /*<<< orphan*/ init_buff(char *, int const);
int mksym_i32();
char *strchr(char *, int);
void test_strchr() {
  const int len = 5;
  char s[len];
  init_buff(s, len);
  int c = mksym_i32();
  char *res = strchr(s, c);
  gen_strchr(s, c, res);
}


x86 assembly (clang, -O0):
<test_strchr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x5,-0x4(%rbp)
mov    %rsp,%rax
mov    %rax,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   1060 <init_buff@plt>
mov    $0x0,%al
call   1050 <mksym_i32@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    -0x30(%rbp),%rdi
call   1040 <strchr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
lea    -0x30(%rbp),%rdi
call   1030 <gen_strchr@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_strchr>:
push   %rbp
push   %rbx
push   %rax
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1060 <init_buff@plt>
xor    %eax,%eax
call   1050 <mksym_i32@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <strchr@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %rax,%rdx
call   1030 <gen_strchr@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @test_strchr() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i32 5, i32* %1
%5 = call i8* @llvm.stacksave()
store i8* %5, i8** %2
%6 = alloca i8, i64 5
%7 = call i32 @init_buff(i8* %6, i32 5)
%8 = call i32 (...) @mksym_i32()
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = call i8* @strchr(i8* %6, i32 %9)
store i8* %10, i8** %4
%11 = load i32, i32* %3
%12 = load i8*, i8** %4
%13 = call i32 @gen_strchr(i8* %6, i32 %11, i8* %12)
%14 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
define void @test_strchr() {
%1 = alloca [5 x i8]
%2 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%3 = call i32 @init_buff(i8* %2, i32 5)
%4 = call i32 (...) @mksym_i32()
%5 = call i8* @strchr(i8* %2, i32 %4)
%6 = call i32 @gen_strchr(i8* %2, i32 %4, i8* %5)
ret void
}
int myAbs(const int a) { return ((a > 0) ? a : -a); }


x86 assembly (clang, -O0):
<myAbs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    111c <myAbs+0x1c>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <myAbs+0x24>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<myAbs>:
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
ret

LLVM IR (-O0):
define i32 @myAbs(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = load i32, i32* %2
br label %10
7: ; preds = %1
%8 = load i32, i32* %2
%9 = sub nsw i32 0, %8
br label %10
10: ; preds = %7, %5
%11 = phi i32 [ %6, %5 ], [ %9, %7 ]
ret i32 %11
}

LLVM IR (-O2):
define i32 @myAbs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
int create_event_queue() {}


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

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

LLVM IR (-O0):
define i32 @create_event_queue() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @create_event_queue() {
ret i32 undef
}
int xmlUCSIsKhmer(int code) { return (((code >= 0x1780) && (code <= 0x17FF))); }


x86 assembly (clang, -O0):
<xmlUCSIsKhmer>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x1780,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1126 <xmlUCSIsKhmer+0x26>
cmpl   $0x17ff,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmlUCSIsKhmer>:
and    $0xffffff80,%edi
xor    %eax,%eax
cmp    $0x1780,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @xmlUCSIsKhmer(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 6016
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 6143
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @xmlUCSIsKhmer(i32 %0) {
%2 = and i32 %0, -128
%3 = icmp eq i32 %2, 6016
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ assert(char const *);
scalar_t__ strcat(char *, char const *);
__attribute__((visibility("default"))) int trio_append(char *target,
                                                       const char *source) {
  assert(target);
  assert(source);
  return (strcat(target, source) != 0);
}


x86 assembly (clang, -O0):
<trio_append>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcat@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trio_append>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <assert@plt>
mov    %r14,%rdi
call   1030 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcat@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @trio_append(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 = call i32 @assert(i8* %5)
%7 = load i8*, i8** %4
%8 = call i32 @assert(i8* %7)
%9 = load i8*, i8** %3
%10 = load i8*, i8** %4
%11 = call i64 @strcat(i8* %9, i8* %10)
%12 = icmp ne i64 %11, 0
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @trio_append(i8* %0, i8* %1) {
%3 = tail call i32 @assert(i8* %0)
%4 = tail call i32 @assert(i8* %1)
%5 = tail call i64 @strcat(i8* %0, i8* %1)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}
int RECOIL_GetX68KColor(int color) {
  int rgb = (color & 1984) << 13 | (color & 63488) | (color & 62) << 2;
  if ((color & 1) != 0)
    rgb |= 263172;
  return rgb | (rgb >> 6 & 197379);
}


x86 assembly (clang, -O0):
<RECOIL_GetX68KColor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7c0,%eax
shl    $0xd,%eax
mov    -0x4(%rbp),%ecx
and    $0xf800,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0x3e,%ecx
shl    $0x2,%ecx
or     %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1145 <RECOIL_GetX68KColor+0x45>
mov    -0x8(%rbp),%eax
or     $0x40404,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    $0x6,%ecx
and    $0x30303,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<RECOIL_GetX68KColor>:
mov    %edi,%eax
shl    $0xd,%eax
and    $0xf80000,%eax
mov    %edi,%ecx
and    $0xf800,%ecx
or     %eax,%ecx
mov    %edi,%eax
and    $0x3e,%eax
lea    (%rcx,%rax,4),%edx
test   $0x1,%dil
lea    0x40404(%rcx,%rax,4),%ecx
cmove  %edx,%ecx
mov    %ecx,%eax
shr    $0x6,%eax
and    $0x30303,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @RECOIL_GetX68KColor(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = and i32 %4, 1984
%6 = shl i32 %5, 13
%7 = load i32, i32* %2
%8 = and i32 %7, 63488
%9 = or i32 %6, %8
%10 = load i32, i32* %2
%11 = and i32 %10, 62
%12 = shl i32 %11, 2
%13 = or i32 %9, %12
store i32 %13, i32* %3
%14 = load i32, i32* %2
%15 = and i32 %14, 1
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %1
%18 = load i32, i32* %3
%19 = or i32 %18, 263172
store i32 %19, i32* %3
br label %20
20: ; preds = %17, %1
%21 = load i32, i32* %3
%22 = load i32, i32* %3
%23 = ashr i32 %22, 6
%24 = and i32 %23, 197379
%25 = or i32 %21, %24
ret i32 %25
}

LLVM IR (-O2):
define i32 @RECOIL_GetX68KColor(i32 %0) {
%2 = shl i32 %0, 13
%3 = and i32 %2, 16252928
%4 = and i32 %0, 63488
%5 = or i32 %3, %4
%6 = shl i32 %0, 2
%7 = and i32 %6, 248
%8 = or i32 %5, %7
%9 = and i32 %0, 1
%10 = icmp eq i32 %9, 0
%11 = or i32 %8, 263172
%12 = select i1 %10, i32 %8, i32 %11
%13 = lshr i32 %12, 6
%14 = and i32 %13, 197379
%15 = or i32 %14, %12
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void show_oem_hex(unsigned char *sdr, int slen) {
  int i;
  for (i = 8; i < slen; i++)
    printf("%02x ", sdr[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<show_oem_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x8,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115a <show_oem_hex+0x4a>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <show_oem_hex+0x16>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_oem_hex>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x9,%esi
jl     1158 <show_oem_hex+0x38>
mov    %rdi,%r15
mov    %esi,%r12d
mov    $0x8,%ebx
lea    0xec1(%rip),%r14
nop
movzbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <show_oem_hex+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%02x \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @show_oem_hex(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 8, i32* %5
br label %6
6: ; preds = %18, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %21
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %10
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %6
21: ; preds = %6
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%02x \00"
define void @show_oem_hex(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 8
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 8, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
%15 = tail call i32 @putchar(i32 10)
ret void
}
int test_default() {
  int a = 100;
  switch (a) {
  case 1:
  case 2:
    return -1;
  default:
  case 3:
    return 0;
  case 4:
    return 1;
  }
}


x86 assembly (clang, -O0):
<test_default>:
push   %rbp
mov    %rsp,%rbp
movl   $0x64,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xffffffff,%eax
sub    $0x2,%eax
jb     1144 <test_default+0x44>
jmp    1122 <test_default+0x22>
mov    -0xc(%rbp),%eax
sub    $0x3,%eax
je     1155 <test_default+0x55>
jmp    1133 <test_default+0x33>
mov    -0xc(%rbp),%eax
sub    $0x4,%eax
je     1161 <test_default+0x61>
jmp    1150 <test_default+0x50>
movl   $0xffffffff,-0x4(%rbp)
jmp    1168 <test_default+0x68>
jmp    1155 <test_default+0x55>
movl   $0x0,-0x4(%rbp)
jmp    1168 <test_default+0x68>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_default() {
%1 = alloca i32
%2 = alloca i32
store i32 100, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %5 [
i32 1, label %4
i32 2, label %4
i32 3, label %6
i32 4, label %7
]
4: ; preds = %0, %0
store i32 -1, i32* %1
br label %8
5: ; preds = %0
br label %6
6: ; preds = %0, %5
store i32 0, i32* %1
br label %8
7: ; preds = %0
store i32 1, i32* %1
br label %8
8: ; preds = %7, %6, %4
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_default() {
ret i32 0
}
int symlinks_available(void) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @symlinks_available() {
ret i32 1
}
void IDLE(void) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<IDLE>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <IDLE+0x9>
jmp    1109 <IDLE+0x9>

x86 assembly (clang, -O2):
<IDLE>:
jmp    1100 <IDLE>

LLVM IR (-O0):
define void @IDLE() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @IDLE() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ SaveGameProc();
void AutoSaveGame() { SaveGameProc(); }


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

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

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

LLVM IR (-O2):
define void @AutoSaveGame() {
%1 = tail call i32 (...) @SaveGameProc()
ret void
}