xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ init_by_array64(unsigned long long *, unsigned long long);
void init_prng(void) {
  unsigned long long init[4] = {0x12345ULL, 0x23456ULL, 0x34567ULL, 0x45678ULL},
                     length = 4;
  init_by_array64(init, length);
}


x86 assembly (clang, -O0):
<init_prng>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xedb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed8(%rip),%rax
mov    %rax,-0x8(%rbp)
movq   $0x4,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <init_by_array64@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_prng>:
sub    $0x28,%rsp
movaps 0xef5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x4,%esi
call   1030 <init_by_array64@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.init_prng.init = [4 x i64] [i64 74565, i64 144470, i64 214375, i64 284280]
define void @init_prng() {
%1 = alloca [4 x i64]
%2 = alloca i64
%3 = bitcast [4 x i64]* %1 to i8*
store i64 4, i64* %2
%4 = getelementptr inbounds [4 x i64], [4 x i64]* %1, i64 0, i64 0
%5 = load i64, i64* %2
%6 = call i32 @init_by_array64(i64* %4, i64 %5)
ret void
}

LLVM IR (-O2):
@__const.init_prng.init = [4 x i64] [i64 74565, i64 144470, i64 214375, i64 284280]
define void @init_prng() {
%1 = alloca [4 x i64]
%2 = bitcast [4 x i64]* %1 to i8*
%3 = getelementptr inbounds [4 x i64], [4 x i64]* %1, i64 0, i64 0
%4 = call i32 @init_by_array64(i64* %3, i64 4)
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint8_t qadd8(uint8_t i, uint8_t j) {
  uint16_t t = i + j;
  if (t > 255)
    t = 255;
  return t;
}


x86 assembly (clang, -O0):
<qadd8>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0xff,-0xc(%rbp)
jle    1127 <qadd8+0x27>
movl   $0xff,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<qadd8>:
lea    (%rdi,%rsi,1),%ecx
cmp    $0xff,%ecx
mov    $0xff,%eax
cmovl  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @qadd8(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
%4 = icmp slt i32 %3, 255
%5 = select i1 %4, i32 %3, i32 255
ret i32 %5
}
/* Variables and functions */
unsigned char getchar();
char getOneDigit() {
  unsigned char inChar;
  do
    inChar = getchar();
  while (((inChar < 48) || (inChar > 57)) && (inChar != 13) && (inChar != 8));
  return inChar;
}


x86 assembly (clang, -O0):
<getOneDigit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x30,%eax
jl     1141 <getOneDigit+0x31>
movzbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x39,%ecx
mov    %al,-0x2(%rbp)
jle    1160 <getOneDigit+0x50>
movzbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0xd,%ecx
mov    %al,-0x2(%rbp)
je     1160 <getOneDigit+0x50>
movzbl -0x1(%rbp),%eax
cmp    $0x8,%eax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
test   $0x1,%al
jne    1118 <getOneDigit+0x8>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getOneDigit>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getchar@plt>
lea    -0x3a(%rax),%ecx
cmp    $0xf5,%cl
ja     1137 <getOneDigit+0x27>
cmp    $0xd,%al
je     1137 <getOneDigit+0x27>
cmp    $0x8,%al
jne    1120 <getOneDigit+0x10>
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @getOneDigit() {
%1 = alloca i8
br label %2
2: ; preds = %20, %0
%3 = call zeroext i8 (...) @getchar()
store i8 %3, i8* %1
br label %4
4: ; preds = %2
%5 = load i8, i8* %1
%6 = zext i8 %5 to i32
%7 = icmp slt i32 %6, 48
br i1 %7, label %12, label %8
8: ; preds = %4
%9 = load i8, i8* %1
%10 = zext i8 %9 to i32
%11 = icmp sgt i32 %10, 57
br i1 %11, label %12, label %20
12: ; preds = %8, %4
%13 = load i8, i8* %1
%14 = zext i8 %13 to i32
%15 = icmp ne i32 %14, 13
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = load i8, i8* %1
%18 = zext i8 %17 to i32
%19 = icmp ne i32 %18, 8
br label %20
20: ; preds = %16, %12, %8
%21 = phi i1 [ false, %12 ], [ false, %8 ], [ %19, %16 ]
br i1 %21, label %2, label %22
22: ; preds = %20
%23 = load i8, i8* %1
ret i8 %23
}

LLVM IR (-O2):
define signext i8 @getOneDigit() {
br label %1
1: ; preds = %5, %0
%2 = tail call zeroext i8 (...) @getchar()
%3 = add i8 %2, -58
%4 = icmp ult i8 %3, -10
br i1 %4, label %5, label %6
5: ; preds = %1
switch i8 %2, label %1 [
i8 13, label %6
i8 8, label %6
]
6: ; preds = %5, %5, %1
ret i8 %2
}
/* Variables and functions */
int ioCanConnectToPort(int, int);
int secCanConnectToPort(int addr, int port) {
  return ioCanConnectToPort(addr, port);
}


x86 assembly (clang, -O0):
<secCanConnectToPort>:
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   1030 <ioCanConnectToPort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<secCanConnectToPort>:
jmp    1030 <ioCanConnectToPort@plt>

LLVM IR (-O0):
define i32 @secCanConnectToPort(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 i32 @ioCanConnectToPort(i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @secCanConnectToPort(i32 %0, i32 %1) {
%3 = tail call i32 @ioCanConnectToPort(i32 %0, i32 %1)
ret i32 %3
}
void f(void (*g)(int x)) { g(0); }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %edi,%edi
call   *-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
mov    %rdi,%rax
xor    %edi,%edi
jmp    *%rax

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

LLVM IR (-O2):
define void @f(void (i32)* nocapture %0) {
tail call void %0(i32 0)
ret void
}
/* Variables and functions */
scalar_t__ __infer_nondet_int();
int /*<<< orphan*/ nop();
void FN_unreachable_statement_continue_bad() {
  while (__infer_nondet_int()) {
    continue;
    nop();
  }
}


x86 assembly (clang, -O0):
<FN_unreachable_statement_continue_bad>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <FN_unreachable_statement_continue_bad+0x9>
mov    $0x0,%al
call   1030 <__infer_nondet_int@plt>
cmp    $0x0,%rax
je     112f <FN_unreachable_statement_continue_bad+0x1f>
jmp    1119 <FN_unreachable_statement_continue_bad+0x9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<FN_unreachable_statement_continue_bad>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <__infer_nondet_int@plt>
test   %rax,%rax
jne    1120 <FN_unreachable_statement_continue_bad+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @FN_unreachable_statement_continue_bad() {
br label %1
1: ; preds = %4, %0
%2 = call i64 (...) @__infer_nondet_int()
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %1
br label %1
5: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @FN_unreachable_statement_continue_bad() {
br label %1
1: ; preds = %1, %0
%2 = tail call i64 (...) @__infer_nondet_int()
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %1
4: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isbdigit(int);
void t_isbdigit_0x0c() {
  Assert_real((isbdigit(12) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isbdigit.c",
              65, ("isbdigit should be 0 for 0x0c"));
}


x86 assembly (clang, -O0):
<t_isbdigit_0x0c>:
push   %rbp
mov    %rsp,%rbp
mov    $0xc,%edi
call   1040 <isbdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x41,%edx
lea    0xf5c(%rip),%rcx
call   1030 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isbdigit_0x0c>:
push   %rax
mov    $0xc,%edi
call   1040 <isbdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x41,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0x0c\00"
define void @t_isbdigit_0x0c() {
%1 = call i64 @isbdigit(i32 12)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 65, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0x0c\00"
define void @t_isbdigit_0x0c() {
%1 = tail call i64 @isbdigit(i32 12)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 65, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int main(void) {
  int x, y, z, sum;
  printf("Enter three integers: ");
  scanf("%o %o %o", &x, &y, &z);
  sum = x + y + z;
  printf("sum =  %o\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1040 <scanf@plt>
mov    0x10(%rsp),%esi
add    0x14(%rsp),%esi
add    0xc(%rsp),%esi
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Enter three integers: \00"
@.str.1 = [9 x i8] c"%o %o %o\00"
@.str.2 = [11 x i8] c"sum = %o\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = add nsw i32 %8, %9
%11 = load i32, i32* %4
%12 = add nsw i32 %10, %11
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Enter three integers: \00"
@.str.1 = [9 x i8] c"%o %o %o\00"
@.str.2 = [11 x i8] c"sum = %o\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = add nsw i32 %10, %9
%12 = load i32, i32* %3
%13 = add nsw i32 %11, %12
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %13)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ngen(char *, char *, int /*<<< orphan*/);
void cgdec2iw(void) { ngen("%s\t(%%rdx)", "decq", 0); }


x86 assembly (clang, -O0):
<cgdec2iw>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee9(%rip),%rsi
xor    %edx,%edx
call   1030 <ngen@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgdec2iw>:
lea    0xee9(%rip),%rdi
lea    0xeed(%rip),%rsi
xor    %edx,%edx
jmp    1030 <ngen@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"%s\09(%%rdx)\00"
@.str.1 = [5 x i8] c"decq\00"
define void @cgdec2iw() {
%1 = call i32 @ngen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"%s\09(%%rdx)\00"
@.str.1 = [5 x i8] c"decq\00"
define void @cgdec2iw() {
%1 = tail call i32 @ngen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret void
}
int main(void) {
  int x;
  ;
  while (x < 10)
    x = x + 3;
  if (1)
    x = x + 3;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1123 <main+0x23>
mov    -0x8(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x8(%rbp)
jmp    110b <main+0xb>
mov    -0x8(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%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
br label %3
3: ; preds = %6, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 10
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 3
store i32 %8, i32* %2
br label %3
9: ; preds = %3
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 3
store i32 %11, i32* %2
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int test_imm_87int64_highword_mem(long long *val) {
  return ((*val >> 32) & (0x87 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_87int64_highword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
sar    $0x20,%rdx
and    $0x87,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_87int64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 579820584960
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int cy_decrypt_byte(unsigned long *pkeys, const unsigned long *pcrc_32_tab) {
  unsigned temp;
  temp = ((unsigned)(*(pkeys + 2)) & 0xffff) | 2;
  return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
}


x86 assembly (clang, -O0):
<cy_decrypt_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
and    $0xffff,%eax
or     $0x2,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x14(%rbp),%ecx
xor    $0x1,%ecx
imul   %ecx,%eax
shr    $0x8,%eax
and    $0xff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cy_decrypt_byte>:
mov    $0xfffd,%eax
and    0x10(%rdi),%eax
lea    0x2(%rax),%ecx
xor    $0x3,%eax
imul   %ecx,%eax
movzbl %ah,%eax
ret

LLVM IR (-O0):
define i32 @cy_decrypt_byte(i64* %0, i64* %1) {
%3 = alloca i64*
%4 = alloca i64*
%5 = alloca i32
store i64* %0, i64** %3
store i64* %1, i64** %4
%6 = load i64*, i64** %3
%7 = getelementptr inbounds i64, i64* %6, i64 2
%8 = load i64, i64* %7
%9 = trunc i64 %8 to i32
%10 = and i32 %9, 65535
%11 = or i32 %10, 2
store i32 %11, i32* %5
%12 = load i32, i32* %5
%13 = load i32, i32* %5
%14 = xor i32 %13, 1
%15 = mul i32 %12, %14
%16 = lshr i32 %15, 8
%17 = and i32 %16, 255
ret i32 %17
}

LLVM IR (-O2):
define i32 @cy_decrypt_byte(i64* nocapture %0, i64* nocapture readnone %1) {
%3 = getelementptr inbounds i64, i64* %0, i64 2
%4 = load i64, i64* %3
%5 = trunc i64 %4 to i32
%6 = and i32 %5, 65533
%7 = or i32 %6, 2
%8 = xor i32 %6, 3
%9 = mul nuw i32 %7, %8
%10 = lshr i32 %9, 8
%11 = and i32 %10, 255
ret i32 %11
}
/* Type definitions */
struct quat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ quat(float *, float, float, float, float);
__attribute__((always_)) struct quat *psquat(struct quat *result, float x,
                                             float y, float z, float w) {
  quat((float *)result, x, y, z, w);
  return result;
}


x86 assembly (clang, -O0):
<psquat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
movss  %xmm3,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
movss  -0x18(%rbp),%xmm3
call   1030 <quat@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psquat>:
push   %rbx
mov    %rdi,%rbx
call   1030 <quat@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.quat = type { i32 }
define %struct.quat* @psquat(%struct.quat* %0, float %1, float %2, float %3, float %4) {
%6 = alloca %struct.quat*
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
store %struct.quat* %0, %struct.quat** %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
store float %4, float* %10
%11 = load %struct.quat*, %struct.quat** %6
%12 = bitcast %struct.quat* %11 to float*
%13 = load float, float* %7
%14 = load float, float* %8
%15 = load float, float* %9
%16 = load float, float* %10
%17 = call i32 @quat(float* %12, float %13, float %14, float %15, float %16)
%18 = load %struct.quat*, %struct.quat** %6
ret %struct.quat* %18
}

LLVM IR (-O2):
%struct.quat = type { i32 }
define %struct.quat* @psquat(%struct.quat* returned %0, float %1, float %2, float %3, float %4) {
%6 = bitcast %struct.quat* %0 to float*
%7 = tail call i32 @quat(float* %6, float %1, float %2, float %3, float %4)
ret %struct.quat* %0
}
/* Type definitions */
struct stat64 {
  int dummy;
};

/* Variables and functions */
int __xstat64(int, char const *, struct stat64 *);
int __lxstat64(int ver, const char *path, struct stat64 *buf) {
  return __xstat64(ver, path, buf);
}


x86 assembly (clang, -O0):
<__lxstat64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <__xstat64@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__lxstat64>:
jmp    1030 <__xstat64@plt>

LLVM IR (-O0):
%struct.stat64 = type { i32 }
define i32 @__lxstat64(i32 %0, i8* %1, %struct.stat64* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca %struct.stat64*
store i32 %0, i32* %4
store i8* %1, i8** %5
store %struct.stat64* %2, %struct.stat64** %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load %struct.stat64*, %struct.stat64** %6
%10 = call i32 @__xstat64(i32 %7, i8* %8, %struct.stat64* %9)
ret i32 %10
}

LLVM IR (-O2):
%struct.stat64 = type { i32 }
define i32 @__lxstat64(i32 %0, i8* %1, %struct.stat64* %2) {
%4 = tail call i32 @__xstat64(i32 %0, i8* %1, %struct.stat64* %2)
ret i32 %4
}
/* Variables and functions */
int rand();
int rand_nonuniform_range(int min, int max) {
  return rand() % (max - min + 1) + min;
}


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

x86 assembly (clang, -O2):
<rand_nonuniform_range>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
sub    %ebp,%ebx
add    $0x1,%ebx
cltd
idiv   %ebx
add    %edx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @rand_nonuniform_range(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 (...) @rand()
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = sub nsw i32 %6, %7
%9 = add nsw i32 %8, 1
%10 = srem i32 %5, %9
%11 = load i32, i32* %3
%12 = add nsw i32 %10, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @rand_nonuniform_range(i32 %0, i32 %1) {
%3 = tail call i32 (...) @rand()
%4 = sub i32 1, %0
%5 = add i32 %4, %1
%6 = srem i32 %3, %5
%7 = add nsw i32 %6, %0
ret i32 %7
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t op_logical_not(uint32_t a, uint32_t b) { return !a; }


x86 assembly (clang, -O0):
<op_logical_not>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_logical_not>:
xor    %eax,%eax
test   %edi,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @op_logical_not(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
%7 = xor i1 %6, true
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @op_logical_not(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
char *getcwd(char *, int);
char *GetCwd(char *name, int n) { return getcwd(name, n); }


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

x86 assembly (clang, -O2):
<GetCwd>:
jmp    1030 <getcwd@plt>

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

LLVM IR (-O2):
define i8* @GetCwd(i8* %0, i32 %1) {
%3 = tail call i8* @getcwd(i8* %0, i32 %1)
ret i8* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ msg;

/* Variables and functions */
int /*<<< orphan*/ _exit(int /*<<< orphan*/);
int /*<<< orphan*/ write(int, char const *, int);
void main(void) {
  static const char msg[] = "hello world\r\n";
  write(1, msg, sizeof(msg));
  _exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
lea    0xed0(%rip),%rsi
mov    $0xe,%edx
call   1040 <write@plt>
xor    %edi,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rsi
mov    $0x1,%edi
mov    $0xe,%edx
call   1040 <write@plt>
xor    %edi,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@main.msg = internal constant [14 x i8] c"hello world\0D\0A\00"
define void @main() {
%1 = call i32 @write(i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @main.msg, i64 0, i64 0), i32 14)
%2 = call i32 @_exit(i32 0)
unreachable
}

LLVM IR (-O2):
@main.msg = internal constant [14 x i8] c"hello world\0D\0A\00"
define void @main() {
%1 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @main.msg, i64 0, i64 0), i32 14)
%2 = tail call i32 @_exit(i32 0)
unreachable
}
void ble_rsp_system_reg_write(
    const struct ble_msg_system_reg_write_rsp_t *msg) {}


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

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

LLVM IR (-O0):
%struct.ble_msg_system_reg_write_rsp_t = type opaque
define void @ble_rsp_system_reg_write(%struct.ble_msg_system_reg_write_rsp_t* %0) {
%2 = alloca %struct.ble_msg_system_reg_write_rsp_t*
store %struct.ble_msg_system_reg_write_rsp_t* %0, %struct.ble_msg_system_reg_write_rsp_t** %2
ret void
}

LLVM IR (-O2):
%struct.ble_msg_system_reg_write_rsp_t = type opaque
define void @ble_rsp_system_reg_write(%struct.ble_msg_system_reg_write_rsp_t* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
char *strtok(int /*<<< orphan*/ *, char *);
int getNextToken(char **to_string, char *fail_message) {
  *to_string = strtok(NULL, " \r\n\t");
  if (*to_string == NULL) {
    puts(fail_message);
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<getNextToken>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xec5(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
jne    116d <getNextToken+0x4d>
mov    -0x18(%rbp),%rdi
call   1030 <puts@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1174 <getNextToken+0x54>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getNextToken>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xece(%rip),%rsi
xor    %ebx,%ebx
xor    %edi,%edi
call   1040 <strtok@plt>
mov    %rax,(%r15)
test   %rax,%rax
jne    1150 <getNextToken+0x30>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c" \0D\0A\09\00"
define i32 @getNextToken(i8** nocapture writeonly %0, i8* nocapture %1) {
%3 = tail call i8* @strtok(i32* null, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %3, i8** %0
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) %1)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ -1, %5 ], [ 0, %2 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int test_distributor(void) {
  printf("Distributor is not enabled in configuration\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [45 x i8] c"Distributor is not enabled in configuration\0A\00"
define i32 @test_distributor() {
%1 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [44 x i8] c"Distributor is not enabled in configuration\00"
define i32 @test_distributor() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_context_kill_source_output() {
  printf("NOT IMPLEMENTED:"
         "pa_context_kill_source_output"
         "\n");
}


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

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

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

LLVM IR (-O2):
@str = [46 x i8] c"NOT IMPLEMENTED:pa_context_kill_source_output\00"
define i32 @pa_context_kill_source_output() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
long long debugfs_read();
long long procfs_read();
long long interrupts_read(void) {
  long long val;
  val = debugfs_read();
  if (val < 0)
    val = procfs_read();
  return val;
}


x86 assembly (clang, -O0):
<interrupts_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <debugfs_read@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    1149 <interrupts_read+0x29>
mov    $0x0,%al
call   1030 <procfs_read@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<interrupts_read>:
push   %rax
xor    %eax,%eax
call   1040 <debugfs_read@plt>
test   %rax,%rax
js     112f <interrupts_read+0xf>
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
jmp    1030 <procfs_read@plt>

LLVM IR (-O0):
define i64 @interrupts_read() {
%1 = alloca i64
%2 = call i64 (...) @debugfs_read()
store i64 %2, i64* %1
%3 = load i64, i64* %1
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i64 (...) @procfs_read()
store i64 %6, i64* %1
br label %7
7: ; preds = %5, %0
%8 = load i64, i64* %1
ret i64 %8
}

LLVM IR (-O2):
define i64 @interrupts_read() {
%1 = tail call i64 (...) @debugfs_read()
%2 = icmp slt i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i64 (...) @procfs_read()
br label %5
5: ; preds = %3, %0
%6 = phi i64 [ %4, %3 ], [ %1, %0 ]
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ setDebuggingLevel(int);
int /*<<< orphan*/ testLargeVectors();
int /*<<< orphan*/ testListAddition();
int /*<<< orphan*/ testListCreation();
int /*<<< orphan*/ testListRemoval();
int /*<<< orphan*/ testListResizing();
int main(int argc, char *argv[]) {
  setDebuggingLevel(2);
  testListCreation();
  testListAddition();
  testListRemoval();
  testListResizing();
  testLargeVectors();
  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)
mov    $0x2,%edi
call   1040 <setDebuggingLevel@plt>
mov    $0x0,%al
call   1070 <testListCreation@plt>
mov    $0x0,%al
call   1050 <testListAddition@plt>
mov    $0x0,%al
call   1030 <testListRemoval@plt>
mov    $0x0,%al
call   1080 <testListResizing@plt>
mov    $0x0,%al
call   1060 <testLargeVectors@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
call   1040 <setDebuggingLevel@plt>
xor    %eax,%eax
call   1070 <testListCreation@plt>
xor    %eax,%eax
call   1050 <testListAddition@plt>
xor    %eax,%eax
call   1030 <testListRemoval@plt>
xor    %eax,%eax
call   1080 <testListResizing@plt>
xor    %eax,%eax
call   1060 <testLargeVectors@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @setDebuggingLevel(i32 2)
%7 = call i32 (...) @testListCreation()
%8 = call i32 (...) @testListAddition()
%9 = call i32 (...) @testListRemoval()
%10 = call i32 (...) @testListResizing()
%11 = call i32 (...) @testLargeVectors()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @setDebuggingLevel(i32 2)
%4 = tail call i32 (...) @testListCreation()
%5 = tail call i32 (...) @testListAddition()
%6 = tail call i32 (...) @testListRemoval()
%7 = tail call i32 (...) @testListResizing()
%8 = tail call i32 (...) @testLargeVectors()
ret i32 0
}
void rop3_106_1_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = T & S;
  stk1 = *D ^ stk2;
  *D = (stk1 & (~S) & (~T)) | (*D & S) | (*D & T);
}


x86 assembly (clang, -O0):
<rop3_106_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
movzbl -0xa(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0xa(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @rop3_106_1_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
ret void
}
int add_ok(int x, int y) {
  int sum = x + y;
  return (sum - x == y) && (sum - y == x);
}


x86 assembly (clang, -O0):
<add_ok>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
sub    -0x4(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0xd(%rbp)
jne    1136 <add_ok+0x36>
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @add_ok(i32 %0, i32 %1) {
ret i32 1
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int fstat(int, struct stat *);
int /*<<< orphan*/ reportError(struct stat *);
int learnFrom(int fd) {
  struct stat s;
  int b = fstat(fd, &s);
  if (b < 0) {
    reportError(&s);
    return -22;
  }
  return b + 1;
}


x86 assembly (clang, -O0):
<learnFrom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1040 <fstat@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1159 <learnFrom+0x39>
lea    -0x10(%rbp),%rdi
call   1030 <reportError@plt>
movl   $0xffffffea,-0x4(%rbp)
jmp    1162 <learnFrom+0x42>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<learnFrom>:
push   %rax
mov    %rsp,%rsi
call   1040 <fstat@plt>
test   %eax,%eax
js     1132 <learnFrom+0x12>
add    $0x1,%eax
pop    %rcx
ret
mov    %rsp,%rdi
call   1030 <reportError@plt>
mov    $0xffffffea,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @learnFrom(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.stat
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = call i32 @fstat(i32 %6, %struct.stat* %4)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 @reportError(%struct.stat* %4)
store i32 -22, i32* %2
br label %15
12: ; preds = %1
%13 = load i32, i32* %5
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
br label %15
15: ; preds = %12, %10
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @learnFrom(i32 %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @fstat(i32 %0, %struct.stat* %2)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @reportError(%struct.stat* %2)
br label %10
8: ; preds = %1
%9 = add nuw nsw i32 %4, 1
br label %10
10: ; preds = %8, %6
%11 = phi i32 [ -22, %6 ], [ %9, %8 ]
ret i32 %11
}
void s3c_udc_ep_activate(struct s3c_ep *ep) {}


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

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

LLVM IR (-O0):
%struct.s3c_ep = type opaque
define void @s3c_udc_ep_activate(%struct.s3c_ep* %0) {
%2 = alloca %struct.s3c_ep*
store %struct.s3c_ep* %0, %struct.s3c_ep** %2
ret void
}

LLVM IR (-O2):
%struct.s3c_ep = type opaque
define void @s3c_udc_ep_activate(%struct.s3c_ep* nocapture %0) {
ret void
}
/* Variables and functions */
void *get(int /*<<< orphan*/);
void *get_first() { return get(0); }


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

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

LLVM IR (-O0):
define i8* @get_first() {
%1 = call i8* @get(i32 0)
ret i8* %1
}

LLVM IR (-O2):
define i8* @get_first() {
%1 = tail call i8* @get(i32 0)
ret i8* %1
}
/* Type definitions */
struct mmc_host {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ __mmc_claim_host(struct mmc_host *, void *);
void mmc_claim_host(struct mmc_host *host) {
  __mmc_claim_host(host, ((void *)0));
}


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

x86 assembly (clang, -O2):
<mmc_claim_host>:
xor    %esi,%esi
jmp    1030 <__mmc_claim_host@plt>

LLVM IR (-O0):
%struct.mmc_host = type { i32 }
define void @mmc_claim_host(%struct.mmc_host* %0) {
%2 = alloca %struct.mmc_host*
store %struct.mmc_host* %0, %struct.mmc_host** %2
%3 = load %struct.mmc_host*, %struct.mmc_host** %2
%4 = call i32 @__mmc_claim_host(%struct.mmc_host* %3, i8* null)
ret void
}

LLVM IR (-O2):
%struct.mmc_host = type { i32 }
define void @mmc_claim_host(%struct.mmc_host* %0) {
%2 = tail call i32 @__mmc_claim_host(%struct.mmc_host* %0, i8* null)
ret void
}
/* Type definitions */
struct gsm_modul {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ module_hangup_phone(struct gsm_modul *);
void gsm_hangup_phone(struct gsm_modul *gsm) { module_hangup_phone(gsm); }


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

x86 assembly (clang, -O2):
<gsm_hangup_phone>:
jmp    1030 <module_hangup_phone@plt>

LLVM IR (-O0):
%struct.gsm_modul = type { i32 }
define void @gsm_hangup_phone(%struct.gsm_modul* %0) {
%2 = alloca %struct.gsm_modul*
store %struct.gsm_modul* %0, %struct.gsm_modul** %2
%3 = load %struct.gsm_modul*, %struct.gsm_modul** %2
%4 = call i32 @module_hangup_phone(%struct.gsm_modul* %3)
ret void
}

LLVM IR (-O2):
%struct.gsm_modul = type { i32 }
define void @gsm_hangup_phone(%struct.gsm_modul* %0) {
%2 = tail call i32 @module_hangup_phone(%struct.gsm_modul* %0)
ret void
}
/* Type definitions */
typedef scalar_t__ pid_t;

/* Variables and functions */
scalar_t__ fork();
int /*<<< orphan*/ printf(char *, int);
int main() {
  pid_t pid;
  if ((pid = fork()) == 0) {
  } else {
    printf("子进程是 %d\n", (int)pid);
    while (1) {
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <fork@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
jne    1142 <main+0x22>
jmp    1159 <main+0x39>
mov    -0x8(%rbp),%rax
mov    %eax,%esi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
jmp    1154 <main+0x34>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <fork@plt>
test   %rax,%rax
je     1142 <main+0x22>
lea    0xecc(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
nopl   0x0(%rax,%rax,1)
jmp    1140 <main+0x20>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"\E5\AD\90\E8\BF\9B\E7\A8\8B\E6\98\AF %d\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = call i64 (...) @fork()
store i64 %2, i64* %1
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %0
br label %10
5: ; preds = %0
%6 = load i64, i64* %1
%7 = trunc i64 %6 to i32
%8 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %5, %9
br label %9
10: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"\E5\AD\90\E8\BF\9B\E7\A8\8B\E6\98\AF %d\0A\00"
define i32 @main() {
%1 = tail call i64 (...) @fork()
%2 = icmp eq i64 %1, 0
br i1 %2, label %7, label %3
3: ; preds = %0
%4 = trunc i64 %1 to i32
%5 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %6
6: ; preds = %6, %3
br label %6
7: ; preds = %0
ret i32 0
}
int varArgs(int i1, ...) { return i1; }


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

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

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

LLVM IR (-O2):
define i32 @varArgs(i32 returned %0, ...) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ isspace(char);
char *skipnosp(char *s) {
  while (*s && !isspace(*s))
    s++;
  return s;
}


x86 assembly (clang, -O0):
<skipnosp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     1148 <skipnosp+0x38>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1158 <skipnosp+0x48>
jmp    1169 <skipnosp+0x59>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <skipnosp+0xc>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipnosp>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     1138 <skipnosp+0x28>
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <isspace@plt>
test   %eax,%eax
jne    1138 <skipnosp+0x28>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <skipnosp+0x10>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @skipnosp(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %9
%5 = phi i8 [ %11, %9 ], [ %2, %1 ]
%6 = phi i8* [ %10, %9 ], [ %0, %1 ]
%7 = tail call i32 @isspace(i8 signext %5)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %9, %1
%14 = phi i8* [ %0, %1 ], [ %10, %9 ], [ %6, %4 ]
ret i8* %14
}