xunge/DecIR huggingface dataset:
void reverse(char s[], int first, int last) {
  void swap(char[], int, int);
  if (first < last) {
    swap(s, first, last);
    reverse(s, first + 1, last - 1);
  }
}


x86 assembly (clang, -O0):
<reverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1162 <reverse+0x42>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <swap@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
call   1030 <reverse@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse>:
push   %rbp
push   %r14
push   %rbx
cmp    %edx,%esi
jge    1136 <reverse+0x26>
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rdi,%r14
nop
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <swap@plt>
add    $0x1,%ebp
add    $0xffffffff,%ebx
cmp    %ebx,%ebp
jl     1120 <reverse+0x10>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @reverse(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
%7 = load i32, i32* %5
%8 = load i32, i32* %6
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %19
10: ; preds = %3
%11 = load i8*, i8** %4
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = load i8*, i8** %4
%15 = load i32, i32* %5
%16 = add nsw i32 %15, 1
%17 = load i32, i32* %6
%18 = sub nsw i32 %17, 1
br label %19
19: ; preds = %10, %3
ret void
}

LLVM IR (-O2):
define void @reverse(i8* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %2, %3 ]
%7 = phi i32 [ %8, %5 ], [ %1, %3 ]
tail call void @swap(i8* %0, i32 %7, i32 %6)
%8 = add nsw i32 %7, 1
%9 = add nsw i32 %6, -1
%10 = icmp slt i32 %8, %9
br i1 %10, label %5, label %11
11: ; preds = %5, %3
ret void
}
int tc_uidx_main(void) {}


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

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

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

LLVM IR (-O2):
define i32 @tc_uidx_main() {
ret i32 undef
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
bool SysCtlPeripheralPresent(uint32_t ui32Peripheral) {
  ;
  return ((*(
      (volatile unsigned long
           *)(((unsigned long)(0x400fe300 + ((ui32Peripheral & 0xff00) >> 8)) &
               0xF0000000) |
              0x02000000 |
              (((unsigned long)(0x400fe300 + ((ui32Peripheral & 0xff00) >> 8)) &
                0x000FFFFF)
               << 5) |
              ((ui32Peripheral & 0xff) << 2)))));
}


x86 assembly (clang, -O0):
<SysCtlPeripheralPresent>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
add    $0x400fe300,%eax
cltq
movabs $0xf0000000,%rcx
and    %rcx,%rax
or     $0x2000000,%rax
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
add    $0x400fe300,%ecx
movslq %ecx,%rcx
and    $0xfffff,%rcx
shl    $0x5,%rcx
or     %rcx,%rax
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
or     %rcx,%rax
mov    (%rax),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysCtlPeripheralPresent>:
movzbl %dil,%eax
shr    $0x3,%edi
and    $0x1fe0,%edi
shl    $0x2,%eax
or     %edi,%eax
mov    0x43fc6000(%rax),%rax
ret

LLVM IR (-O0):
define i32 @SysCtlPeripheralPresent(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 65280
%5 = ashr i32 %4, 8
%6 = add nsw i32 1074782976, %5
%7 = sext i32 %6 to i64
%8 = and i64 %7, 4026531840
%9 = or i64 %8, 33554432
%10 = load i32, i32* %2
%11 = and i32 %10, 65280
%12 = ashr i32 %11, 8
%13 = add nsw i32 1074782976, %12
%14 = sext i32 %13 to i64
%15 = and i64 %14, 1048575
%16 = shl i64 %15, 5
%17 = or i64 %9, %16
%18 = load i32, i32* %2
%19 = and i32 %18, 255
%20 = shl i32 %19, 2
%21 = sext i32 %20 to i64
%22 = or i64 %17, %21
%23 = inttoptr i64 %22 to i64*
%24 = load volatile i64, i64* %23
%25 = trunc i64 %24 to i32
ret i32 %25
}

LLVM IR (-O2):
define i32 @SysCtlPeripheralPresent(i32 %0) {
%2 = lshr i32 %0, 3
%3 = and i32 %2, 8160
%4 = shl i32 %0, 2
%5 = and i32 %4, 1020
%6 = or i32 %5, %3
%7 = or i32 %6, 1140613120
%8 = zext i32 %7 to i64
%9 = inttoptr i64 %8 to i64*
%10 = load volatile i64, i64* %9
%11 = trunc i64 %10 to i32
ret i32 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};
typedef int /*<<< orphan*/ buffer;

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
char *ctimeStr(void) {
  static char buffer[26];
  time_t timer;
  struct tm *tmInfo;
  time(&timer);
  tmInfo = localtime(&timer);
  strftime(buffer, sizeof(buffer), "%H:%M:%S", tmInfo);
  return buffer;
}


x86 assembly (clang, -O0):
<ctimeStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1040 <time@plt>
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
lea    0x2ef7(%rip),%rdi
mov    $0x1a,%esi
lea    0xe9b(%rip),%rdx
call   1050 <strftime@plt>
lea    0x2edf(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ctimeStr>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
lea    0x2eff(%rip),%rbx
lea    0xea8(%rip),%rdx
mov    %rbx,%rdi
mov    $0x1a,%esi
mov    %rax,%rcx
call   1050 <strftime@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@ctimeStr.buffer = internal global [26 x i8] zeroinitializer
@.str = [9 x i8] c"%H:%M:%S\00"
define i8* @ctimeStr() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = call i32 @time(i32* %1)
%4 = call %struct.tm* @localtime(i32* %1)
store %struct.tm* %4, %struct.tm** %2
%5 = load %struct.tm*, %struct.tm** %2
%6 = call i32 @strftime(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @ctimeStr.buffer, i64 0, i64 0), i32 26, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %struct.tm* %5)
ret i8* getelementptr inbounds ([26 x i8], [26 x i8]* @ctimeStr.buffer, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@ctimeStr.buffer = internal global [26 x i8] zeroinitializer
@.str = [9 x i8] c"%H:%M:%S\00"
define i8* @ctimeStr() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @time(i32* %1)
%4 = call %struct.tm* @localtime(i32* %1)
%5 = call i32 @strftime(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @ctimeStr.buffer, i64 0, i64 0), i32 26, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %struct.tm* %4)
ret i8* getelementptr inbounds ([26 x i8], [26 x i8]* @ctimeStr.buffer, i64 0, i64 0)
}
/* Variables and functions */
int rand();
int my_rand(int nr) { return rand() % nr; }


x86 assembly (clang, -O0):
<my_rand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_rand>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @my_rand(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @rand()
%4 = load i32, i32* %2
%5 = srem i32 %3, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @my_rand(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, %0
ret i32 %3
}
int fib(int n) {
  if (n == 0 || n == 1)
    return 1;
  return fib(n - 1) + fib(n - 2);
}


x86 assembly (clang, -O0):
<fib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112f <fib+0x1f>
cmpl   $0x1,-0x8(%rbp)
jne    113b <fib+0x2b>
movl   $0x1,-0x4(%rbp)
jmp    115e <fib+0x4e>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <fib@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <fib@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebp
cmp    $0x2,%edi
jb     1145 <fib+0x35>
mov    %edi,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    -0x1(%rbx),%edi
call   1030 <fib@plt>
add    $0xfffffffe,%ebx
add    %eax,%ebp
cmp    $0x1,%ebx
ja     1130 <fib+0x20>
add    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fib(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %13, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ %0, %1 ]
%5 = phi i32 [ %9, %3 ], [ 0, %1 ]
%6 = add nsw i32 %4, -1
%7 = tail call i32 @fib(i32 %6)
%8 = add nsw i32 %4, -2
%9 = add nsw i32 %7, %5
%10 = icmp ult i32 %8, 2
br i1 %10, label %11, label %3
11: ; preds = %3
%12 = add i32 %9, 1
br label %13
13: ; preds = %11, %1
%14 = phi i32 [ 1, %1 ], [ %12, %11 ]
ret i32 %14
}
int main() {
  int n = 0;
  int b = 2 / n;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    $0x2,%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void on_sudirribe(struct mosquitto *m, void *udata, int mid, int qos_count,
                  const int *granted_qos) {
  ;
}


x86 assembly (clang, -O0):
<on_sudirribe>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.mosquitto = type opaque
define void @on_sudirribe(%struct.mosquitto* %0, i8* %1, i32 %2, i32 %3, i32* %4) {
%6 = alloca %struct.mosquitto*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
store %struct.mosquitto* %0, %struct.mosquitto** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32* %4, i32** %10
ret void
}

LLVM IR (-O2):
%struct.mosquitto = type opaque
define void @on_sudirribe(%struct.mosquitto* nocapture %0, i8* nocapture %1, i32 %2, i32 %3, i32* nocapture %4) {
ret void
}
p2dig(i) register int i;
{ shprintf("%d%d", i / 10, i % 10); }


x86 assembly (clang, -O0):
<p2dig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <shprintf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<p2dig>:
movslq %edi,%rdx
imul   $0x66666667,%rdx,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x22,%rsi
add    %eax,%esi
lea    (%rsi,%rsi,1),%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edx
lea    0xeca(%rip),%rdi
xor    %eax,%eax
jmp    1030 <shprintf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%d%d\00"
define i32 @p2dig(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = sdiv i32 %4, 10
%6 = load i32, i32* %3
%7 = srem i32 %6, 10
%8 = call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @shprintf to i32 (i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %7)
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d%d\00"
define i32 @p2dig(i32 %0) {
%2 = sdiv i32 %0, 10
%3 = srem i32 %0, 10
%4 = tail call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @shprintf to i32 (i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3)
ret i32 undef
}
int qsort_cmp_LONG(const void *x, const void *y) {
  if (*((long long *)x) < *((long long *)y))
    return (-1);
  else
    return (*((long long *)x) > *((long long *)y));
}


x86 assembly (clang, -O0):
<qsort_cmp_LONG>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%rax
jge    112c <qsort_cmp_LONG+0x2c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1145 <qsort_cmp_LONG+0x45>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<qsort_cmp_LONG>:
mov    (%rdi),%rax
xor    %ecx,%ecx
cmp    (%rsi),%rax
setg   %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @qsort_cmp_LONG(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = load i64, i64* %3
%5 = bitcast i8* %1 to i64*
%6 = load i64, i64* %5
%7 = icmp slt i64 %4, %6
%8 = icmp sgt i64 %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ setuid(int /*<<< orphan*/);
int /*<<< orphan*/ system(char *);
int main(int argc, char *argv[]) {
  setuid(0);
  system(argv[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
call   1040 <setuid@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
xor    %edi,%edi
call   1040 <setuid@plt>
mov    0x8(%rbx),%rdi
call   1030 <system@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @setuid(i32 0)
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = call i32 @system(i8* %9)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @setuid(i32 0)
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 @system(i8* %5)
ret i32 0
}
int check_equal(long double res, long double expected) {
  if (res != expected) {
    return 0;
  }
  return (__builtin_copysignl(1.0L, res) ==
          __builtin_copysignl(1.0L, expected));
}


x86 assembly (clang, -O0):
<check_equal>:
push   %rbp
mov    %rsp,%rbp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x20(%rbp)
fstpt  -0x30(%rbp)
fldt   -0x20(%rbp)
fldt   -0x30(%rbp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jne    112d <check_equal+0x2d>
jp     112d <check_equal+0x2d>
jmp    1139 <check_equal+0x39>
movl   $0x0,-0x4(%rbp)
jmp    1175 <check_equal+0x75>
fldt   -0x20(%rbp)
fstpt  -0x50(%rbp)
mov    -0x47(%rbp),%al
test   $0x80,%al
fld1
fld    %st(0)
fchs
fld    %st(1)
fcmovne %st(1),%st
fldt   -0x30(%rbp)
fstpt  -0x40(%rbp)
mov    -0x37(%rbp),%al
test   $0x80,%al
fxch   %st(2)
fcmovne %st(1),%st
fstp   %st(1)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
setnp  %cl
sete   %al
and    %cl,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_equal>:
fldt   0x18(%rsp)
fldt   0x8(%rsp)
xor    %eax,%eax
fucomi %st(1),%st
jne    1149 <check_equal+0x49>
jp     1149 <check_equal+0x49>
fstpt  -0x28(%rsp)
testb  $0x80,-0x1f(%rsp)
fld1
fld    %st(0)
fchs
fld    %st(1)
fcmovne %st(1),%st
fxch   %st(3)
fstpt  -0x18(%rsp)
testb  $0x80,-0xf(%rsp)
fxch   %st(1)
fcmovne %st(1),%st
fstp   %st(1)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
setnp  %al
sete   %cl
and    %al,%cl
movzbl %cl,%eax
fldz
fldz
fstp   %st(1)
fstp   %st(0)
ret

LLVM IR (-O0):
define i32 @check_equal(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca i32
%4 = alloca x86_fp80
%5 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %4
store x86_fp80 %1, x86_fp80* %5
%6 = load x86_fp80, x86_fp80* %4
%7 = load x86_fp80, x86_fp80* %5
%8 = fcmp une x86_fp80 %6, %7
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 0, i32* %3
br label %17
10: ; preds = %2
%11 = load x86_fp80, x86_fp80* %4
%12 = call x86_fp80 @llvm.copysign.f80(x86_fp80 0xK3FFF8000000000000000, x86_fp80 %11)
%13 = load x86_fp80, x86_fp80* %5
%14 = call x86_fp80 @llvm.copysign.f80(x86_fp80 0xK3FFF8000000000000000, x86_fp80 %13)
%15 = fcmp oeq x86_fp80 %12, %14
%16 = zext i1 %15 to i32
store i32 %16, i32* %3
br label %17
17: ; preds = %10, %9
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @check_equal(x86_fp80 %0, x86_fp80 %1) {
%3 = fcmp une x86_fp80 %0, %1
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = tail call x86_fp80 @llvm.copysign.f80(x86_fp80 0xK3FFF8000000000000000, x86_fp80 %0)
%6 = tail call x86_fp80 @llvm.copysign.f80(x86_fp80 0xK3FFF8000000000000000, x86_fp80 %1)
%7 = fcmp oeq x86_fp80 %5, %6
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %2, %4
%10 = phi i32 [ %8, %4 ], [ 0, %2 ]
ret i32 %10
}
/* Variables and functions */
int _internal_login_tty(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                        int /*<<< orphan*/ *);
int login_tty(int fd) { return _internal_login_tty(fd, NULL, NULL, NULL); }


x86 assembly (clang, -O0):
<login_tty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rcx,%rsi
mov    %rcx,%rdx
call   1030 <_internal_login_tty@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<login_tty>:
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <_internal_login_tty@plt>

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

LLVM IR (-O2):
define i32 @login_tty(i32 %0) {
%2 = tail call i32 @_internal_login_tty(i32 %0, i32* null, i32* null, i32* null)
ret i32 %2
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t mp_sizeof_bool(bool val) {
  (void)val;
  return 1;
}


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

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

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

LLVM IR (-O2):
define i32 @mp_sizeof_bool(i32 %0) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Hello,C Word! \n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@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 = [16 x i8] c"Hello,C Word! \0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [15 x i8] c"Hello,C Word! \00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct ptr_list {
  int dummy;
};
struct basic_block_list {
  int dummy;
};

/* Variables and functions */
int ptr_list_size(struct ptr_list *);
int bb_list_size(struct basic_block_list *list) {
  return ptr_list_size((struct ptr_list *)(list));
}


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

x86 assembly (clang, -O2):
<bb_list_size>:
jmp    1030 <ptr_list_size@plt>

LLVM IR (-O0):
%struct.basic_block_list = type { i32 }
%struct.ptr_list = type { i32 }
define i32 @bb_list_size(%struct.basic_block_list* %0) {
%2 = alloca %struct.basic_block_list*
store %struct.basic_block_list* %0, %struct.basic_block_list** %2
%3 = load %struct.basic_block_list*, %struct.basic_block_list** %2
%4 = bitcast %struct.basic_block_list* %3 to %struct.ptr_list*
%5 = call i32 @ptr_list_size(%struct.ptr_list* %4)
ret i32 %5
}

LLVM IR (-O2):
%struct.basic_block_list = type { i32 }
%struct.ptr_list = type { i32 }
define i32 @bb_list_size(%struct.basic_block_list* %0) {
%2 = bitcast %struct.basic_block_list* %0 to %struct.ptr_list*
%3 = tail call i32 @ptr_list_size(%struct.ptr_list* %2)
ret i32 %3
}
int function_c(int n) { return n <= 0 ? 1 : function_c(n / 3) + 1; }


x86 assembly (clang, -O0):
<function_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     1132 <function_c+0x22>
mov    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114a <function_c+0x3a>
mov    -0x4(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <function_c@plt>
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<function_c>:
mov    $0x1,%eax
test   %edi,%edi
jle    1124 <function_c+0x24>
mov    $0xaaaaaaab,%ecx
xchg   %ax,%ax
mov    %edi,%edx
imul   %rcx,%rdx
shr    $0x21,%rdx
add    $0x1,%eax
cmp    $0x2,%edi
mov    %edx,%edi
ja     1110 <function_c+0x10>
ret

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

LLVM IR (-O2):
define i32 @function_c(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ %0, %1 ]
%5 = phi i32 [ %7, %3 ], [ 0, %1 ]
%6 = udiv i32 %4, 3
%7 = add nuw nsw i32 %5, 1
%8 = icmp ult i32 %4, 3
br i1 %8, label %9, label %3
9: ; preds = %3
%10 = add nuw i32 %5, 2
br label %11
11: ; preds = %9, %1
%12 = phi i32 [ 1, %1 ], [ %10, %9 ]
ret i32 %12
}
void BinaryOperators(int a, int b) {
  a || b;
  a &&b;
  a | b;
  a ^ b;
  a &b;
  a == b;
  a != b;
  a < b;
  a > b;
  a <= b;
  a >= b;
  a << b;
  a >> b;
  a + b;
  a - b;
  a *b;
  a / b;
  a % b;
}


x86 assembly (clang, -O0):
<BinaryOperators>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x9(%rbp)
jne    1123 <BinaryOperators+0x23>
cmpl   $0x0,-0x8(%rbp)
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0xa(%rbp)
je     113f <BinaryOperators+0x3f>
cmpl   $0x0,-0x8(%rbp)
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
pop    %rbp
ret

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

LLVM IR (-O0):
define void @BinaryOperators(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 0
br label %10
10: ; preds = %7, %2
%11 = phi i1 [ true, %2 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
%13 = load i32, i32* %3
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %10
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 0
br label %18
18: ; preds = %15, %10
%19 = phi i1 [ false, %10 ], [ %17, %15 ]
%20 = zext i1 %19 to i32
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = or i32 %21, %22
%24 = load i32, i32* %3
%25 = load i32, i32* %4
%26 = xor i32 %24, %25
%27 = load i32, i32* %3
%28 = load i32, i32* %4
%29 = and i32 %27, %28
%30 = load i32, i32* %3
%31 = load i32, i32* %4
%32 = icmp eq i32 %30, %31
%33 = zext i1 %32 to i32
%34 = load i32, i32* %3
%35 = load i32, i32* %4
%36 = icmp ne i32 %34, %35
%37 = zext i1 %36 to i32
%38 = load i32, i32* %3
%39 = load i32, i32* %4
%40 = icmp slt i32 %38, %39
%41 = zext i1 %40 to i32
%42 = load i32, i32* %3
%43 = load i32, i32* %4
%44 = icmp sgt i32 %42, %43
%45 = zext i1 %44 to i32
%46 = load i32, i32* %3
%47 = load i32, i32* %4
%48 = icmp sle i32 %46, %47
%49 = zext i1 %48 to i32
%50 = load i32, i32* %3
%51 = load i32, i32* %4
%52 = icmp sge i32 %50, %51
%53 = zext i1 %52 to i32
%54 = load i32, i32* %3
%55 = load i32, i32* %4
%56 = shl i32 %54, %55
%57 = load i32, i32* %3
%58 = load i32, i32* %4
%59 = ashr i32 %57, %58
%60 = load i32, i32* %3
%61 = load i32, i32* %4
%62 = add nsw i32 %60, %61
%63 = load i32, i32* %3
%64 = load i32, i32* %4
%65 = sub nsw i32 %63, %64
%66 = load i32, i32* %3
%67 = load i32, i32* %4
%68 = mul nsw i32 %66, %67
%69 = load i32, i32* %3
%70 = load i32, i32* %4
%71 = sdiv i32 %69, %70
%72 = load i32, i32* %3
%73 = load i32, i32* %4
%74 = srem i32 %72, %73
ret void
}

LLVM IR (-O2):
define void @BinaryOperators(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void fn_4parms(unsigned char a, long *b, long *c, unsigned int *d) {
  if (*b != 1 || *c != 2 || *d != 3)
    abort();
}


x86 assembly (clang, -O0):
<fn_4parms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x1,(%rax)
jne    1153 <fn_4parms+0x43>
mov    -0x18(%rbp),%rax
cmpq   $0x2,(%rax)
jne    1153 <fn_4parms+0x43>
mov    -0x20(%rbp),%rax
cmpl   $0x3,(%rax)
je     115a <fn_4parms+0x4a>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn_4parms>:
push   %rax
cmpq   $0x1,(%rsi)
jne    1124 <fn_4parms+0x14>
cmpq   $0x2,(%rdx)
jne    1124 <fn_4parms+0x14>
cmpl   $0x3,(%rcx)
jne    1124 <fn_4parms+0x14>
pop    %rax
ret
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define void @fn_4parms(i8 zeroext %0, i64* nocapture %1, i64* nocapture %2, i32* nocapture %3) {
%5 = load i64, i64* %1
%6 = icmp eq i64 %5, 1
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = load i64, i64* %2
%9 = icmp eq i64 %8, 2
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 3
br i1 %12, label %15, label %13
13: ; preds = %10, %7, %4
%14 = tail call i32 (...) @abort()
unreachable
15: ; preds = %10
ret void
}
/* Variables and functions */
int /*<<< orphan*/ HF_strncmp(char const *, char const *, size_t,
                              int /*<<< orphan*/, uintptr_t);
int /*<<< orphan*/ instrumentConstAvail();
void __sanitizer_weak_hook_strncmp(uintptr_t pc, const char *s1, const char *s2,
                                   size_t n,
                                   int result __attribute__((unused))) {
  HF_strncmp(s1, s2, n, instrumentConstAvail(), pc);
}


x86 assembly (clang, -O0):
<__sanitizer_weak_hook_strncmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    $0x0,%al
call   1040 <instrumentConstAvail@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    %eax,%ecx
mov    -0x8(%rbp),%r8
call   1030 <HF_strncmp@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__sanitizer_weak_hook_strncmp>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r12
xor    %eax,%eax
call   1040 <instrumentConstAvail@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    %eax,%ecx
mov    %r12,%r8
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <HF_strncmp@plt>

LLVM IR (-O0):
define void @__sanitizer_weak_hook_strncmp(i64 %0, i8* %1, i8* %2, i64 %3, i32 %4) {
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
store i64 %0, i64* %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i64 %3, i64* %9
store i32 %4, i32* %10
%11 = load i8*, i8** %7
%12 = load i8*, i8** %8
%13 = load i64, i64* %9
%14 = call i32 (...) @instrumentConstAvail()
%15 = load i64, i64* %6
%16 = call i32 @HF_strncmp(i8* %11, i8* %12, i64 %13, i32 %14, i64 %15)
ret void
}

LLVM IR (-O2):
define void @__sanitizer_weak_hook_strncmp(i64 %0, i8* %1, i8* %2, i64 %3, i32 %4) {
%6 = tail call i32 (...) @instrumentConstAvail()
%7 = tail call i32 @HF_strncmp(i8* %1, i8* %2, i64 %3, i32 %6, i64 %0)
ret void
}
/* Variables and functions */
char *getenv(char const *);
const char *getenv_s(const char *name) {
  char *r = getenv(name);
  if (r == NULL)
    r = "";
  return r;
}


x86 assembly (clang, -O0):
<getenv_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    113f <getenv_s+0x2f>
lea    0xec5(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getenv_s>:
push   %rax
call   1030 <getenv@plt>
test   %rax,%rax
lea    0xee0(%rip),%rcx
cmove  %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @getenv_s(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @getenv(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %9
8: ; preds = %1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %3
br label %9
9: ; preds = %8, %1
%10 = load i8*, i8** %3
ret i8* %10
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @getenv_s(i8* nocapture %0) {
%2 = tail call i8* @getenv(i8* %0)
%3 = icmp eq i8* %2, null
%4 = select i1 %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %2
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void jdns_free(void *p) { free(p); }


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

LLVM IR (-O0):
define void @jdns_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 @jdns_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
int odd_ones(unsigned x) {
  x ^= (x >> 16);
  x ^= (x >> 8);
  x ^= (x >> 4);
  x ^= (x >> 2);
  x ^= (x >> 1);
  return x;
}


x86 assembly (clang, -O0):
<odd_ones>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x4,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x2,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<odd_ones>:
mov    %edi,%eax
shr    $0x10,%eax
xor    %edi,%eax
mov    %eax,%ecx
shr    $0x8,%ecx
xor    %eax,%ecx
mov    %ecx,%eax
shr    $0x4,%eax
xor    %ecx,%eax
mov    %eax,%ecx
shr    $0x2,%ecx
xor    %eax,%ecx
mov    %ecx,%eax
shr    %eax
xor    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @odd_ones(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = lshr i32 %3, 16
%5 = load i32, i32* %2
%6 = xor i32 %5, %4
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = lshr i32 %7, 8
%9 = load i32, i32* %2
%10 = xor i32 %9, %8
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = lshr i32 %11, 4
%13 = load i32, i32* %2
%14 = xor i32 %13, %12
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = lshr i32 %15, 2
%17 = load i32, i32* %2
%18 = xor i32 %17, %16
store i32 %18, i32* %2
%19 = load i32, i32* %2
%20 = lshr i32 %19, 1
%21 = load i32, i32* %2
%22 = xor i32 %21, %20
store i32 %22, i32* %2
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @odd_ones(i32 %0) {
%2 = lshr i32 %0, 16
%3 = xor i32 %2, %0
%4 = lshr i32 %3, 8
%5 = xor i32 %4, %3
%6 = lshr i32 %5, 4
%7 = xor i32 %6, %5
%8 = lshr i32 %7, 2
%9 = xor i32 %8, %7
%10 = lshr i32 %9, 1
%11 = xor i32 %10, %9
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
int *malloc(int);
void fun() {
  int *n;
  n = malloc(sizeof(int));
  free(n);
}


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

x86 assembly (clang, -O2):
<fun>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
pop    %rax
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @fun() {
%1 = tail call i32* @malloc(i32 4)
%2 = tail call i32 @free(i32* %1)
ret void
}
int sorted(int *buf, int len) {
  for (int i = 1; i < len; i++) {
    if (buf[i - 1] > buf[i])
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<sorted>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    115e <sorted+0x5e>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x10(%rbp),%rcx
movslq -0x18(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jle    114b <sorted+0x4b>
movl   $0x0,-0x4(%rbp)
jmp    1165 <sorted+0x65>
jmp    1150 <sorted+0x50>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <sorted+0x12>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sorted>:
mov    $0x1,%eax
cmp    $0x2,%esi
jl     113d <sorted+0x3d>
mov    0x4(%rdi),%edx
xor    %eax,%eax
cmp    %edx,(%rdi)
jg     113d <sorted+0x3d>
mov    %esi,%r8d
mov    $0x2,%eax
nopl   0x0(%rax,%rax,1)
mov    %rax,%rsi
cmp    %rax,%r8
je     1135 <sorted+0x35>
mov    (%rdi,%rsi,4),%ecx
lea    0x1(%rsi),%rax
cmp    %ecx,%edx
mov    %ecx,%edx
jle    1120 <sorted+0x20>
xor    %eax,%eax
cmp    %r8,%rsi
setae  %al
ret

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

LLVM IR (-O2):
define i32 @sorted(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %4, label %23
4: ; preds = %2
%5 = zext i32 %1 to i64
%6 = zext i32 %1 to i64
%7 = load i32, i32* %0
%8 = getelementptr inbounds i32, i32* %0, i64 1
%9 = load i32, i32* %8
%10 = icmp sgt i32 %7, %9
br i1 %10, label %23, label %11
11: ; preds = %4, %15
%12 = phi i64 [ %19, %15 ], [ 2, %4 ]
%13 = phi i32 [ %17, %15 ], [ %9, %4 ]
%14 = icmp eq i64 %12, %6
br i1 %14, label %20, label %15
15: ; preds = %11
%16 = getelementptr inbounds i32, i32* %0, i64 %12
%17 = load i32, i32* %16
%18 = icmp sgt i32 %13, %17
%19 = add nuw nsw i64 %12, 1
br i1 %18, label %20, label %11
20: ; preds = %11, %15
%21 = icmp uge i64 %12, %5
%22 = zext i1 %21 to i32
br label %23
23: ; preds = %20, %4, %2
%24 = phi i32 [ 1, %2 ], [ 0, %4 ], [ %22, %20 ]
ret i32 %24
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage_license(void) {
  printf("memqd"
         " "
         "1.0.1"
         "\n\n");
  printf("Copyright (c) 2008, Roast. <http://www.libing.name/>\n"
         "All rights reserved.\n"
         "\n");
  return;
}


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

x86 assembly (clang, -O2):
<usage_license>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee9(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"memqd 1.0.1\0A\0A\00"
@.str.1 = [76 x i8] c"Copyright (c) 2008, Roast. <http://www.libing.name/>\0AAll rights reserved.\0A\0A\00"
define void @usage_license() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [13 x i8] c"memqd 1.0.1\0A\00"
@str.2 = [75 x i8] c"Copyright (c) 2008, Roast. <http://www.libing.name/>\0AAll rights reserved.\0A\00"
define void @usage_license() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ handle_USR2(int /*<<< orphan*/);
int gen_USR2() {
  handle_USR2(0);
  return 0;
}


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

x86 assembly (clang, -O2):
<gen_USR2>:
push   %rax
xor    %edi,%edi
call   1030 <handle_USR2@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @gen_USR2() {
%1 = call i32 @handle_USR2(i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @gen_USR2() {
%1 = tail call i32 @handle_USR2(i32 0)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int read_le_short(FILE *file, short *ret) {
  unsigned char buf[2];
  if (fread(buf, 1, 2, file) != 2)
    return 0;
  *ret = (buf[1] << 8) | buf[0];
  return 0;
}


x86 assembly (clang, -O0):
<read_le_short>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x1a(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <fread@plt>
cmp    $0x2,%eax
je     114c <read_le_short+0x3c>
movl   $0x0,-0x4(%rbp)
jmp    116a <read_le_short+0x5a>
movzbl -0x19(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1a(%rbp),%ecx
or     %ecx,%eax
mov    %ax,%cx
mov    -0x18(%rbp),%rax
mov    %cx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_le_short>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %rdi,%rcx
lea    0xe(%rsp),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <fread@plt>
cmp    $0x2,%eax
jne    113c <read_le_short+0x2c>
movzwl 0xe(%rsp),%eax
mov    %ax,(%rbx)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @read_le_short(i32* %0, i16* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i16*
%6 = alloca [2 x i8]
store i32* %0, i32** %4
store i16* %1, i16** %5
%7 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%8 = load i32*, i32** %4
%9 = call i32 @fread(i8* %7, i32 1, i32 2, i32* %8)
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 0, i32* %3
br label %23
12: ; preds = %2
%13 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 1
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = shl i32 %15, 8
%17 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = or i32 %16, %19
%21 = trunc i32 %20 to i16
%22 = load i16*, i16** %5
store i16 %21, i16* %22
store i32 0, i32* %3
br label %23
23: ; preds = %12, %11
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @read_le_short(i32* nocapture %0, i16* nocapture writeonly %1) {
%3 = alloca [2 x i8]
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%5 = call i32 @fread(i8* %4, i32 1, i32 2, i32* %0)
%6 = icmp eq i32 %5, 2
br i1 %6, label %7, label %15
7: ; preds = %2
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 1
%9 = load i8, i8* %8
%10 = zext i8 %9 to i16
%11 = shl nuw i16 %10, 8
%12 = load i8, i8* %4
%13 = zext i8 %12 to i16
%14 = or i16 %11, %13
store i16 %14, i16* %1
br label %15
15: ; preds = %2, %7
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fwpminmx2_(float *, float *, float *, float *, int *, int *,
                              int *, int *);
void cfwpminmx2(float qe[], float qbme, float *wpmax, float *wpmin, int nx,
                int ny, int nxe, int nye) {
  fwpminmx2_(qe, &qbme, wpmax, wpmin, &nx, &ny, &nxe, &nye);
  return;
}


x86 assembly (clang, -O0):
<cfwpminmx2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8d,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    -0xc(%rbp),%rsi
lea    -0x24(%rbp),%r8
lea    -0x28(%rbp),%r9
lea    -0x2c(%rbp),%r10
lea    0x10(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <fwpminmx2_@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cfwpminmx2>:
sub    $0x18,%rsp
mov    %rdx,%rax
mov    %rsi,%rdx
movss  %xmm0,0x14(%rsp)
mov    %ecx,0x10(%rsp)
mov    %r8d,0xc(%rsp)
mov    %r9d,0x8(%rsp)
lea    0x20(%rsp),%r10
lea    0x8(%rsp),%r11
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%r8
lea    0xc(%rsp),%r9
mov    %rax,%rcx
push   %r10
push   %r11
call   1030 <fwpminmx2_@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
define void @cfwpminmx2(float* %0, float %1, float* %2, float* %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca float*
%10 = alloca float
%11 = alloca float*
%12 = alloca float*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store float* %0, float** %9
store float %1, float* %10
store float* %2, float** %11
store float* %3, float** %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i32 %6, i32* %15
store i32 %7, i32* %16
%17 = load float*, float** %9
%18 = load float*, float** %11
%19 = load float*, float** %12
%20 = call i32 @fwpminmx2_(float* %17, float* %10, float* %18, float* %19, i32* %13, i32* %14, i32* %15, i32* %16)
ret void
}

LLVM IR (-O2):
define void @cfwpminmx2(float* %0, float %1, float* %2, float* %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca float
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store float %1, float* %9
store i32 %4, i32* %10
store i32 %5, i32* %11
store i32 %6, i32* %12
store i32 %7, i32* %13
%14 = call i32 @fwpminmx2_(float* %0, float* %9, float* %2, float* %3, i32* %10, i32* %11, i32* %12, i32* %13)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ forthresume(int /*<<< orphan*/);
Fquit() { forthresume(0); }


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

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

LLVM IR (-O0):
define i32 @Fquit() {
%1 = alloca i32
%2 = call i32 @forthresume(i32 0)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @Fquit() {
%1 = tail call i32 @forthresume(i32 0)
ret i32 undef
}
/* Variables and functions */
int atoi_len(char const *, int);
int packet_unpack_reg_resp(const char *packet) {
  int len = (4 + 2);
  return atoi_len(packet + len, 2);
}


x86 assembly (clang, -O0):
<packet_unpack_reg_resp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x6,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
add    %rax,%rdi
mov    $0x2,%esi
call   1030 <atoi_len@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<packet_unpack_reg_resp>:
add    $0x6,%rdi
mov    $0x2,%esi
jmp    1030 <atoi_len@plt>

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

LLVM IR (-O2):
define i32 @packet_unpack_reg_resp(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 6
%3 = tail call i32 @atoi_len(i8* %2, i32 2)
ret i32 %3
}