xunge/DecIR huggingface dataset:
int compare_double(const void *a, const void *b) {
  double *arg1 = (double *)a;
  double *arg2 = (double *)b;
  if (*arg1 == *arg2)
    return 0;
  return *arg1 < *arg2 ? -1 : 1;
}


x86 assembly (clang, -O0):
<compare_double>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
ucomisd (%rax),%xmm0
jne    1144 <compare_double+0x44>
jp     1144 <compare_double+0x44>
movl   $0x0,-0x4(%rbp)
jmp    1168 <compare_double+0x68>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
mov    $0x1,%eax
mov    $0xffffffff,%ecx
ucomisd %xmm1,%xmm0
cmova  %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_double>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
xor    %ecx,%ecx
ucomisd %xmm0,%xmm1
setbe  %cl
xor    %eax,%eax
ucomisd %xmm1,%xmm0
lea    -0x1(%rcx,%rcx,1),%ecx
cmovne %ecx,%eax
cmovp  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @compare_double(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca double*
%7 = alloca double*
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to double*
store double* %9, double** %6
%10 = load i8*, i8** %5
%11 = bitcast i8* %10 to double*
store double* %11, double** %7
%12 = load double*, double** %6
%13 = load double, double* %12
%14 = load double*, double** %7
%15 = load double, double* %14
%16 = fcmp oeq double %13, %15
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 0, i32* %3
br label %26
18: ; preds = %2
%19 = load double*, double** %6
%20 = load double, double* %19
%21 = load double*, double** %7
%22 = load double, double* %21
%23 = fcmp olt double %20, %22
%24 = zext i1 %23 to i64
%25 = select i1 %23, i32 -1, i32 1
store i32 %25, i32* %3
br label %26
26: ; preds = %18, %17
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @compare_double(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = bitcast i8* %1 to double*
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp oeq double %5, %6
%8 = fcmp olt double %5, %6
%9 = select i1 %8, i32 -1, i32 1
%10 = select i1 %7, i32 0, i32 %9
ret i32 %10
}
int ulbetween(long unsigned int test, long unsigned int low,
              long unsigned int high) {
  if ((test - low) <= (high - low))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<ulbetween>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
sub    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    -0x18(%rbp),%rcx
cmp    %rcx,%rax
ja     1135 <ulbetween+0x35>
movl   $0x1,-0x4(%rbp)
jmp    113c <ulbetween+0x3c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ulbetween>:
sub    %rsi,%rdi
sub    %rsi,%rdx
xor    %eax,%eax
cmp    %rdx,%rdi
setbe  %al
ret

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

LLVM IR (-O2):
define i32 @ulbetween(i64 %0, i64 %1, i64 %2) {
%4 = sub i64 %0, %1
%5 = sub i64 %2, %1
%6 = icmp ule i64 %4, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main() {
  int x = 0;
  x = x ? 1 : 0;
  puts(x ? "foo" : "bar");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
lea    0xec8(%rip),%rdi
lea    0xebd(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"foo\00"
@.str.1 = [4 x i8] c"bar\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* %1
%3 = icmp ne i32 %2, 0
%4 = zext i1 %3 to i64
%5 = select i1 %3, i32 1, i32 0
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
%10 = call i32 @puts(i8* %9)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"bar\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
void g_init(ac, av) int ac;
char *av[];
{}


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

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

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

LLVM IR (-O2):
define void @g_init(i32 %0, i8** nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ flash_write(int, int);
void unlock_block_for_writes(int offset) {
  flash_write(offset, 0x60);
  flash_write(offset, 0xd0);
}


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

x86 assembly (clang, -O2):
<unlock_block_for_writes>:
push   %rbx
mov    %edi,%ebx
mov    $0x60,%esi
call   1030 <flash_write@plt>
mov    %ebx,%edi
mov    $0xd0,%esi
pop    %rbx
jmp    1030 <flash_write@plt>

LLVM IR (-O0):
define void @unlock_block_for_writes(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @flash_write(i32 %3, i32 96)
%5 = load i32, i32* %2
%6 = call i32 @flash_write(i32 %5, i32 208)
ret void
}

LLVM IR (-O2):
define void @unlock_block_for_writes(i32 %0) {
%2 = tail call i32 @flash_write(i32 %0, i32 96)
%3 = tail call i32 @flash_write(i32 %0, i32 208)
ret void
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  unsigned long atom;
};
struct TYPE_4__ {
  TYPE_1__ xproperty;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void set_XEvent_xproperty_atom(void *_p, unsigned long _v) {
  ((XEvent *)_p)->xproperty.atom = (unsigned long)_v;
}


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

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

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i64 }
define void @set_XEvent_xproperty_atom(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_4__*
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
store i64 %5, i64* %9
ret void
}

LLVM IR (-O2):
define void @set_XEvent_xproperty_atom(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
void selectSort(int a[], int len) {
  int i = 0, j = 0, k = -1;
  for (i = 0; i < len - 1; i++) {
    k = i;
    for (j = i; j < len; j++) {
      if (a[j] < a[k])
        k = j;
    }
  }
}


x86 assembly (clang, -O0):
<selectSort>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0xffffffff,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1198 <selectSort+0x98>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1185 <selectSort+0x85>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x8(%rbp),%rcx
movslq -0x18(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    1172 <selectSort+0x72>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1177 <selectSort+0x77>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1144 <selectSort+0x44>
jmp    118a <selectSort+0x8a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1127 <selectSort+0x27>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @selectSort(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 -1, i32* %7
store i32 0, i32* %5
br label %8
8: ; preds = %39, %2
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = sub nsw i32 %10, 1
%12 = icmp slt i32 %9, %11
br i1 %12, label %13, label %42
13: ; preds = %8
%14 = load i32, i32* %5
store i32 %14, i32* %7
%15 = load i32, i32* %5
store i32 %15, i32* %6
br label %16
16: ; preds = %35, %13
%17 = load i32, i32* %6
%18 = load i32, i32* %4
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %38
20: ; preds = %16
%21 = load i32*, i32** %3
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %21, i64 %23
%25 = load i32, i32* %24
%26 = load i32*, i32** %3
%27 = load i32, i32* %7
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32, i32* %26, i64 %28
%30 = load i32, i32* %29
%31 = icmp slt i32 %25, %30
br i1 %31, label %32, label %34
32: ; preds = %20
%33 = load i32, i32* %6
store i32 %33, i32* %7
br label %34
34: ; preds = %32, %20
br label %35
35: ; preds = %34
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %16
38: ; preds = %16
br label %39
39: ; preds = %38
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 1
store i32 %41, i32* %5
br label %8
42: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @selectSort(i32* nocapture %0, i32 %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;

/* Variables and functions */
int /*<<< orphan*/ getresuid(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                             int /*<<< orphan*/ *);
uid_t geteuid(void) {
  uid_t euid;
  getresuid(NULL, &euid, NULL);
  return euid;
}


x86 assembly (clang, -O0):
<geteuid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edx
lea    -0x4(%rbp),%rsi
mov    %rdx,%rdi
call   1030 <getresuid@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geteuid>:
push   %rax
lea    0x4(%rsp),%rsi
xor    %edi,%edi
xor    %edx,%edx
call   1030 <getresuid@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @geteuid() {
%1 = alloca i32
%2 = call i32 @getresuid(i32* null, i32* %1, i32* null)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @geteuid() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @getresuid(i32* null, i32* %1, i32* null)
%4 = load i32, i32* %1
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ CRYPTO_THREADID;

/* Variables and functions */
int /*<<< orphan*/ CRYPTO_THREADID_set_numeric(int /*<<< orphan*/ *,
                                               unsigned long);
scalar_t__ pthread_self();
void __attribute__((unused))
threadid_callback(CRYPTO_THREADID __attribute__((unused)) * id) {
  CRYPTO_THREADID_set_numeric(id, (unsigned long)pthread_self());
}


x86 assembly (clang, -O0):
<threadid_callback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <pthread_self@plt>
mov    -0x10(%rbp),%rdi
mov    %rax,%rsi
call   1030 <CRYPTO_THREADID_set_numeric@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<threadid_callback>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <pthread_self@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
pop    %rbx
jmp    1030 <CRYPTO_THREADID_set_numeric@plt>

LLVM IR (-O0):
define void @threadid_callback(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i64 (...) @pthread_self()
%5 = call i32 @CRYPTO_THREADID_set_numeric(i32* %3, i64 %4)
ret void
}

LLVM IR (-O2):
define void @threadid_callback(i32* %0) {
%2 = tail call i64 (...) @pthread_self()
%3 = tail call i32 @CRYPTO_THREADID_set_numeric(i32* %0, i64 %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ key_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int IPC_CREAT;
int IPC_EXCL;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int semget(int /*<<< orphan*/, int, int);
int sem_create(key_t key) {
  int semid = semget(key, 1, 0666 | IPC_CREAT | IPC_EXCL);
  if (semid == -1)
    do {
      perror("semget");
      exit(EXIT_FAILURE);
    } while (0);
  return semid;
}


x86 assembly (clang, -O0):
<sem_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e8b(%rip),%rax
mov    (%rax),%edx
or     $0x1b6,%edx
mov    0x2e9c(%rip),%rax
or     (%rax),%edx
mov    $0x1,%esi
call   1030 <semget@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    118c <sem_create+0x5c>
jmp    1172 <sem_create+0x42>
lea    0xe87(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sem_create>:
push   %rax
mov    0x2e98(%rip),%rax
mov    (%rax),%edx
mov    0x2eaf(%rip),%rax
or     (%rax),%edx
or     $0x1b6,%edx
mov    $0x1,%esi
call   1030 <semget@plt>
cmp    $0xffffffff,%eax
je     115a <sem_create+0x2a>
pop    %rcx
ret
lea    0xe9f(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@IPC_CREAT = global i32 0
@IPC_EXCL = global i32 0
@.str = [7 x i8] c"semget\00"
@EXIT_FAILURE = global i32 0
define i32 @sem_create(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @IPC_CREAT
%6 = or i32 438, %5
%7 = load i32, i32* @IPC_EXCL
%8 = or i32 %6, %7
%9 = call i32 @semget(i32 %4, i32 1, i32 %8)
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %18
12: ; preds = %1
br label %13
13: ; preds = %12
%14 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* @EXIT_FAILURE
%16 = call i32 @exit(i32 %15)
unreachable
17: ; No predecessors!
br label %18
18: ; preds = %17, %1
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@IPC_CREAT = global i32 0
@IPC_EXCL = global i32 0
@.str = [7 x i8] c"semget\00"
@EXIT_FAILURE = global i32 0
define i32 @sem_create(i32 %0) {
%2 = load i32, i32* @IPC_CREAT
%3 = load i32, i32* @IPC_EXCL
%4 = or i32 %2, %3
%5 = or i32 %4, 438
%6 = tail call i32 @semget(i32 %0, i32 1, i32 %5)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
12: ; preds = %1
ret i32 %6
}
int talloc_version_major(void) { return 2; }


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

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

LLVM IR (-O0):
define i32 @talloc_version_major() {
ret i32 2
}

LLVM IR (-O2):
define i32 @talloc_version_major() {
ret i32 2
}
/* Variables and functions */
scalar_t__ memcmp(char *, char *, int);
int strlen(char *);
int urlp_is_similar(char *url1, char *url2) {
  int len;
  len = strlen(url1);
  if (strlen(url2) != len)
    return 0;
  if (memcmp(url1, url2, len) == 0) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<urlp_is_similar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
cmp    -0x1c(%rbp),%eax
je     115a <urlp_is_similar+0x3a>
movl   $0x0,-0x4(%rbp)
jmp    1187 <urlp_is_similar+0x67>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <memcmp@plt>
cmp    $0x0,%rax
jne    1180 <urlp_is_similar+0x60>
movl   $0x1,-0x4(%rbp)
jmp    1187 <urlp_is_similar+0x67>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<urlp_is_similar>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ebp,%ecx
jne    1159 <urlp_is_similar+0x39>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <memcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @urlp_is_similar(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
store i32 %8, i32* %6
%9 = load i8*, i8** %5
%10 = call i32 @strlen(i8* %9)
%11 = load i32, i32* %6
%12 = icmp ne i32 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 0, i32* %3
br label %22
14: ; preds = %2
%15 = load i8*, i8** %4
%16 = load i8*, i8** %5
%17 = load i32, i32* %6
%18 = call i64 @memcmp(i8* %15, i8* %16, i32 %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %14
store i32 1, i32* %3
br label %22
21: ; preds = %14
store i32 0, i32* %3
br label %22
22: ; preds = %21, %20, %13
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
define i32 @urlp_is_similar(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %1)
%5 = icmp eq i32 %4, %3
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = tail call i64 @memcmp(i8* %0, i8* %1, i32 %3)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %2
%11 = phi i32 [ 0, %2 ], [ %9, %6 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void bgen_free(void const *p) { free((void *)p); }


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

LLVM IR (-O0):
define void @bgen_free(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 @bgen_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
void gtk_paint_hline() {}


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

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

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

LLVM IR (-O2):
define void @gtk_paint_hline() {
ret void
}
int my_atoi(char *str) {
  int i;
  int nb;
  i = 0;
  nb = 0;
  while (str[i] != '\0') {
    nb = 10 * nb + (str[i] - '0');
    i++;
  }
  return (nb);
}


x86 assembly (clang, -O0):
<my_atoi>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1151 <my_atoi+0x51>
imul   $0xa,-0x10(%rbp),%eax
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
sub    $0x30,%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <my_atoi+0x16>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_atoi>:
mov    (%rdi),%cl
test   %cl,%cl
je     1128 <my_atoi+0x28>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
lea    (%rax,%rax,4),%eax
lea    (%rcx,%rax,2),%eax
add    $0xffffffd0,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <my_atoi+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @my_atoi(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %12, %4 ], [ 0, %1 ]
%6 = phi i8 [ %14, %4 ], [ %2, %1 ]
%7 = phi i32 [ %11, %4 ], [ 0, %1 ]
%8 = sext i8 %6 to i32
%9 = mul nsw i32 %7, 10
%10 = add i32 %9, -48
%11 = add i32 %10, %8
%12 = add nuw nsw i64 %5, 1
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %4
16: ; preds = %4, %1
%17 = phi i32 [ 0, %1 ], [ %11, %4 ]
ret i32 %17
}
/* Variables and functions */
char toupper(char const);
unsigned char hash_func(const char *pKey) {
  unsigned char index = 0;
  index = toupper(pKey[0]) - 'A';
  return (index % 26);
}


x86 assembly (clang, -O0):
<hash_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
movsbl %al,%eax
sub    $0x41,%eax
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
mov    %dl,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_func>:
push   %rax
movsbl (%rdi),%edi
call   1030 <toupper@plt>
add    $0xbf,%al
movzbl %al,%eax
imul   $0x4f,%eax,%ecx
shr    $0xb,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %dl,%al
pop    %rcx
ret

LLVM IR (-O0):
define zeroext i8 @hash_func(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
store i8 0, i8* %3
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = call signext i8 @toupper(i8 signext %6)
%8 = sext i8 %7 to i32
%9 = sub nsw i32 %8, 65
%10 = trunc i32 %9 to i8
store i8 %10, i8* %3
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = srem i32 %12, 26
%14 = trunc i32 %13 to i8
ret i8 %14
}

LLVM IR (-O2):
define zeroext i8 @hash_func(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call signext i8 @toupper(i8 signext %2)
%4 = add i8 %3, -65
%5 = urem i8 %4, 26
ret i8 %5
}
/* Variables and functions */
int core1_safe(char const *);
int U_EMRPOLYLINETO_safe(const char *record) { return (core1_safe(record)); }


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

x86 assembly (clang, -O2):
<U_EMRPOLYLINETO_safe>:
jmp    1030 <core1_safe@plt>

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

LLVM IR (-O2):
define i32 @U_EMRPOLYLINETO_safe(i8* %0) {
%2 = tail call i32 @core1_safe(i8* %0)
ret i32 %2
}
double heaviside(double x) {
  if (x >= 0.0) {
    return 1.0;
  }
  return 0.0;
}


x86 assembly (clang, -O0):
<heaviside>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     112d <heaviside+0x2d>
movsd  0xedd(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1135 <heaviside+0x35>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<heaviside>:
xorpd  %xmm1,%xmm1
cmpnlesd %xmm0,%xmm1
movsd  0xeef(%rip),%xmm0
andnpd %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @heaviside(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp oge double %4, 0.000000e+00
br i1 %5, label %6, label %7
6: ; preds = %1
store double 1.000000e+00, double* %2
br label %8
7: ; preds = %1
store double 0.000000e+00, double* %2
br label %8
8: ; preds = %7, %6
%9 = load double, double* %2
ret double %9
}

LLVM IR (-O2):
define double @heaviside(double %0) {
%2 = fcmp ult double %0, 0.000000e+00
%3 = select i1 %2, double 0.000000e+00, double 1.000000e+00
ret double %3
}
/* Variables and functions */
long double nan(char const *);
__attribute__((weak)) long double nanl(const char *s) { return nan(s); }


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

x86 assembly (clang, -O2):
<nanl>:
jmp    1030 <nan@plt>

LLVM IR (-O0):
define weak x86_fp80 @nanl(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call x86_fp80 @nan(i8* %3)
ret x86_fp80 %4
}

LLVM IR (-O2):
define weak x86_fp80 @nanl(i8* %0) {
%2 = tail call x86_fp80 @nan(i8* %0)
ret x86_fp80 %2
}
char ResolveSingle(char Token, long int *Value) {
  char Result;
  Result = (char)~0;
  switch (Token) {
  case '+':
    break;
  case '-':
    *Value = -(*Value);
    break;
  case '~':
    *Value = ~(*Value);
    break;
  default:
    Result = (char)0;
    break;
  }
  return (Result);
}


x86 assembly (clang, -O0):
<ResolveSingle>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0xff,-0x11(%rbp)
movsbl -0x1(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x2b,%eax
je     1149 <ResolveSingle+0x49>
jmp    1127 <ResolveSingle+0x27>
mov    -0x18(%rbp),%eax
sub    $0x2d,%eax
je     114e <ResolveSingle+0x4e>
jmp    1138 <ResolveSingle+0x38>
mov    -0x18(%rbp),%eax
sub    $0x7e,%eax
je     1163 <ResolveSingle+0x63>
jmp    117a <ResolveSingle+0x7a>
jmp    117e <ResolveSingle+0x7e>
mov    -0x10(%rbp),%rax
xor    %ecx,%ecx
sub    (%rax),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
jmp    117e <ResolveSingle+0x7e>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
xor    $0xffffffffffffffff,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
jmp    117e <ResolveSingle+0x7e>
movb   $0x0,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ResolveSingle>:
mov    $0xff,%al
cmp    $0x2b,%edi
je     111b <ResolveSingle+0x1b>
cmp    $0x7e,%edi
je     1115 <ResolveSingle+0x15>
cmp    $0x2d,%edi
jne    1119 <ResolveSingle+0x19>
negq   (%rsi)
ret
notq   (%rsi)
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define signext i8 @ResolveSingle(i8 signext %0, i64* %1) {
%3 = alloca i8
%4 = alloca i64*
%5 = alloca i8
store i8 %0, i8* %3
store i64* %1, i64** %4
store i8 -1, i8* %5
%6 = load i8, i8* %3
%7 = sext i8 %6 to i32
switch i32 %7, label %19 [
i32 43, label %8
i32 45, label %9
i32 126, label %14
]
8: ; preds = %2
br label %20
9: ; preds = %2
%10 = load i64*, i64** %4
%11 = load i64, i64* %10
%12 = sub nsw i64 0, %11
%13 = load i64*, i64** %4
store i64 %12, i64* %13
br label %20
14: ; preds = %2
%15 = load i64*, i64** %4
%16 = load i64, i64* %15
%17 = xor i64 %16, -1
%18 = load i64*, i64** %4
store i64 %17, i64* %18
br label %20
19: ; preds = %2
store i8 0, i8* %5
br label %20
20: ; preds = %19, %14, %9, %8
%21 = load i8, i8* %5
ret i8 %21
}

LLVM IR (-O2):
define signext i8 @ResolveSingle(i8 signext %0, i64* nocapture %1) {
%3 = sext i8 %0 to i32
switch i32 %3, label %10 [
i32 43, label %11
i32 45, label %4
i32 126, label %7
]
4: ; preds = %2
%5 = load i64, i64* %1
%6 = sub nsw i64 0, %5
store i64 %6, i64* %1
br label %11
7: ; preds = %2
%8 = load i64, i64* %1
%9 = xor i64 %8, -1
store i64 %9, i64* %1
br label %11
10: ; preds = %2
br label %11
11: ; preds = %10, %7, %4, %2
%12 = phi i8 [ 0, %10 ], [ -1, %7 ], [ -1, %4 ], [ -1, %2 ]
ret i8 %12
}
/* Variables and functions */
double __nv_fma(double, double, double);
double fma(double __a, double __b, double __c) {
  return __nv_fma(__a, __b, __c);
}


x86 assembly (clang, -O0):
<fma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
call   1030 <__nv_fma@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fma>:
jmp    1030 <__nv_fma@plt>

LLVM IR (-O0):
define double @fma(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* %5
%9 = load double, double* %6
%10 = call double @__nv_fma(double %7, double %8, double %9)
ret double %10
}

LLVM IR (-O2):
define double @fma(double %0, double %1, double %2) {
%4 = tail call double @__nv_fma(double %0, double %1, double %2)
ret double %4
}
void xfree(void *mem) {}


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

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

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

LLVM IR (-O2):
define void @xfree(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo(int);
void fn_10(int flag) {
  if (flag)
    if (flag / 2) {
      foo(0);
      foo(1);
    }
  foo(2);
  foo(3);
}


x86 assembly (clang, -O0):
<fn_10>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     114f <fn_10+0x3f>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%eax
je     114a <fn_10+0x3a>
xor    %edi,%edi
call   1030 <foo@plt>
mov    $0x1,%edi
call   1030 <foo@plt>
jmp    114f <fn_10+0x3f>
mov    $0x2,%edi
call   1030 <foo@plt>
mov    $0x3,%edi
call   1030 <foo@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn_10>:
push   %rax
add    $0x1,%edi
cmp    $0x3,%edi
jb     112a <fn_10+0x1a>
xor    %edi,%edi
call   1030 <foo@plt>
mov    $0x1,%edi
call   1030 <foo@plt>
mov    $0x2,%edi
call   1030 <foo@plt>
mov    $0x3,%edi
pop    %rax
jmp    1030 <foo@plt>

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

LLVM IR (-O2):
define void @fn_10(i32 %0) {
switch i32 %0, label %2 [
i32 -1, label %5
i32 1, label %5
i32 0, label %5
]
2: ; preds = %1
%3 = tail call i32 @foo(i32 0)
%4 = tail call i32 @foo(i32 1)
br label %5
5: ; preds = %1, %1, %1, %2
%6 = tail call i32 @foo(i32 2)
%7 = tail call i32 @foo(i32 3)
ret void
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ putchar(int);
main() {
  int c, pc;
  while ((c = getchar()) != EOF) {
    if (c != ' ' || pc != ' ') {
      putchar(c);
    }
    pc = c;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea8(%rip),%rcx
cmp    (%rcx),%eax
je     116f <main+0x4f>
cmpl   $0x20,-0x8(%rbp)
jne    115c <main+0x3c>
cmpl   $0x20,-0xc(%rbp)
je     1164 <main+0x44>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    112f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb6(%rip),%r14
cmp    (%r14),%eax
jne    1141 <main+0x21>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
jmp    1165 <main+0x45>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %ebx,%ecx
cmp    (%r14),%eax
je     1137 <main+0x17>
mov    %eax,%ebx
cmp    $0x20,%eax
jne    1150 <main+0x30>
cmp    $0x20,%ecx
je     1157 <main+0x37>
jmp    1150 <main+0x30>

LLVM IR (-O0):
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %17, %0
%5 = call i32 (...) @getchar()
store i32 %5, i32* %2
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %19
8: ; preds = %4
%9 = load i32, i32* %2
%10 = icmp ne i32 %9, 32
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = load i32, i32* %3
%13 = icmp ne i32 %12, 32
br i1 %13, label %14, label %17
14: ; preds = %11, %8
%15 = load i32, i32* %2
%16 = call i32 @putchar(i32 %15)
br label %17
17: ; preds = %14, %11
%18 = load i32, i32* %2
store i32 %18, i32* %3
br label %4
19: ; preds = %4
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %16, label %4
4: ; preds = %0, %12
%5 = phi i32 [ %13, %12 ], [ %1, %0 ]
%6 = phi i32 [ %5, %12 ], [ undef, %0 ]
%7 = icmp ne i32 %5, 32
%8 = icmp ne i32 %6, 32
%9 = select i1 %7, i1 true, i1 %8
br i1 %9, label %10, label %12
10: ; preds = %4
%11 = tail call i32 @putchar(i32 %5)
br label %12
12: ; preds = %4, %10
%13 = tail call i32 (...) @getchar()
%14 = load i32, i32* @EOF
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %4
16: ; preds = %12, %0
ret i32 0
}
/* Variables and functions */
void *__builtin_malloc(unsigned long);
void *bar(unsigned long, int);
void *foo(long unsigned int n, int m) {
  void *p;
  if (m > 0)
    p = bar(n, --m);
  else
    p = __builtin_malloc(n);
  return p;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1154 <foo+0x34>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0xffffffff,%esi
mov    %esi,-0xc(%rbp)
call   1030 <bar@plt>
mov    %rax,-0x18(%rbp)
jmp    1161 <foo+0x41>
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
test   %esi,%esi
jle    112c <foo+0xc>
add    $0xffffffff,%esi
jmp    1030 <bar@plt>
jmp    1040 <malloc@plt>

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

LLVM IR (-O2):
define i8* @foo(i64 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = add nsw i32 %1, -1
%6 = tail call i8* @bar(i64 %0, i32 %5)
br label %9
7: ; preds = %2
%8 = tail call i8* @malloc(i64 %0)
br label %9
9: ; preds = %7, %4
%10 = phi i8* [ %6, %4 ], [ %8, %7 ]
ret i8* %10
}
/* Type definitions */
typedef int __u16;

/* Variables and functions */
int cec_has_record(__u16 log_addr_mask) {
  return log_addr_mask & ((1 << 1) | (1 << 2) | (1 << 9));
}


x86 assembly (clang, -O0):
<cec_has_record>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x206,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cec_has_record>:
mov    %edi,%eax
and    $0x206,%eax
ret

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

LLVM IR (-O2):
define i32 @cec_has_record(i32 %0) {
%2 = and i32 %0, 518
ret i32 %2
}
void foo(void) {
  struct {
    long a;
    char b[1];
  } x = {2, {0}};
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    0xef5(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xef2(%rip),%rax
mov    %rax,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.anon = type { i64, [1 x i8] }
@__const.foo.x = %struct.anon { i64 2, [1 x i8] zeroinitializer }
define void @foo() {
%1 = alloca %struct.anon
%2 = bitcast %struct.anon* %1 to i8*
ret void
}

LLVM IR (-O2):
define void @foo() {
ret void
}
/* Variables and functions */
void literal_pool_jumpover(int n) {}


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

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

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

LLVM IR (-O2):
define void @literal_pool_jumpover(i32 %0) {
ret void
}
void fill_buffer(char *content, int fill, int size) {
  char *end = content + size;
  while (content < end) {
    if (fill > 0) {
      *content = '+';
      fill--;
    } else {
      *content = '-';
    }
    content++;
  }
}


x86 assembly (clang, -O0):
<fill_buffer>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1162 <fill_buffer+0x62>
cmpl   $0x0,-0xc(%rbp)
jle    114a <fill_buffer+0x4a>
mov    -0x8(%rbp),%rax
movb   $0x2b,(%rax)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1151 <fill_buffer+0x51>
mov    -0x8(%rbp),%rax
movb   $0x2d,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111d <fill_buffer+0x1d>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_buffer>:
test   %edx,%edx
jle    1128 <fill_buffer+0x28>
movslq %edx,%rax
add    %rdi,%rax
jmp    111c <fill_buffer+0x1c>
nopl   0x0(%rax)
movb   $0x2d,(%rdi)
add    $0x1,%rdi
cmp    %rax,%rdi
jae    1128 <fill_buffer+0x28>
test   %esi,%esi
jle    1110 <fill_buffer+0x10>
movb   $0x2b,(%rdi)
add    $0xffffffff,%esi
jmp    1113 <fill_buffer+0x13>
ret

LLVM IR (-O0):
define void @fill_buffer(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %6
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
store i8* %11, i8** %7
br label %12
12: ; preds = %25, %3
%13 = load i8*, i8** %4
%14 = load i8*, i8** %7
%15 = icmp ult i8* %13, %14
br i1 %15, label %16, label %28
16: ; preds = %12
%17 = load i32, i32* %5
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = load i8*, i8** %4
store i8 43, i8* %20
%21 = load i32, i32* %5
%22 = add nsw i32 %21, -1
store i32 %22, i32* %5
br label %25
23: ; preds = %16
%24 = load i8*, i8** %4
store i8 45, i8* %24
br label %25
25: ; preds = %23, %19
%26 = load i8*, i8** %4
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %4
br label %12
28: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @fill_buffer(i8* writeonly %0, i32 %1, i32 %2) {
%4 = sext i32 %2 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = icmp sgt i32 %2, 0
br i1 %6, label %7, label %18
7: ; preds = %3, %14
%8 = phi i8* [ %16, %14 ], [ %0, %3 ]
%9 = phi i32 [ %15, %14 ], [ %1, %3 ]
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %7
store i8 43, i8* %8
%12 = add nsw i32 %9, -1
br label %14
13: ; preds = %7
store i8 45, i8* %8
br label %14
14: ; preds = %13, %11
%15 = phi i32 [ %12, %11 ], [ %9, %13 ]
%16 = getelementptr inbounds i8, i8* %8, i64 1
%17 = icmp ult i8* %16, %5
br i1 %17, label %7, label %18
18: ; preds = %14, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ get_double_grid_address(long *, long const *, long const *);
int /*<<< orphan*/ reduce_double_grid_address(long *, long const *);
void grg_get_double_grid_address(long address_double[3], const long address[3],
                                 const long D_diag[3], const long PS[3]) {
  get_double_grid_address(address_double, address, PS);
  reduce_double_grid_address(address_double, D_diag);
}


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

x86 assembly (clang, -O2):
<grg_get_double_grid_address>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
mov    %rcx,%rdx
call   1040 <get_double_grid_address@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <reduce_double_grid_address@plt>

LLVM IR (-O0):
define void @grg_get_double_grid_address(i64* %0, i64* %1, i64* %2, i64* %3) {
%5 = alloca i64*
%6 = alloca i64*
%7 = alloca i64*
%8 = alloca i64*
store i64* %0, i64** %5
store i64* %1, i64** %6
store i64* %2, i64** %7
store i64* %3, i64** %8
%9 = load i64*, i64** %5
%10 = load i64*, i64** %6
%11 = load i64*, i64** %8
%12 = call i32 @get_double_grid_address(i64* %9, i64* %10, i64* %11)
%13 = load i64*, i64** %5
%14 = load i64*, i64** %7
%15 = call i32 @reduce_double_grid_address(i64* %13, i64* %14)
ret void
}

LLVM IR (-O2):
define void @grg_get_double_grid_address(i64* %0, i64* %1, i64* %2, i64* %3) {
%5 = tail call i32 @get_double_grid_address(i64* %0, i64* %1, i64* %3)
%6 = tail call i32 @reduce_double_grid_address(i64* %0, i64* %2)
ret void
}
/* Type definitions */
typedef scalar_t__ clock_t;

/* Variables and functions */
int CLOCKS_PER_SEC;
int /*<<< orphan*/ Proc0(long, int);
scalar_t__ clock();
run_for_duration(int duration, long num_loops) {
  clock_t end = clock() + duration * CLOCKS_PER_SEC;
  do {
    Proc0(num_loops, duration == 0);
  } while (clock() < end);
}


x86 assembly (clang, -O0):
<run_for_duration>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    -0x8(%rbp),%ecx
mov    0x2ea8(%rip),%rdx
imul   (%rdx),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
cmpl   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%esi
call   1040 <Proc0@plt>
mov    $0x0,%al
call   1030 <clock@plt>
cmp    -0x18(%rbp),%rax
jl     114d <run_for_duration+0x2d>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_for_duration>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <clock@plt>
mov    0x2eb1(%rip),%rcx
movslq (%rcx),%rbx
movslq %ebp,%rcx
imul   %rcx,%rbx
add    %rax,%rbx
xor    %ebp,%ebp
test   %ecx,%ecx
sete   %bpl
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebp,%esi
call   1040 <Proc0@plt>
xor    %eax,%eax
call   1030 <clock@plt>
cmp    %rbx,%rax
jl     1150 <run_for_duration+0x30>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@CLOCKS_PER_SEC = global i32 0
define i32 @run_for_duration(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
store i32 %0, i32* %4
store i64 %1, i64* %5
%7 = call i64 (...) @clock()
%8 = load i32, i32* %4
%9 = load i32, i32* @CLOCKS_PER_SEC
%10 = mul nsw i32 %8, %9
%11 = sext i32 %10 to i64
%12 = add nsw i64 %7, %11
store i64 %12, i64* %6
br label %13
13: ; preds = %19, %2
%14 = load i64, i64* %5
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 0
%17 = zext i1 %16 to i32
%18 = call i32 @Proc0(i64 %14, i32 %17)
br label %19
19: ; preds = %13
%20 = call i64 (...) @clock()
%21 = load i64, i64* %6
%22 = icmp slt i64 %20, %21
br i1 %22, label %13, label %23
23: ; preds = %19
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@CLOCKS_PER_SEC = global i32 0
define i32 @run_for_duration(i32 %0, i64 %1) {
%3 = tail call i64 (...) @clock()
%4 = load i32, i32* @CLOCKS_PER_SEC
%5 = mul nsw i32 %4, %0
%6 = sext i32 %5 to i64
%7 = add nsw i64 %3, %6
%8 = icmp eq i32 %0, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %10, %2
%11 = tail call i32 @Proc0(i64 %1, i32 %9)
%12 = tail call i64 (...) @clock()
%13 = icmp slt i64 %12, %7
br i1 %13, label %10, label %14
14: ; preds = %10
ret i32 undef
}
/* Variables and functions */
char *UTIL_appendStr(char *, char *);
char *OC_mkTySkelVarName(char *number) {
  return UTIL_appendStr("tyskel", number);
}


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

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"tyskel\00"
define i8* @OC_mkTySkelVarName(i8* %0) {
%2 = tail call i8* @UTIL_appendStr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i8* %2
}
void oper_crca(unsigned short code) { return; }


x86 assembly (clang, -O0):
<oper_crca>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @oper_crca(i16 zeroext %0) {
ret void
}