xunge/DecIR huggingface dataset:
int wwrite(long long i) {
  switch (i) {
  case 3:
  case 10:
  case 23:
  case 28:
  case 47:
    return 0;
  default:
    return 123;
  }
}


x86 assembly (clang, -O0):
<wwrite>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
sub    $0x3,%rax
je     116b <wwrite+0x6b>
jmp    111f <wwrite+0x1f>
mov    -0x18(%rbp),%rax
sub    $0xa,%rax
je     116b <wwrite+0x6b>
jmp    1132 <wwrite+0x32>
mov    -0x18(%rbp),%rax
sub    $0x17,%rax
je     116b <wwrite+0x6b>
jmp    1145 <wwrite+0x45>
mov    -0x18(%rbp),%rax
sub    $0x1c,%rax
je     116b <wwrite+0x6b>
jmp    1158 <wwrite+0x58>
mov    -0x18(%rbp),%rax
sub    $0x2f,%rax
jne    1177 <wwrite+0x77>
jmp    116b <wwrite+0x6b>
movl   $0x0,-0x4(%rbp)
jmp    117e <wwrite+0x7e>
movl   $0x7b,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wwrite>:
cmp    $0x2f,%rdi
ja     1119 <wwrite+0x19>
xor    %eax,%eax
movabs $0x800010800408,%rcx
bt     %rdi,%rcx
jae    1119 <wwrite+0x19>
ret
mov    $0x7b,%eax
ret

LLVM IR (-O0):
define i32 @wwrite(i64 %0) {
%2 = alloca i32
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
switch i64 %4, label %6 [
i64 3, label %5
i64 10, label %5
i64 23, label %5
i64 28, label %5
i64 47, label %5
]
5: ; preds = %1, %1, %1, %1, %1
store i32 0, i32* %2
br label %7
6: ; preds = %1
store i32 123, i32* %2
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
define i32 @wwrite(i64 %0) {
switch i64 %0, label %2 [
i64 3, label %3
i64 10, label %3
i64 23, label %3
i64 28, label %3
i64 47, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %1, %1, %2
%4 = phi i32 [ 123, %2 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ]
ret i32 %4
}
unsigned char _ucAsyncGetBuf(void *pBuf, unsigned int uiLen,
                             unsigned int uiTimeOut) {
  return (1);
}


x86 assembly (clang, -O0):
<_ucAsyncGetBuf>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define zeroext i8 @_ucAsyncGetBuf(i8* nocapture readnone %0, i32 %1, i32 %2) {
ret i8 1
}
/* Type definitions */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
double atof(int /*<<< orphan*/);
int /*<<< orphan*/ get_param(char const *, char *, int);
double get_param_float(const char *cmd) {
  char buf[80];
  return atof(get_param(cmd, buf, sizeof(buf)));
}


x86 assembly (clang, -O0):
<get_param_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    $0x50,%edx
call   1040 <get_param@plt>
mov    %eax,%edi
call   1030 <atof@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_param_float>:
sub    $0x58,%rsp
mov    %rsp,%rsi
mov    $0x50,%edx
call   1040 <get_param@plt>
mov    %eax,%edi
call   1030 <atof@plt>
add    $0x58,%rsp
ret

LLVM IR (-O0):
define double @get_param_float(i8* %0) {
%2 = alloca i8*
%3 = alloca [80 x i8]
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%6 = call i32 @get_param(i8* %4, i8* %5, i32 80)
%7 = call double @atof(i32 %6)
ret double %7
}

LLVM IR (-O2):
define double @get_param_float(i8* %0) {
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%4 = call i32 @get_param(i8* %0, i8* %3, i32 80)
%5 = call double @atof(i32 %4)
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ joe_fatal(char *, char *, char *);
void *malloc(size_t);
void *joe_malloc(size_t size, char *file, char *line) {
  void *new = malloc(size);
  if (!new)
    joe_fatal("Memory exhausted at %s, line %s", file, line);
  return new;
}


x86 assembly (clang, -O0):
<joe_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1160 <joe_malloc+0x40>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xea5(%rip),%rdi
call   1030 <joe_fatal@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<joe_malloc>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114a <joe_malloc+0x2a>
lea    0xec1(%rip),%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <joe_fatal@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Memory exhausted at %s, line %s\00"
define i8* @joe_malloc(i64 %0, i8* %1, i8* %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i64 %0, i64* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i64, i64* %4
%9 = call i8* @malloc(i64 %8)
store i8* %9, i8** %7
%10 = load i8*, i8** %7
%11 = icmp ne i8* %10, null
br i1 %11, label %16, label %12
12: ; preds = %3
%13 = load i8*, i8** %5
%14 = load i8*, i8** %6
%15 = call i32 @joe_fatal(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %14)
br label %16
16: ; preds = %12, %3
%17 = load i8*, i8** %7
ret i8* %17
}

LLVM IR (-O2):
@.str = [32 x i8] c"Memory exhausted at %s, line %s\00"
define noalias i8* @joe_malloc(i64 %0, i8* %1, i8* %2) {
%4 = tail call i8* @malloc(i64 %0)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @joe_fatal(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2)
br label %8
8: ; preds = %6, %3
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ LOG_ERR;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ report(int /*<<< orphan*/, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
void log_kevent_wait(void) {
  report(LOG_ERR, "Error while waiting for a kevent: %s", strerror(errno));
}


x86 assembly (clang, -O0):
<log_kevent_wait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
mov    -0x4(%rbp),%edi
mov    %eax,%edx
lea    0xeb2(%rip),%rsi
call   1030 <report@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_kevent_wait>:
push   %rbx
mov    0x2ea8(%rip),%rax
mov    (%rax),%ebx
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
lea    0xec1(%rip),%rsi
mov    %ebx,%edi
mov    %eax,%edx
pop    %rbx
jmp    1030 <report@plt>

LLVM IR (-O0):
@LOG_ERR = global i32 0
@.str = [37 x i8] c"Error while waiting for a kevent: %s\00"
@errno = global i32 0
define void @log_kevent_wait() {
%1 = load i32, i32* @LOG_ERR
%2 = load i32, i32* @errno
%3 = call i32 @strerror(i32 %2)
%4 = call i32 @report(i32 %1, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@LOG_ERR = global i32 0
@.str = [37 x i8] c"Error while waiting for a kevent: %s\00"
@errno = global i32 0
define void @log_kevent_wait() {
%1 = load i32, i32* @LOG_ERR
%2 = load i32, i32* @errno
%3 = tail call i32 @strerror(i32 %2)
%4 = tail call i32 @report(i32 %1, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ execl(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
scalar_t__ vfork();
void f5() {
  if (vfork() == 0) {
    execl("prog", "arg1", 0);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<f5>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <vfork@plt>
cmp    $0x0,%rax
jne    1164 <f5+0x34>
lea    0xeb4(%rip),%rdi
lea    0xeb2(%rip),%rsi
xor    %edx,%edx
call   1050 <execl@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<f5>:
push   %rax
xor    %eax,%eax
call   1030 <vfork@plt>
test   %rax,%rax
je     113f <f5+0xf>
pop    %rax
ret
lea    0xeba(%rip),%rdi
lea    0xeb8(%rip),%rsi
xor    %edx,%edx
call   1050 <execl@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"prog\00"
@.str.1 = [5 x i8] c"arg1\00"
define void @f5() {
%1 = call i64 (...) @vfork()
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = call i32 @execl(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 0)
%5 = call i32 @exit(i32 1)
unreachable
6: ; preds = %0
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"prog\00"
@.str.1 = [5 x i8] c"arg1\00"
define void @f5() {
%1 = tail call i64 (...) @vfork()
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32 @execl(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 0)
%5 = tail call i32 @exit(i32 1)
unreachable
6: ; preds = %0
ret void
}
/* Type definitions */
struct plugin {
  int dummy;
};
struct command {
  int dummy;
};

/* Variables and functions */
int nvme_attach_ns(int, char **, int /*<<< orphan*/, char const *,
                   struct command *);
int detach_ns(int argc, char **argv, struct command *cmd,
              struct plugin *plugin) {
  const char *desc =
      "Detach the given namespace from the "
      "given controller; de-activates the given namespace's ID. A "
      "namespace must be attached to a controller before IO "
      "commands may be directed to that namespace.";
  return nvme_attach_ns(argc, argv, 0, desc, cmd);
}


x86 assembly (clang, -O0):
<detach_ns>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    0xed2(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%r8
xor    %edx,%edx
call   1030 <nvme_attach_ns@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<detach_ns>:
mov    %rdx,%r8
lea    0xee6(%rip),%rcx
xor    %edx,%edx
jmp    1030 <nvme_attach_ns@plt>

LLVM IR (-O0):
%struct.command = type { i32 }
%struct.plugin = type { i32 }
@.str = [192 x i8] c"Detach the given namespace from the given controller; de-activates the given namespace's ID. A namespace must be attached to a controller before IO commands may be directed to that namespace.\00"
define i32 @detach_ns(i32 %0, i8** %1, %struct.command* %2, %struct.plugin* %3) {
%5 = alloca i32
%6 = alloca i8**
%7 = alloca %struct.command*
%8 = alloca %struct.plugin*
%9 = alloca i8*
store i32 %0, i32* %5
store i8** %1, i8*** %6
store %struct.command* %2, %struct.command** %7
store %struct.plugin* %3, %struct.plugin** %8
store i8* getelementptr inbounds ([192 x i8], [192 x i8]* @.str, i64 0, i64 0), i8** %9
%10 = load i32, i32* %5
%11 = load i8**, i8*** %6
%12 = load i8*, i8** %9
%13 = load %struct.command*, %struct.command** %7
%14 = call i32 @nvme_attach_ns(i32 %10, i8** %11, i32 0, i8* %12, %struct.command* %13)
ret i32 %14
}

LLVM IR (-O2):
%struct.command = type { i32 }
%struct.plugin = type { i32 }
@.str = [192 x i8] c"Detach the given namespace from the given controller; de-activates the given namespace's ID. A namespace must be attached to a controller before IO commands may be directed to that namespace.\00"
define i32 @detach_ns(i32 %0, i8** %1, %struct.command* %2, %struct.plugin* nocapture readnone %3) {
%5 = tail call i32 @nvme_attach_ns(i32 %0, i8** %1, i32 0, i8* getelementptr inbounds ([192 x i8], [192 x i8]* @.str, i64 0, i64 0), %struct.command* %2)
ret i32 %5
}
/* Variables and functions */
long map(long, long, long, int /*<<< orphan*/, int);
long ind_map_cal(long val, long val_min, long val_max, int cal_max) {
  if (cal_max > 255)
    cal_max = 255;
  return map(val, val_min, val_max, 0, cal_max);
}


x86 assembly (clang, -O0):
<ind_map_cal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cmpl   $0xff,-0x1c(%rbp)
jle    113b <ind_map_cal+0x2b>
movl   $0xff,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%r8d
xor    %ecx,%ecx
call   1030 <map@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ind_map_cal>:
cmp    $0xff,%ecx
mov    $0xff,%r8d
cmovl  %ecx,%r8d
xor    %ecx,%ecx
jmp    1030 <map@plt>

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

LLVM IR (-O2):
define i64 @ind_map_cal(i64 %0, i64 %1, i64 %2, i32 %3) {
%5 = icmp slt i32 %3, 255
%6 = select i1 %5, i32 %3, i32 255
%7 = tail call i64 @map(i64 %0, i64 %1, i64 %2, i32 0, i32 %6)
ret i64 %7
}
int _count_bits(unsigned int val) {
  unsigned int count;
  for (count = 0; val; count++) {
    val &= val - 1;
  }
  return count;
}


x86 assembly (clang, -O0):
<_count_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1132 <_count_bits+0x32>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <_count_bits+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_count_bits>:
xor    %eax,%eax
test   %edi,%edi
je     111c <_count_bits+0x1c>
cs nopw 0x0(%rax,%rax,1)
lea    -0x1(%rdi),%ecx
add    $0x1,%eax
and    %edi,%ecx
mov    %ecx,%edi
jne    1110 <_count_bits+0x10>
ret

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

LLVM IR (-O2):
define i32 @_count_bits(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ 0, %1 ]
%5 = phi i32 [ %7, %3 ], [ %0, %1 ]
%6 = add i32 %5, -1
%7 = and i32 %6, %5
%8 = add i32 %4, 1
%9 = icmp eq i32 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %8, %3 ]
ret i32 %11
}
double svd_dmax(double a, double b) { return (a > b) ? a : b; }


x86 assembly (clang, -O0):
<svd_dmax>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    112d <svd_dmax+0x2d>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1137 <svd_dmax+0x37>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<svd_dmax>:
maxsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @svd_dmax(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
OPHANDLER(clr_c) { SET_CY(0); }


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

x86 assembly (clang, -O2):
<OPHANDLER>:
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <SET_CY@plt>

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

LLVM IR (-O2):
define i32 @OPHANDLER(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @SET_CY to i32 (i32, ...)*)(i32 0)
ret i32 undef
}
/* Variables and functions */
scalar_t__ fdmi_malloc(int);
int /*<<< orphan*/ putenv(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
void fdmi_param_set(char *name, char *value) {
  char *env;
  env = (char *)fdmi_malloc(1024);
  sprintf(env, "%s=%s", name, value);
  putenv(env);
  return;
}


x86 assembly (clang, -O0):
<fdmi_param_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x400,%edi
call   1030 <fdmi_malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe9f(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <putenv@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fdmi_param_set>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    $0x400,%edi
call   1030 <fdmi_malloc@plt>
mov    %rax,%rbx
lea    0xeb1(%rip),%rsi
mov    %rax,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1050 <sprintf@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <putenv@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%s=%s\00"
define void @fdmi_param_set(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = call i64 @fdmi_malloc(i32 1024)
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = load i8*, i8** %3
%10 = load i8*, i8** %4
%11 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %10)
%12 = load i8*, i8** %5
%13 = call i32 @putenv(i8* %12)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s=%s\00"
define void @fdmi_param_set(i8* %0, i8* %1) {
%3 = tail call i64 @fdmi_malloc(i32 1024)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32 @sprintf(i8* dereferenceable(1) %4, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%6 = tail call i32 @putenv(i8* %4)
ret void
}
int proc0() { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @proc0() {
ret i32 1
}
void func2() {
  int count = 0;
  for (count = 0; count < 0XFFFFF; count++)
    ;
  return;
}


x86 assembly (clang, -O0):
<func2>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0xfffff,-0x4(%rbp)
jge    1132 <func2+0x32>
jmp    1124 <func2+0x24>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1112 <func2+0x12>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @func2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ shared();
void func(void) {
  printf("func!\n");
  shared();
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <shared@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<func>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <shared@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"func!\0A\00"
define void @func() {
%1 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @shared()
ret void
}

LLVM IR (-O2):
@str = [6 x i8] c"func!\00"
define void @func() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @shared()
ret void
}
int test_imm_E1uint8_reg(unsigned char val) {
  return ((val) & (0xE1 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_E1uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -31
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int drand48();
double getRand() { return (drand48() * 1000); }


x86 assembly (clang, -O0):
<getRand>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <drand48@plt>
imul   $0x3e8,%eax,%eax
cvtsi2sd %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<getRand>:
push   %rax
xor    %eax,%eax
call   1030 <drand48@plt>
imul   $0x3e8,%eax,%eax
cvtsi2sd %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @getRand() {
%1 = call i32 (...) @drand48()
%2 = mul nsw i32 %1, 1000
%3 = sitofp i32 %2 to double
ret double %3
}

LLVM IR (-O2):
define double @getRand() {
%1 = tail call i32 (...) @drand48()
%2 = mul nsw i32 %1, 1000
%3 = sitofp i32 %2 to double
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void grpcsharp_completion_queue_pluck() {
  fprintf(stderr, "Should never reach here");
  abort();
}


x86 assembly (clang, -O0):
<grpcsharp_completion_queue_pluck>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<grpcsharp_completion_queue_pluck>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"Should never reach here\00"
define void @grpcsharp_completion_queue_pluck() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"Should never reach here\00"
define void @grpcsharp_completion_queue_pluck() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @abort()
unreachable
}
char GetStringTail(char *str) {
  while (str[1])
    str++;
  return *str;
}


x86 assembly (clang, -O0):
<GetStringTail>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,0x1(%rax)
je     1127 <GetStringTail+0x27>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <GetStringTail+0x8>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetStringTail>:
add    $0x1,%rdi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <GetStringTail+0x10>
mov    -0x2(%rdi),%al
ret

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

LLVM IR (-O2):
define signext i8 @GetStringTail(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %4, %2 ]
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
br i1 %6, label %7, label %2
7: ; preds = %2
%8 = load i8, i8* %3
ret i8 %8
}
void enterBleSysPatch(void) {}


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

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

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

LLVM IR (-O2):
define void @enterBleSysPatch() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
int main() {
  char line[1000];
  double sum, atof(char[]);
  int _getline(char l[], int m);
  sum = 0;
  while (_getline(line, 1000) > 0) {
    printf("\t%g\n", sum += atof(line));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x3f8(%rbp)
ff
lea    -0x3f0(%rbp),%rdi
mov    $0x3e8,%esi
call   1050 <_getline@plt>
cmp    $0x0,%eax
jle    1194 <main+0x64>
lea    -0x3f0(%rbp),%rdi
call   1030 <atof@plt>
addsd  -0x3f8(%rbp),%xmm0
ff
movsd  %xmm0,-0x3f8(%rbp)
ff
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
jmp    114d <main+0x1d>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x3f8,%rsp
lea    0x10(%rsp),%rdi
mov    $0x3e8,%esi
call   1050 <_getline@plt>
test   %eax,%eax
jle    11a5 <main+0x75>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0x10(%rsp),%rbx
lea    0xe9d(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
call   1030 <atof@plt>
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
mov    %r14,%rdi
movsd  %xmm1,0x8(%rsp)
movapd %xmm1,%xmm0
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1050 <_getline@plt>
test   %eax,%eax
jg     1170 <main+0x40>
xor    %eax,%eax
add    $0x3f8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"\09%g\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x i8]
%3 = alloca double
store i32 0, i32* %1
store double 0.000000e+00, double* %3
br label %4
4: ; preds = %8, %0
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%6 = call i32 @_getline(i8* %5, i32 1000)
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %4
%9 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%10 = call double @atof(i8* %9)
%11 = load double, double* %3
%12 = fadd double %11, %10
store double %12, double* %3
%13 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %12)
br label %4
14: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"\09%g\0A\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = call i32 @_getline(i8* %2, i32 1000)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %12
5: ; preds = %0, %5
%6 = phi double [ %8, %5 ], [ 0.000000e+00, %0 ]
%7 = call double @atof(i8* %2)
%8 = fadd double %6, %7
%9 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %8)
%10 = call i32 @_getline(i8* %2, i32 1000)
%11 = icmp sgt i32 %10, 0
br i1 %11, label %5, label %12
12: ; preds = %5, %0
ret i32 0
}
b() {}


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

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

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

LLVM IR (-O2):
define i32 @b() {
ret i32 undef
}
int radix_tree_exception(void *arg) { return ((unsigned long)arg & (1 | 2)); }


x86 assembly (clang, -O0):
<radix_tree_exception>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0x3,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<radix_tree_exception>:
mov    %rdi,%rax
and    $0x3,%eax
ret

LLVM IR (-O0):
define i32 @radix_tree_exception(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i64
%5 = and i64 %4, 3
%6 = trunc i64 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @radix_tree_exception(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = and i32 %3, 3
ret i32 %4
}
/* Type definitions */
struct timeval {
  double tv_sec;
  double tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/);
double now(void) {
  struct timeval tv;
  gettimeofday(&tv, 0);
  return tv.tv_sec + tv.tv_usec / 1000000.0;
}


x86 assembly (clang, -O0):
<now>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xecb(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<now>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movsd  0x10(%rsp),%xmm0
divsd  0xed2(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { double, double }
define double @now() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32 0)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load double, double* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%6 = load double, double* %5
%7 = fdiv double %6, 1.000000e+06
%8 = fadd double %4, %7
ret double %8
}

LLVM IR (-O2):
%struct.timeval = type { double, double }
define double @now() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32 0)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load double, double* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load double, double* %6
%8 = fdiv double %7, 1.000000e+06
%9 = fadd double %5, %8
ret double %9
}
float linear(float t, float b, float c, float d) { return c * t / d + b; }


x86 assembly (clang, -O0):
<linear>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
divss  -0x10(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<linear>:
mulss  %xmm2,%xmm0
divss  %xmm3,%xmm0
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @linear(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %7
%10 = load float, float* %5
%11 = fmul float %9, %10
%12 = load float, float* %8
%13 = fdiv float %11, %12
%14 = load float, float* %6
%15 = fadd float %13, %14
ret float %15
}

LLVM IR (-O2):
define float @linear(float %0, float %1, float %2, float %3) {
%5 = fmul float %0, %2
%6 = fdiv float %5, %3
%7 = fadd float %6, %1
ret float %7
}
int SWimp_Init(void *hInstance, void *wndProc) {}


x86 assembly (clang, -O0):
<SWimp_Init>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @SWimp_Init(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 undef
}
void INT_Excep_PERIB_INTB178(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_PERIB_INTB178() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
void echo() {
  char buffer[20];
  printf("Enter some text:\n");
  scanf("%s", buffer);
  printf("You entered: %s\n", buffer);
}


x86 assembly (clang, -O0):
<echo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    0xed1(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x20(%rbp),%rsi
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<echo>:
push   %rbx
sub    $0x20,%rsp
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
lea    0xea9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Enter some text:\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [17 x i8] c"You entered: %s\0A\00"
define void @echo() {
%1 = alloca [20 x i8]
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %5)
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [17 x i8] c"You entered: %s\0A\00"
@str = [17 x i8] c"Enter some text:\00"
define void @echo() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %2)
ret void
}
unsigned long long MTA_ROTATE_LEFT(unsigned long long x, unsigned long long y) {
  unsigned long long result;
  result = (x << y) | (x >> (64 - y));
  return result;
}


x86 assembly (clang, -O0):
<MTA_ROTATE_LEFT>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
shl    %cl,%rax
mov    -0x8(%rbp),%rdx
mov    $0x40,%ecx
sub    -0x10(%rbp),%rcx
shr    %cl,%rdx
mov    %rdx,%rcx
or     %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<MTA_ROTATE_LEFT>:
mov    %rsi,%rcx
mov    %rdi,%rax
rol    %cl,%rax
ret

LLVM IR (-O0):
define i64 @MTA_ROTATE_LEFT(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = shl i64 %6, %7
%9 = load i64, i64* %3
%10 = load i64, i64* %4
%11 = sub i64 64, %10
%12 = lshr i64 %9, %11
%13 = or i64 %8, %12
store i64 %13, i64* %5
%14 = load i64, i64* %5
ret i64 %14
}

LLVM IR (-O2):
define i64 @MTA_ROTATE_LEFT(i64 %0, i64 %1) {
%3 = shl i64 %0, %1
%4 = sub i64 64, %1
%5 = lshr i64 %0, %4
%6 = or i64 %5, %3
ret i64 %6
}
int TreeIntCompare(void *a, void *b, int content) {
  int i = *((int *)a);
  int j = *((int *)b);
  return (i > j) ? -1 : (i == j) ? 0 : 1;
}


x86 assembly (clang, -O0):
<TreeIntCompare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    113a <TreeIntCompare+0x3a>
mov    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    114f <TreeIntCompare+0x4f>
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%esi
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TreeIntCompare>:
mov    (%rdi),%eax
xor    %ecx,%ecx
cmp    (%rsi),%eax
setne  %cl
mov    $0xffffffff,%eax
cmovle %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @TreeIntCompare(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = bitcast i8* %0 to i32*
%5 = load i32, i32* %4
%6 = bitcast i8* %1 to i32*
%7 = load i32, i32* %6
%8 = icmp sgt i32 %5, %7
%9 = icmp ne i32 %5, %7
%10 = zext i1 %9 to i32
%11 = select i1 %8, i32 -1, i32 %10
ret i32 %11
}
void CheckErrorBlocks(void) { ; }


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

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

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

LLVM IR (-O2):
define void @CheckErrorBlocks() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
time_t c_time_() { return time(NULL); }


x86 assembly (clang, -O0):
<c_time_>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_time_>:
xor    %edi,%edi
jmp    1030 <time@plt>

LLVM IR (-O0):
define i32 @c_time_() {
%1 = call i32 @time(i32* null)
ret i32 %1
}

LLVM IR (-O2):
define i32 @c_time_() {
%1 = tail call i32 @time(i32* null)
ret i32 %1
}
int test_imm_80int32_mem(int *val) {
  return ((*val) & (0x80 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_80int32_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
and    $0x80,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_80int32_mem>:
testb  $0x80,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_80int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 128
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
uint16_t ntohs(uint16_t val) { return (val << 8) | (val >> 8); }


x86 assembly (clang, -O0):
<ntohs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
mov    -0x4(%rbp),%ecx
sar    $0x8,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ntohs>:
mov    %edi,%eax
shl    $0x8,%eax
sar    $0x8,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @ntohs(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 8
%5 = load i32, i32* %2
%6 = ashr i32 %5, 8
%7 = or i32 %4, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @ntohs(i32 %0) {
%2 = shl i32 %0, 8
%3 = ashr i32 %0, 8
%4 = or i32 %2, %3
ret i32 %4
}
/* Variables and functions */
scalar_t__ CallBack2(int, void *, void *);
const char *strrchr2(const char *str, int ch) {
  return (const char *)CallBack2(174, (void *)str, (void *)ch);
}


x86 assembly (clang, -O0):
<strrchr2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rdx
mov    $0xae,%edi
call   1030 <CallBack2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strrchr2>:
mov    %rdi,%rax
movslq %esi,%rdx
mov    $0xae,%edi
mov    %rax,%rsi
jmp    1030 <CallBack2@plt>

LLVM IR (-O0):
define i8* @strrchr2(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i8*
%9 = call i64 @CallBack2(i32 174, i8* %5, i8* %8)
%10 = inttoptr i64 %9 to i8*
ret i8* %10
}

LLVM IR (-O2):
define i8* @strrchr2(i8* %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = inttoptr i64 %3 to i8*
%5 = tail call i64 @CallBack2(i32 174, i8* %0, i8* %4)
%6 = inttoptr i64 %5 to i8*
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void *malloc(int);
int /*<<< orphan*/ printf(char *);
void *safe_malloc(int s) {
  void *ptr = malloc(s);
  if (ptr == NULL) {
    printf("Out of memory.");
    exit(-1);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<safe_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1168 <safe_malloc+0x38>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_malloc>:
push   %rax
call   1040 <malloc@plt>
test   %rax,%rax
je     113d <safe_malloc+0xd>
pop    %rcx
ret
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"Out of memory.\00"
define i8* @safe_malloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 -1)
unreachable
11: ; preds = %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@.str = [15 x i8] c"Out of memory.\00"
define noalias i8* @safe_malloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 -1)
unreachable
7: ; preds = %1
ret i8* %2
}
/* Type definitions */
struct dirent {
  int dummy;
};

/* Variables and functions */
int curslen(struct dirent **files) {
  int i = 0;
  struct dirent **ptr;
  for (ptr = files; *ptr != NULL; ++ptr) {
    ++i;
  }
  return i;
}


x86 assembly (clang, -O0):
<curslen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     113f <curslen+0x3f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
jmp    1117 <curslen+0x17>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<curslen>:
cmpq   $0x0,(%rdi)
je     111d <curslen+0x1d>
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
cmpq   $0x0,0x8(%rdi,%rax,8)
lea    0x1(%rax),%rax
jne    1110 <curslen+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.dirent = type { i32 }
define i32 @curslen(%struct.dirent** %0) {
%2 = alloca %struct.dirent**
%3 = alloca i32
%4 = alloca %struct.dirent**
store %struct.dirent** %0, %struct.dirent*** %2
store i32 0, i32* %3
%5 = load %struct.dirent**, %struct.dirent*** %2
store %struct.dirent** %5, %struct.dirent*** %4
br label %6
6: ; preds = %13, %1
%7 = load %struct.dirent**, %struct.dirent*** %4
%8 = load %struct.dirent*, %struct.dirent** %7
%9 = icmp ne %struct.dirent* %8, null
br i1 %9, label %10, label %16
10: ; preds = %6
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
br label %13
13: ; preds = %10
%14 = load %struct.dirent**, %struct.dirent*** %4
%15 = getelementptr inbounds %struct.dirent*, %struct.dirent** %14, i32 1
store %struct.dirent** %15, %struct.dirent*** %4
br label %6
16: ; preds = %6
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
%struct.dirent = type { i32 }
define i32 @curslen(%struct.dirent** nocapture %0) {
%2 = load %struct.dirent*, %struct.dirent** %0
%3 = icmp eq %struct.dirent* %2, null
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi %struct.dirent** [ %8, %4 ], [ %0, %1 ]
%6 = phi i32 [ %7, %4 ], [ 0, %1 ]
%7 = add nuw nsw i32 %6, 1
%8 = getelementptr inbounds %struct.dirent*, %struct.dirent** %5, i64 1
%9 = load %struct.dirent*, %struct.dirent** %8
%10 = icmp eq %struct.dirent* %9, null
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %12
}
/* Variables and functions */
int getLine(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ removeComments(char *, int);
int main() {
  int len;
  char line[1000];
  while ((len = getLine(line, 1000)) > 0) {
    removeComments(line, len);
    printf("%s", line);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3f0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rdi
mov    $0x3e8,%esi
call   1050 <getLine@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    1186 <main+0x56>
lea    -0x3f0(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <removeComments@plt>
lea    -0x3f0(%rbp),%rsi
lea    0xe84(%rip),%rdi
call   1040 <printf@plt>
jmp    1142 <main+0x12>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x3e8,%rsp
mov    %rsp,%rdi
mov    $0x3e8,%esi
call   1050 <getLine@plt>
test   %eax,%eax
jle    1186 <main+0x56>
mov    %rsp,%rbx
lea    0xeab(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <removeComments@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1050 <getLine@plt>
test   %eax,%eax
jg     1160 <main+0x30>
xor    %eax,%eax
add    $0x3e8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [1000 x i8]
store i32 0, i32* %1
br label %4
4: ; preds = %8, %0
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%6 = call i32 @getLine(i8* %5, i32 1000)
store i32 %6, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %4
%9 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%10 = load i32, i32* %2
%11 = call i32 @removeComments(i8* %9, i32 %10)
%12 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%13 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %4
14: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = call i32 @getLine(i8* %2, i32 1000)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %0, %5
%6 = phi i32 [ %9, %5 ], [ %3, %0 ]
%7 = call i32 @removeComments(i8* %2, i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%9 = call i32 @getLine(i8* %2, i32 1000)
%10 = icmp sgt i32 %9, 0
br i1 %10, label %5, label %11
11: ; preds = %5, %0
ret i32 0
}