xunge/DecIR huggingface dataset:
int cmp_dbl(const void *a, const void *b) {
  const double x = *(const double *)a;
  const double y = *(const double *)b;
  if (x > y)
    return 1;
  if (x == y)
    return 0;
  else
    return -1;
}


x86 assembly (clang, -O0):
<cmp_dbl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    1142 <cmp_dbl+0x42>
movl   $0x1,-0x4(%rbp)
jmp    116b <cmp_dbl+0x6b>
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jne    1164 <cmp_dbl+0x64>
jp     1164 <cmp_dbl+0x64>
movl   $0x0,-0x4(%rbp)
jmp    116b <cmp_dbl+0x6b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_dbl>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
ucomisd %xmm1,%xmm0
cmpneqsd %xmm1,%xmm0
movq   %xmm0,%rcx
mov    $0x1,%eax
cmovbe %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @cmp_dbl(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = load double, double* %3
%5 = bitcast i8* %1 to double*
%6 = load double, double* %5
%7 = fcmp ogt double %4, %6
%8 = fcmp une double %4, %6
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ AbsoluteIndexedXX1(int);
int /*<<< orphan*/ STZ16(int /*<<< orphan*/, int);
void Op9EM0X1(void) { STZ16(AbsoluteIndexedXX1(2), 0xFFFFFF); }


x86 assembly (clang, -O0):
<Op9EM0X1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1040 <AbsoluteIndexedXX1@plt>
mov    %eax,%edi
mov    $0xffffff,%esi
call   1030 <STZ16@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Op9EM0X1>:
push   %rax
mov    $0x2,%edi
call   1040 <AbsoluteIndexedXX1@plt>
mov    %eax,%edi
mov    $0xffffff,%esi
pop    %rax
jmp    1030 <STZ16@plt>

LLVM IR (-O0):
define void @Op9EM0X1() {
%1 = call i32 @AbsoluteIndexedXX1(i32 2)
%2 = call i32 @STZ16(i32 %1, i32 16777215)
ret void
}

LLVM IR (-O2):
define void @Op9EM0X1() {
%1 = tail call i32 @AbsoluteIndexedXX1(i32 2)
%2 = tail call i32 @STZ16(i32 %1, i32 16777215)
ret void
}
void Interp6(unsigned char *pc, int c1, int c2, int c3) {
  *((int *)pc) =
      ((((c1 & 0x00FF00) * 5 + (c2 & 0x00FF00) * 2 + (c3 & 0x00FF00)) &
        0x0007F800) +
       (((c1 & 0xFF00FF) * 5 + (c2 & 0xFF00FF) * 2 + (c3 & 0xFF00FF)) &
        0x07F807F8)) >>
      3;
}


x86 assembly (clang, -O0):
<Interp6>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0xc(%rbp),%eax
and    $0xff00,%eax
imul   $0x5,%eax,%ecx
mov    -0x10(%rbp),%eax
and    $0xff00,%eax
shl    $0x1,%eax
add    %eax,%ecx
mov    -0x14(%rbp),%eax
and    $0xff00,%eax
add    %eax,%ecx
and    $0x7f800,%ecx
mov    -0xc(%rbp),%eax
and    $0xff00ff,%eax
imul   $0x5,%eax,%eax
mov    -0x10(%rbp),%edx
and    $0xff00ff,%edx
shl    $0x1,%edx
add    %edx,%eax
mov    -0x14(%rbp),%edx
and    $0xff00ff,%edx
add    %edx,%eax
and    $0x7f807f8,%eax
add    %eax,%ecx
sar    $0x3,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Interp6>:
mov    %esi,%eax
and    $0xff00,%eax
lea    (%rax,%rax,4),%r8d
add    %edx,%edx
mov    %edx,%eax
and    $0x1fe00,%eax
add    %r8d,%eax
mov    %ecx,%r8d
and    $0xff00,%r8d
add    %eax,%r8d
and    $0x7f800,%r8d
and    $0xff00ff,%esi
lea    (%rsi,%rsi,4),%eax
and    $0x1fe01fe,%edx
add    %eax,%edx
and    $0xff00ff,%ecx
add    %edx,%ecx
and    $0x7f807f8,%ecx
or     %r8d,%ecx
shr    $0x3,%ecx
mov    %ecx,(%rdi)
ret

LLVM IR (-O0):
define void @Interp6(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %6
%10 = and i32 %9, 65280
%11 = mul nsw i32 %10, 5
%12 = load i32, i32* %7
%13 = and i32 %12, 65280
%14 = mul nsw i32 %13, 2
%15 = add nsw i32 %11, %14
%16 = load i32, i32* %8
%17 = and i32 %16, 65280
%18 = add nsw i32 %15, %17
%19 = and i32 %18, 522240
%20 = load i32, i32* %6
%21 = and i32 %20, 16711935
%22 = mul nsw i32 %21, 5
%23 = load i32, i32* %7
%24 = and i32 %23, 16711935
%25 = mul nsw i32 %24, 2
%26 = add nsw i32 %22, %25
%27 = load i32, i32* %8
%28 = and i32 %27, 16711935
%29 = add nsw i32 %26, %28
%30 = and i32 %29, 133695480
%31 = add nsw i32 %19, %30
%32 = ashr i32 %31, 3
%33 = load i8*, i8** %5
%34 = bitcast i8* %33 to i32*
store i32 %32, i32* %34
ret void
}

LLVM IR (-O2):
define void @Interp6(i8* nocapture writeonly %0, i32 %1, i32 %2, i32 %3) {
%5 = and i32 %1, 65280
%6 = mul nuw nsw i32 %5, 5
%7 = shl i32 %2, 1
%8 = and i32 %7, 130560
%9 = add nuw nsw i32 %8, %6
%10 = and i32 %3, 65280
%11 = add nuw nsw i32 %9, %10
%12 = and i32 %11, 522240
%13 = and i32 %1, 16711935
%14 = mul nuw nsw i32 %13, 5
%15 = and i32 %7, 33423870
%16 = add nuw nsw i32 %15, %14
%17 = and i32 %3, 16711935
%18 = add nuw nsw i32 %16, %17
%19 = and i32 %18, 133695480
%20 = or i32 %12, %19
%21 = lshr exact i32 %20, 3
%22 = bitcast i8* %0 to i32*
store i32 %21, i32* %22
ret void
}
int check_prime(int a) {
  int c;
  for (c = 2; c <= a - 1; c++) {
    if (a % c == 0)
      return 0;
  }
  if (c == a)
    return 1;
}


x86 assembly (clang, -O0):
<check_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     114e <check_prime+0x4e>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    113b <check_prime+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    1161 <check_prime+0x61>
jmp    1140 <check_prime+0x40>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <check_prime+0xe>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1161 <check_prime+0x61>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_prime>:
mov    $0x1,%ecx
cmp    $0x3,%edi
jl     1120 <check_prime+0x20>
mov    $0x2,%esi
nop
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1123 <check_prime+0x23>
add    $0x1,%esi
cmp    %esi,%edi
jne    1110 <check_prime+0x10>
mov    %ecx,%eax
ret
xor    %ecx,%ecx
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @check_prime(i32 %0) {
%2 = icmp sgt i32 %0, 2
br i1 %2, label %5, label %10
3: ; preds = %5
%4 = icmp eq i32 %9, %0
br i1 %4, label %10, label %5
5: ; preds = %1, %3
%6 = phi i32 [ %9, %3 ], [ 2, %1 ]
%7 = srem i32 %0, %6
%8 = icmp eq i32 %7, 0
%9 = add nuw nsw i32 %6, 1
br i1 %8, label %10, label %3
10: ; preds = %5, %3, %1
%11 = phi i32 [ 1, %1 ], [ 1, %3 ], [ 0, %5 ]
ret i32 %11
}
div1(signed char x) { return x / -1; }


x86 assembly (clang, -O0):
<div1>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
mov    $0xffffffff,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @div1(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = sdiv i32 %4, -1
ret i32 %5
}

LLVM IR (-O2):
define i32 @div1(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = sub nsw i32 0, %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ display(char *);
int /*<<< orphan*/ getLongString(char *);
int main() {
  char c[50] = "";
  getLongString(c);
  display(c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1040 <memset@plt>
lea    -0x40(%rbp),%rdi
call   1050 <getLongString@plt>
lea    -0x40(%rbp),%rdi
call   1030 <display@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movw   $0x0,0x30(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <getLongString@plt>
mov    %rbx,%rdi
call   1030 <display@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x i8]
store i32 0, i32* %1
%3 = bitcast [50 x i8]* %2 to i8*
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%5 = call i32 @getLongString(i8* %4)
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%7 = call i32 @display(i8* %6)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [50 x i8]
%2 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%3 = call i32 @getLongString(i8* %2)
%4 = call i32 @display(i8* %2)
ret i32 0
}
/* Variables and functions */
scalar_t__ rand();
int random(int m) { return ((unsigned long)rand()) % m; }


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

x86 assembly (clang, -O2):
<random>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
movslq %ebx,%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
je     1133 <random+0x23>
xor    %edx,%edx
div    %rcx
mov    %rdx,%rax
pop    %rbx
ret
xor    %edx,%edx
div    %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @random(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i64 (...) @rand()
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = urem i64 %3, %5
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @random(i32 %0) {
%2 = tail call i64 (...) @rand()
%3 = sext i32 %0 to i64
%4 = urem i64 %2, %3
%5 = trunc i64 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ *ILibFindEntry(void *, char *, int, int /*<<< orphan*/);
int ILibHasEntry(void *hashtree, char *key, int keylength) {
  return (ILibFindEntry(hashtree, key, keylength, 0) != NULL ? 1 : 0);
}


x86 assembly (clang, -O0):
<ILibHasEntry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
xor    %ecx,%ecx
call   1030 <ILibFindEntry@plt>
mov    %rax,%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ILibHasEntry>:
push   %rax
xor    %ecx,%ecx
call   1030 <ILibFindEntry@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @ILibHasEntry(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32* @ILibFindEntry(i8* %7, i8* %8, i32 %9, i32 0)
%11 = icmp ne i32* %10, null
%12 = zext i1 %11 to i64
%13 = select i1 %11, i32 1, i32 0
ret i32 %13
}

LLVM IR (-O2):
define i32 @ILibHasEntry(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32* @ILibFindEntry(i8* %0, i8* %1, i32 %2, i32 0)
%5 = icmp ne i32* %4, null
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
long syscall(int, int *, unsigned long const *, unsigned long, void *, int);
long get_mempolicy(int *policy, const unsigned long *nmask,
                   unsigned long maxnode, void *addr, int flags) {
  return syscall(239, policy, nmask, maxnode, addr, flags);
}


x86 assembly (clang, -O0):
<get_mempolicy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x24(%rbp),%r9d
mov    $0xef,%edi
call   1030 <syscall@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_mempolicy>:
mov    %r8d,%r9d
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0xef,%edi
jmp    1030 <syscall@plt>

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

LLVM IR (-O2):
define i64 @get_mempolicy(i32* %0, i64* %1, i64 %2, i8* %3, i32 %4) {
%6 = tail call i64 @syscall(i32 239, i32* %0, i64* %1, i64 %2, i8* %3, i32 %4)
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void segment_fault_handler(int signum) { printf("I am slain!\n"); }


x86 assembly (clang, -O0):
<segment_fault_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<segment_fault_handler>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"I am slain!\0A\00"
define void @segment_fault_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [12 x i8] c"I am slain!\00"
define void @segment_fault_handler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bar();
void foo2(unsigned int i) {
  if (i & 0x80000000)
    bar();
}


x86 assembly (clang, -O0):
<foo2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x80000000,%eax
cmp    $0x0,%eax
je     1133 <foo2+0x23>
mov    $0x0,%al
call   1030 <bar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo2>:
test   %edi,%edi
js     1115 <foo2+0x5>
ret
xor    %eax,%eax
jmp    1030 <bar@plt>

LLVM IR (-O0):
define void @foo2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, -2147483648
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 (...) @bar()
br label %8
8: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
define void @foo2(i32 %0) {
%2 = icmp sgt i32 %0, -1
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 (...) @bar()
br label %5
5: ; preds = %3, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ x;
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ bswap64(int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, void const *, int);
uint64_t U64_AT(const void *p) {
  uint64_t x;
  memcpy(&x, p, sizeof(x));
  return bswap64(x);
}


x86 assembly (clang, -O0):
<U64_AT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0xc(%rbp),%edi
call   1040 <bswap64@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<U64_AT>:
push   %rax
mov    %rdi,%rsi
lea    0x4(%rsp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    0x4(%rsp),%edi
call   1040 <bswap64@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @U64_AT(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @memcpy(i32* %3, i8* %4, i32 4)
%6 = load i32, i32* %3
%7 = call i32 @bswap64(i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @U64_AT(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @memcpy(i32* %2, i8* %0, i32 4)
%5 = load i32, i32* %2
%6 = call i32 @bswap64(i32 %5)
ret i32 %6
}
void load_idt(void *base_addr) {
  __asm __volatile("lidt (%0)" : : "r"(base_addr));
}


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

x86 assembly (clang, -O2):
<load_idt>:
lidt   (%rdi)
ret

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

LLVM IR (-O2):
define void @load_idt(i8* %0) {
tail call void asm sideeffect "lidt ($0)", "r,~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ isdigit(char const);
bool isnum(const char *token) {
  for (size_t i = 0; token[i] != 0; i++) {
    if (!isdigit(token[i]))
      return false;
  }
  return true;
}


x86 assembly (clang, -O0):
<isnum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1175 <isnum+0x65>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    115f <isnum+0x4f>
movl   $0x0,-0x4(%rbp)
jmp    117c <isnum+0x6c>
jmp    1164 <isnum+0x54>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1124 <isnum+0x14>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isnum>:
push   %rbx
mov    (%rdi),%cl
test   %cl,%cl
je     1140 <isnum+0x30>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %cl,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     1137 <isnum+0x27>
movzbl (%rbx),%ecx
add    $0x1,%rbx
test   %cl,%cl
jne    1120 <isnum+0x10>
xor    %ecx,%ecx
test   %eax,%eax
setne  %cl
jmp    1145 <isnum+0x35>
mov    $0x1,%ecx
mov    %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @isnum(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %17, label %8
4: ; preds = %8
%5 = getelementptr inbounds i8, i8* %0, i64 %13
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %14, label %8
8: ; preds = %1, %4
%9 = phi i8 [ %6, %4 ], [ %2, %1 ]
%10 = phi i64 [ %13, %4 ], [ 0, %1 ]
%11 = tail call i32 @isdigit(i8 signext %9)
%12 = icmp eq i32 %11, 0
%13 = add i64 %10, 1
br i1 %12, label %14, label %4
14: ; preds = %8, %4
%15 = xor i1 %12, true
%16 = zext i1 %15 to i32
br label %17
17: ; preds = %14, %1
%18 = phi i32 [ 1, %1 ], [ %16, %14 ]
ret i32 %18
}
int reverse(int a) {
  int k;
  k = 0;
  while (a) {
    k = k * 10 + a % 10;
    a /= 10;
  }
  return k;
}


x86 assembly (clang, -O0):
<reverse>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1145 <reverse+0x45>
imul   $0xa,-0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0xc(%rbp),%eax
add    %edx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    110e <reverse+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse>:
xor    %eax,%eax
test   %edi,%edi
je     113f <reverse+0x3f>
cs nopw 0x0(%rax,%rax,1)
lea    (%rax,%rax,4),%eax
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
lea    (%rdi,%rdi,1),%edx
lea    (%rdx,%rdx,4),%edx
mov    %ecx,%esi
sub    %edx,%esi
lea    (%rsi,%rax,2),%eax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <reverse+0x10>
ret

LLVM IR (-O0):
define i32 @reverse(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %7, %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* %3
%9 = mul nsw i32 %8, 10
%10 = load i32, i32* %2
%11 = srem i32 %10, 10
%12 = add nsw i32 %9, %11
store i32 %12, i32* %3
%13 = load i32, i32* %2
%14 = sdiv i32 %13, 10
store i32 %14, i32* %2
br label %4
15: ; preds = %4
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @reverse(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %12, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ 0, %1 ]
%5 = phi i32 [ %9, %3 ], [ %0, %1 ]
%6 = mul nsw i32 %4, 10
%7 = srem i32 %5, 10
%8 = add nsw i32 %6, %7
%9 = sdiv i32 %5, 10
%10 = add i32 %5, 9
%11 = icmp ult i32 %10, 19
br i1 %11, label %12, label %3
12: ; preds = %3, %1
%13 = phi i32 [ 0, %1 ], [ %8, %3 ]
ret i32 %13
}
/* Variables and functions */
long long llabs(long long);
long long gcdi(long long a, long long b) {
  return (b == 0) ? llabs(a) : gcdi(b, a % b);
}


x86 assembly (clang, -O0):
<gcdi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114d <gcdi+0x2d>
mov    -0x8(%rbp),%rdi
call   1030 <llabs@plt>
mov    %rax,-0x18(%rbp)
jmp    1167 <gcdi+0x47>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
cqto
idivq  -0x10(%rbp)
mov    %rdx,%rsi
call   1040 <gcdi@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcdi>:
mov    %rdi,%rax
test   %rsi,%rsi
je     1132 <gcdi+0x32>
mov    %rsi,%rdx
jmp    111d <gcdi+0x1d>
nopl   (%rax)
cqto
idiv   %rcx
mov    %rcx,%rax
test   %rdx,%rdx
je     1135 <gcdi+0x35>
mov    %rdx,%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
jne    1110 <gcdi+0x10>
xor    %edx,%edx
div    %ecx
jmp    1115 <gcdi+0x15>
mov    %rax,%rcx
mov    %rcx,%rax
neg    %rax
cmovs  %rcx,%rax
ret

LLVM IR (-O0):
define i64 @gcdi(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i64, i64* %3
%9 = call i64 @llabs(i64 %8)
br label %16
10: ; preds = %2
%11 = load i64, i64* %4
%12 = load i64, i64* %3
%13 = load i64, i64* %4
%14 = srem i64 %12, %13
%15 = call i64 @gcdi(i64 %11, i64 %14)
br label %16
16: ; preds = %10, %7
%17 = phi i64 [ %9, %7 ], [ %15, %10 ]
ret i64 %17
}

LLVM IR (-O2):
define i64 @gcdi(i64 %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %4, label %7
4: ; preds = %7, %2
%5 = phi i64 [ %0, %2 ], [ %8, %7 ]
%6 = tail call i64 @llvm.abs.i64(i64 %5, i1 true)
ret i64 %6
7: ; preds = %2, %7
%8 = phi i64 [ %10, %7 ], [ %1, %2 ]
%9 = phi i64 [ %8, %7 ], [ %0, %2 ]
%10 = srem i64 %9, %8
%11 = icmp eq i64 %10, 0
br i1 %11, label %4, label %7
}
unsigned long long byte_swap_8(unsigned long long v) {
  v = ((v & 0x00000000FFFFFFFFULL) << 32) | (v >> 32);
  v = ((v & 0x0000FFFF0000FFFFULL) << 16) | ((v & 0xFFFF0000FFFF0000ULL) >> 16);
  return ((v & 0x00FF00FF00FF00FFULL) << 8) |
         ((v & 0xFF00FF00FF00FF00ULL) >> 8);
}


x86 assembly (clang, -O0):
<byte_swap_8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movabs $0xffffffff,%rax
and    -0x8(%rbp),%rax
shl    $0x20,%rax
mov    -0x8(%rbp),%rcx
shr    $0x20,%rcx
or     %rcx,%rax
mov    %rax,-0x8(%rbp)
movabs $0xffff0000ffff,%rax
and    -0x8(%rbp),%rax
shl    $0x10,%rax
movabs $0xffff0000ffff0000,%rcx
and    -0x8(%rbp),%rcx
shr    $0x10,%rcx
or     %rcx,%rax
mov    %rax,-0x8(%rbp)
movabs $0xff00ff00ff00ff,%rax
and    -0x8(%rbp),%rax
shl    $0x8,%rax
movabs $0xff00ff00ff00ff00,%rcx
and    -0x8(%rbp),%rcx
shr    $0x8,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<byte_swap_8>:
mov    %rdi,%rax
bswap  %rax
ret

LLVM IR (-O0):
define i64 @byte_swap_8(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 4294967295
%5 = shl i64 %4, 32
%6 = load i64, i64* %2
%7 = lshr i64 %6, 32
%8 = or i64 %5, %7
store i64 %8, i64* %2
%9 = load i64, i64* %2
%10 = and i64 %9, 281470681808895
%11 = shl i64 %10, 16
%12 = load i64, i64* %2
%13 = and i64 %12, -281470681808896
%14 = lshr i64 %13, 16
%15 = or i64 %11, %14
store i64 %15, i64* %2
%16 = load i64, i64* %2
%17 = and i64 %16, 71777214294589695
%18 = shl i64 %17, 8
%19 = load i64, i64* %2
%20 = and i64 %19, -71777214294589696
%21 = lshr i64 %20, 8
%22 = or i64 %18, %21
ret i64 %22
}

LLVM IR (-O2):
define i64 @byte_swap_8(i64 %0) {
%2 = tail call i64 @llvm.bswap.i64(i64 %0)
ret i64 %2
}
unsigned char popcount(unsigned int bits) {
  unsigned char count = 0;
  while (bits) {
    if (bits & 0X1)
      count += 1;
    bits >>= 1;
  }
  return count;
}


x86 assembly (clang, -O0):
<popcount>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     113c <popcount+0x3c>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     112e <popcount+0x2e>
movzbl -0x5(%rbp),%eax
add    $0x1,%eax
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <popcount+0xb>
movzbl -0x5(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<popcount>:
xor    %eax,%eax
test   %edi,%edi
je     1120 <popcount+0x20>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
mov    %edi,%edx
and    $0x1,%dl
add    %dl,%al
shr    %ecx
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <popcount+0x10>
ret

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

LLVM IR (-O2):
define zeroext i8 @popcount(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i8 [ %8, %3 ], [ 0, %1 ]
%5 = phi i32 [ %9, %3 ], [ %0, %1 ]
%6 = trunc i32 %5 to i8
%7 = and i8 %6, 1
%8 = add i8 %7, %4
%9 = lshr i32 %5, 1
%10 = icmp ult i32 %5, 2
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i8 [ 0, %1 ], [ %8, %3 ]
ret i8 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("First OSS Code\n");
  printf("한글패치n");
  printf("code add\n");
  printf("한글패치\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>
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [16 x i8] c"First OSS Code\0A\00"
@.str.1 = [14 x i8] c"\ED\95\9C\EA\B8\80\ED\8C\A8\EC\B9\98n\00"
@.str.2 = [10 x i8] c"code add\0A\00"
@.str.3 = [14 x i8] c"\ED\95\9C\EA\B8\80\ED\8C\A8\EC\B9\98\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))
%3 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [14 x i8] c"\ED\95\9C\EA\B8\80\ED\8C\A8\EC\B9\98n\00"
@str = [15 x i8] c"First OSS Code\00"
@str.4 = [9 x i8] c"code add\00"
@str.5 = [13 x i8] c"\ED\95\9C\EA\B8\80\ED\8C\A8\EC\B9\98\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))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.4, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.5, i64 0, i64 0))
ret i32 0
}
char *lw6sys_env_separator_str() { return ":"; }


x86 assembly (clang, -O0):
<lw6sys_env_separator_str>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lw6sys_env_separator_str>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [2 x i8] c":\00"
define i8* @lw6sys_env_separator_str() {
ret i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [2 x i8] c":\00"
define i8* @lw6sys_env_separator_str() {
ret i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ ckTerminalPutChar_unsafe(int /*<<< orphan*/);
void ckTerminalPrintString_unsafe(const char *str) {
  while (*str != '\0')
    ckTerminalPutChar_unsafe(*str++);
}


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

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

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

LLVM IR (-O2):
define void @ckTerminalPrintString_unsafe(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = sext i8 %5 to i32
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = tail call i32 @ckTerminalPutChar_unsafe(i32 %7)
%10 = load i8, i8* %8
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int f1(char *string) {
  printf("getted string:'%s';\n", string);
  return 0;
}


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

x86 assembly (clang, -O2):
<f1>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"getted string:'%s';\0A\00"
define i32 @f1(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"getted string:'%s';\0A\00"
define i32 @f1(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ link_failure_yn();
scalar_t__ yn(int, double);
void test_yn(int x, double d) {
  if (yn(x, d) != yn(x, d))
    link_failure_yn();
}


x86 assembly (clang, -O0):
<test_yn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
movsd  -0x10(%rbp),%xmm0
call   1040 <yn@plt>
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
movsd  -0x10(%rbp),%xmm0
call   1040 <yn@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
je     1165 <test_yn+0x45>
mov    $0x0,%al
call   1030 <link_failure_yn@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_yn>:
push   %r14
push   %rbx
push   %rax
movsd  %xmm0,(%rsp)
mov    %edi,%ebx
call   1040 <yn@plt>
mov    %rax,%r14
mov    %ebx,%edi
movsd  (%rsp),%xmm0
call   1040 <yn@plt>
cmp    %rax,%r14
jne    114c <test_yn+0x2c>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <link_failure_yn@plt>

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

LLVM IR (-O2):
define void @test_yn(i32 %0, double %1) {
%3 = tail call i64 @yn(i32 %0, double %1)
%4 = tail call i64 @yn(i32 %0, double %1)
%5 = icmp eq i64 %3, %4
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 (...) @link_failure_yn()
br label %8
8: ; preds = %6, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ mpz_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
scalar_t__ mpz_fits(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
void mpz_check_overflow(mpz_t z, uint32_t k) {
  if (mpz_fits(z, k)) {
    printf("*** BUG: check_overflow failed ***\n");
    fflush(stdout);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<mpz_check_overflow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1060 <mpz_fits@plt>
cmp    $0x0,%rax
je     1187 <mpz_check_overflow+0x47>
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpz_check_overflow>:
push   %rax
call   1060 <mpz_fits@plt>
test   %rax,%rax
jne    114d <mpz_check_overflow+0xd>
pop    %rax
ret
lea    0xeac(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"*** BUG: check_overflow failed ***\0A\00"
@stdout = global i32 0
define void @mpz_check_overflow(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i64 @mpz_fits(i32 %5, i32 %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @stdout
%12 = call i32 @fflush(i32 %11)
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %2
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@str = [35 x i8] c"*** BUG: check_overflow failed ***\00"
define void @mpz_check_overflow(i32 %0, i32 %1) {
%3 = tail call i64 @mpz_fits(i32 %0, i32 %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%7 = load i32, i32* @stdout
%8 = tail call i32 @fflush(i32 %7)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
ret void
}
/* Type definitions */
typedef scalar_t__ int32_t;

/* Variables and functions */
scalar_t__ abs(scalar_t__);
unsigned long manhattan_distance(const unsigned long x0, const unsigned long y0,
                                 const unsigned long x1,
                                 const unsigned long y1) {
  return (unsigned long)abs((int32_t)x1 - (int32_t)x0) +
         (unsigned long)abs((int32_t)y1 - (int32_t)y0);
}


x86 assembly (clang, -O0):
<manhattan_distance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
sub    -0x8(%rbp),%rdi
call   1030 <abs@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
sub    -0x10(%rbp),%rdi
call   1030 <abs@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
add    %rcx,%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<manhattan_distance>:
sub    %rdi,%rdx
mov    %rdx,%rdi
neg    %rdi
cmovs  %rdx,%rdi
sub    %rsi,%rcx
mov    %rcx,%rax
neg    %rax
cmovs  %rcx,%rax
add    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @manhattan_distance(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%9 = load i64, i64* %7
%10 = load i64, i64* %5
%11 = sub nsw i64 %9, %10
%12 = call i64 @abs(i64 %11)
%13 = load i64, i64* %8
%14 = load i64, i64* %6
%15 = sub nsw i64 %13, %14
%16 = call i64 @abs(i64 %15)
%17 = add i64 %12, %16
ret i64 %17
}

LLVM IR (-O2):
define i64 @manhattan_distance(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = sub nsw i64 %2, %0
%6 = tail call i64 @llvm.abs.i64(i64 %5, i1 true)
%7 = sub nsw i64 %3, %1
%8 = tail call i64 @llvm.abs.i64(i64 %7, i1 true)
%9 = add nuw i64 %8, %6
ret i64 %9
}
int do_nothing_printf(char const *format, ...) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @do_nothing_printf(i8* nocapture readnone %0, ...) {
ret i32 0
}
unsigned xrop3_122_1_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  unsigned stk4;
  stk4 = ~D;
  stk3 = S | stk4;
  stk2 = T & stk3;
  stk1 = D ^ stk2;
  return (stk1 & (~S) & (~T)) | (D & S) | (D & T);
}


x86 assembly (clang, -O0):
<xrop3_122_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
or     -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
and    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x10(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0x10(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @xrop3_122_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = shl i32 %13, 8
%15 = load i8, i8* %3
%16 = zext i8 %15 to i32
%17 = or i32 %14, %16
store i32 %17, i32* %6
%18 = load i8, i8* %4
%19 = zext i8 %18 to i32
%20 = shl i32 %19, 8
%21 = load i8, i8* %4
%22 = zext i8 %21 to i32
%23 = or i32 %20, %22
store i32 %23, i32* %7
%24 = load i32, i32* %5
%25 = xor i32 %24, -1
store i32 %25, i32* %11
%26 = load i32, i32* %6
%27 = load i32, i32* %11
%28 = or i32 %26, %27
store i32 %28, i32* %10
%29 = load i32, i32* %7
%30 = load i32, i32* %10
%31 = and i32 %29, %30
store i32 %31, i32* %9
%32 = load i32, i32* %5
%33 = load i32, i32* %9
%34 = xor i32 %32, %33
store i32 %34, i32* %8
%35 = load i32, i32* %8
%36 = load i32, i32* %6
%37 = xor i32 %36, -1
%38 = and i32 %35, %37
%39 = load i32, i32* %7
%40 = xor i32 %39, -1
%41 = and i32 %38, %40
%42 = load i32, i32* %5
%43 = load i32, i32* %6
%44 = and i32 %42, %43
%45 = or i32 %41, %44
%46 = load i32, i32* %5
%47 = load i32, i32* %7
%48 = and i32 %46, %47
%49 = or i32 %45, %48
ret i32 %49
}

LLVM IR (-O2):
define i32 @xrop3_122_1_1(i8 zeroext %0, i8 zeroext %1) {
ret i32 255
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void help() {
  printf("Usage: packnam [OPTION...] FILE\n\n"
         "packnam encodes a raw NES nametable.\n\n"
         "Options:\n\n"
         "  --width=NUM                     Use NUM as nametable width (tiles "
         "per row) (32)\n"
         "  --vram-address=NUM              Use NUM as VRAM start address "
         "(0x2000)\n"
         "  --output=FILE                   Store encoded data in FILE\n"
         "  --zero-terminate                Zero-terminate the output\n"
         "  --verbose                       Print statistics\n"
         "  --help                          Give this help list\n"
         "  --usage                         Give a short usage message\n"
         "  --version                       Print program version\n");
  exit(0);
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<help>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [580 x i8] c"Usage: packnam [OPTION...] FILE\0A\0Apacknam encodes a raw NES nametable.\0A\0AOptions:\0A\0A --width=NUM Use NUM as nametable width (tiles per row) (32)\0A --vram-address=NUM Use NUM as VRAM start address (0x2000)\0A --output=FILE Store encoded data in FILE\0A --zero-terminate Zero-terminate the output\0A --verbose Print statistics\0A --help Give this help list\0A --usage Give a short usage message\0A --version Print program version\0A\00"
define void @help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([580 x i8], [580 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [579 x i8] c"Usage: packnam [OPTION...] FILE\0A\0Apacknam encodes a raw NES nametable.\0A\0AOptions:\0A\0A --width=NUM Use NUM as nametable width (tiles per row) (32)\0A --vram-address=NUM Use NUM as VRAM start address (0x2000)\0A --output=FILE Store encoded data in FILE\0A --zero-terminate Zero-terminate the output\0A --verbose Print statistics\0A --help Give this help list\0A --usage Give a short usage message\0A --version Print program version\00"
define void @help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([579 x i8], [579 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
void USB_SOF_Event(void) {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ generateNextPalindrome(int *, int);
int main() {
  int num[] = {9, 4, 1, 8, 7, 9, 7, 8, 3, 2, 2};
  int n = sizeof(num) / sizeof(num[0]);
  generateNextPalindrome(num, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x2c,%edx
call   1040 <memcpy@plt>
movl   $0xb,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1030 <generateNextPalindrome@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
movups 0xf01(%rip),%xmm0
movups %xmm0,0x1c(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xb,%esi
call   1030 <generateNextPalindrome@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@__const.main.num = [11 x i32] [i32 9, i32 4, i32 1, i32 8, i32 7, i32 9, i32 7, i32 8, i32 3, i32 2, i32 2]
define i32 @main() {
%1 = alloca i32
%2 = alloca [11 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [11 x i32]* %2 to i8*
store i32 11, i32* %3
%5 = getelementptr inbounds [11 x i32], [11 x i32]* %2, i64 0, i64 0
%6 = load i32, i32* %3
%7 = call i32 @generateNextPalindrome(i32* %5, i32 %6)
ret i32 0
}

LLVM IR (-O2):
@__const.main.num = [11 x i32] [i32 9, i32 4, i32 1, i32 8, i32 7, i32 9, i32 7, i32 8, i32 3, i32 2, i32 2]
define i32 @main() {
%1 = alloca [11 x i32]
%2 = bitcast [11 x i32]* %1 to i8*
%3 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 0
%4 = call i32 @generateNextPalindrome(i32* %3, i32 11)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ UpdateRendering();
int /*<<< orphan*/ glutPostRedisplay();
void idleFunc(void) {
  UpdateRendering();
  glutPostRedisplay();
}


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

x86 assembly (clang, -O2):
<idleFunc>:
push   %rax
xor    %eax,%eax
call   1030 <UpdateRendering@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <glutPostRedisplay@plt>

LLVM IR (-O0):
define void @idleFunc() {
%1 = call i32 (...) @UpdateRendering()
%2 = call i32 (...) @glutPostRedisplay()
ret void
}

LLVM IR (-O2):
define void @idleFunc() {
%1 = tail call i32 (...) @UpdateRendering()
%2 = tail call i32 (...) @glutPostRedisplay()
ret void
}