xunge/DecIR huggingface dataset:
void foo148() {}


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

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

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

LLVM IR (-O2):
define void @foo148() {
ret void
}
char is_in_bound(int *arr, int size, int *ptr) {
  int i;
  int check = 0;
  for (i = 0; i < size; i++) {
    if (ptr == &arr[i]) {
      check = 1;
      break;
    }
  }
  return check;
}


x86 assembly (clang, -O0):
<is_in_bound>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1164 <is_in_bound+0x64>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
shl    $0x2,%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jne    1151 <is_in_bound+0x51>
movl   $0x1,-0x20(%rbp)
jmp    1164 <is_in_bound+0x64>
jmp    1156 <is_in_bound+0x56>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    111d <is_in_bound+0x1d>
mov    -0x20(%rbp),%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_in_bound>:
test   %esi,%esi
jle    111f <is_in_bound+0x1f>
mov    %esi,%eax
add    $0xfffffffffffffffc,%rdi
nopw   0x0(%rax,%rax,1)
add    $0x4,%rdi
cmp    %rdx,%rdi
je     1122 <is_in_bound+0x22>
add    $0xffffffffffffffff,%rax
jne    1110 <is_in_bound+0x10>
xor    %eax,%eax
ret
mov    $0x1,%al
ret

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

LLVM IR (-O2):
define signext i8 @is_in_bound(i32* readnone %0, i32 %1, i32* readnone %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %14
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %13, %6
br i1 %8, label %14, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %13, %7 ]
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = icmp eq i32* %11, %2
%13 = add nuw nsw i64 %10, 1
br i1 %12, label %14, label %7
14: ; preds = %7, %9, %3
%15 = phi i8 [ 0, %3 ], [ 1, %9 ], [ 0, %7 ]
ret i8 %15
}
void foo_2_1_2_1_1_2_1_1_2() {}


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

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

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

LLVM IR (-O2):
define void @foo_2_1_2_1_1_2_1_1_2() {
ret void
}
/* Variables and functions */
const char *get_converter(const char *path) { return NULL; }


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

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

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

LLVM IR (-O2):
define noalias i8* @get_converter(i8* nocapture readnone %0) {
ret i8* null
}
/* Variables and functions */
char *strchr(const char *s, int c) {
  do {
    if (*s == (char)c) {
      return (char *)s;
    }
  } while (*s++);
  return NULL;
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x14(%rbp),%ecx
movsbl %cl,%ecx
cmp    %ecx,%eax
jne    112d <strchr+0x2d>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1152 <strchr+0x52>
jmp    1132 <strchr+0x32>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
cmpb   $0x0,(%rax)
jne    110b <strchr+0xb>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
mov    %rdi,%rax
movsbl %sil,%ecx
nopw   0x0(%rax,%rax,1)
movsbl (%rax),%edx
cmp    %edx,%ecx
je     1121 <strchr+0x21>
add    $0x1,%rax
test   %dl,%dl
jne    1110 <strchr+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @strchr(i8* %0, i32 %1) {
%3 = shl i32 %1, 24
%4 = ashr exact i32 %3, 24
br label %5
5: ; preds = %10, %2
%6 = phi i8* [ %0, %2 ], [ %11, %10 ]
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %4, %8
br i1 %9, label %13, label %10
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %6, i64 1
%12 = icmp eq i8 %7, 0
br i1 %12, label %13, label %5
13: ; preds = %10, %5
%14 = phi i8* [ %6, %5 ], [ null, %10 ]
ret i8* %14
}
void foo(int **a, unsigned long b) { *a = (int *)b; }


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

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

LLVM IR (-O0):
define void @foo(i32** %0, i64 %1) {
%3 = alloca i32**
%4 = alloca i64
store i32** %0, i32*** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = inttoptr i64 %5 to i32*
%7 = load i32**, i32*** %3
store i32* %6, i32** %7
ret void
}

LLVM IR (-O2):
define void @foo(i32** nocapture writeonly %0, i64 %1) {
%3 = inttoptr i64 %1 to i32*
store i32* %3, i32** %0
ret void
}
void foo055(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo055(i32 %0) {
ret void
}
int addTwoInts(int a, int b) { return a + b; }


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

x86 assembly (clang, -O2):
<addTwoInts>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @addTwoInts(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 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @addTwoInts(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int x = 3;
  int z = 10;
  int cnt;
  for (cnt = 0; cnt < z; cnt++) {
    x++;
    cnt++;
  }
  printf("%d\n", cnt);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x3,-0x14(%rbp)
movl   $0xa,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1167 <main+0x57>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113b <main+0x2b>
mov    -0x1c(%rbp),%esi
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 3, i32* %6
store i32 10, i32* %7
store i32 0, i32* %8
br label %9
9: ; preds = %18, %2
%10 = load i32, i32* %8
%11 = load i32, i32* %7
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %21
13: ; preds = %9
%14 = load i32, i32* %6
%15 = add nsw i32 %14, 1
store i32 %15, i32* %6
%16 = load i32, i32* %8
%17 = add nsw i32 %16, 1
store i32 %17, i32* %8
br label %18
18: ; preds = %13
%19 = load i32, i32* %8
%20 = add nsw i32 %19, 1
store i32 %20, i32* %8
br label %9
21: ; preds = %9
%22 = load i32, i32* %8
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ TimerEnable(int, int);
void wave_cap32_start(void) { TimerEnable(0x40030000, 0x000000ff); }


x86 assembly (clang, -O0):
<wave_cap32_start>:
push   %rbp
mov    %rsp,%rbp
mov    $0x40030000,%edi
mov    $0xff,%esi
call   1030 <TimerEnable@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<wave_cap32_start>:
mov    $0x40030000,%edi
mov    $0xff,%esi
jmp    1030 <TimerEnable@plt>

LLVM IR (-O0):
define void @wave_cap32_start() {
%1 = call i32 @TimerEnable(i32 1073938432, i32 255)
ret void
}

LLVM IR (-O2):
define void @wave_cap32_start() {
%1 = tail call i32 @TimerEnable(i32 1073938432, i32 255)
ret void
}
void _Jv_Throw() {}


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

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

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

LLVM IR (-O2):
define void @_Jv_Throw() {
ret void
}
int skb_cloned(const struct sk_buff *skb) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.sk_buff = type opaque
define i32 @skb_cloned(%struct.sk_buff* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void fail(char *msg) {
  fprintf(stderr, "Fatal error: %s\n\n", msg);
  exit(1);
}


x86 assembly (clang, -O0):
<fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<fail>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"Fatal error: %s\0A\0A\00"
define void @fail(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"Fatal error: %s\0A\0A\00"
define void @fail(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ bwlzh_decompress_gen(unsigned char *, int const,
                                        unsigned int *, int);
void bwlzh_decompress_verbose(unsigned char *input, const int nvals,
                              unsigned int *vals) {
  bwlzh_decompress_gen(input, nvals, vals, 1);
}


x86 assembly (clang, -O0):
<bwlzh_decompress_verbose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    $0x1,%ecx
call   1030 <bwlzh_decompress_gen@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bwlzh_decompress_verbose>:
mov    $0x1,%ecx
jmp    1030 <bwlzh_decompress_gen@plt>

LLVM IR (-O0):
define void @bwlzh_decompress_verbose(i8* %0, i32 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32*, i32** %6
%10 = call i32 @bwlzh_decompress_gen(i8* %7, i32 %8, i32* %9, i32 1)
ret void
}

LLVM IR (-O2):
define void @bwlzh_decompress_verbose(i8* %0, i32 %1, i32* %2) {
%4 = tail call i32 @bwlzh_decompress_gen(i8* %0, i32 %1, i32* %2, i32 1)
ret void
}
/* Variables and functions */
bool nrf52_errata_211(void) { return false; }


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

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

LLVM IR (-O0):
define i32 @nrf52_errata_211() {
ret i32 0
}

LLVM IR (-O2):
define i32 @nrf52_errata_211() {
ret i32 0
}
/* Type definitions */
typedef scalar_t__ int64_t;
typedef scalar_t__ int32_t;

/* Variables and functions */
scalar_t__ __stdfix_sat_lr(scalar_t__);
int32_t __stdfix_ssub_lr(int32_t x, int32_t y) {
  return (__stdfix_sat_lr((int64_t)x - (int64_t)y));
}


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

x86 assembly (clang, -O2):
<__stdfix_ssub_lr>:
sub    %rsi,%rdi
jmp    1030 <__stdfix_sat_lr@plt>

LLVM IR (-O0):
define i64 @__stdfix_ssub_lr(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = sub nsw i64 %5, %6
%8 = call i64 @__stdfix_sat_lr(i64 %7)
ret i64 %8
}

LLVM IR (-O2):
define i64 @__stdfix_ssub_lr(i64 %0, i64 %1) {
%3 = sub nsw i64 %0, %1
%4 = tail call i64 @__stdfix_sat_lr(i64 %3)
ret i64 %4
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int compare_uint32_t(const uint32_t *lhs, const uint32_t *rhs) {
  assert(lhs != NULL && rhs != NULL);
  return (((*lhs) > (*rhs)) - ((*lhs) < (*rhs)));
}


x86 assembly (clang, -O0):
<compare_uint32_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     113b <compare_uint32_t+0x2b>
cmpq   $0x0,-0x10(%rbp)
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
mov    -0x10(%rbp),%rdx
cmp    (%rdx),%rcx
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_uint32_t>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
test   %rdi,%rdi
setne  %al
test   %rsi,%rsi
setne  %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
mov    (%rbx),%rcx
xor    %eax,%eax
xor    %edx,%edx
cmp    (%r14),%rcx
setg   %al
setl   %dl
sub    %edx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @compare_uint32_t(i64* %0, i64* %1) {
%3 = icmp ne i64* %0, null
%4 = icmp ne i64* %1, null
%5 = and i1 %3, %4
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = load i64, i64* %0
%9 = load i64, i64* %1
%10 = icmp sgt i64 %8, %9
%11 = zext i1 %10 to i32
%12 = icmp slt i64 %8, %9
%13 = sext i1 %12 to i32
%14 = add nsw i32 %13, %11
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void initiate_randomness(void) { srand(time(NULL)); }


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

x86 assembly (clang, -O2):
<initiate_randomness>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <srand@plt>

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

LLVM IR (-O2):
define void @initiate_randomness() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
ret void
}
int its_a_rectangle(int w, int h) {
  if (w != h)
    return 1;
}


x86 assembly (clang, -O0):
<its_a_rectangle>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     111d <its_a_rectangle+0x1d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @its_a_rectangle(i32 %0, i32 %1) {
ret i32 1
}
/* Variables and functions */
int aes_dec(char *, char *, char *);
int decrypt_aes(char *infile, char *outfile, char *deckey) {
  return aes_dec(infile, outfile, deckey);
}


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

x86 assembly (clang, -O2):
<decrypt_aes>:
jmp    1030 <aes_dec@plt>

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

LLVM IR (-O2):
define i32 @decrypt_aes(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @aes_dec(i8* %0, i8* %1, i8* %2)
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ EVP_PKEY_CTX;

/* Variables and functions */
int pkey_gost_derive_init(EVP_PKEY_CTX *ctx) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @pkey_gost_derive_init(i32* nocapture readnone %0) {
ret i32 1
}
void I422ToUYVY() {}


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

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

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

LLVM IR (-O2):
define void @I422ToUYVY() {
ret void
}
int is_prime(int num) {
  int i;
  for (i = 2; i < num; i++) {
    if ((num % i) == 0) {
      break;
    }
  }
  if (i == num) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1142 <is_prime+0x42>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    112f <is_prime+0x2f>
jmp    1142 <is_prime+0x42>
jmp    1134 <is_prime+0x34>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <is_prime+0xe>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    115a <is_prime+0x5a>
movl   $0x1,-0x4(%rbp)
jmp    1161 <is_prime+0x61>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_prime>:
mov    $0x2,%ecx
cmp    $0x3,%edi
jl     1122 <is_prime+0x22>
mov    $0x2,%ecx
nop
mov    %edi,%eax
cltd
idiv   %ecx
test   %edx,%edx
je     1122 <is_prime+0x22>
add    $0x1,%ecx
cmp    %ecx,%edi
jne    1110 <is_prime+0x10>
mov    %edi,%ecx
xor    %eax,%eax
cmp    %edi,%ecx
sete   %al
ret

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

LLVM IR (-O2):
define i32 @is_prime(i32 %0) {
%2 = icmp sgt i32 %0, 2
br i1 %2, label %3, label %10
3: ; preds = %1, %7
%4 = phi i32 [ %8, %7 ], [ 2, %1 ]
%5 = srem i32 %0, %4
%6 = icmp eq i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = add nuw nsw i32 %4, 1
%9 = icmp eq i32 %8, %0
br i1 %9, label %10, label %3
10: ; preds = %7, %3, %1
%11 = phi i32 [ 2, %1 ], [ %4, %3 ], [ %0, %7 ]
%12 = icmp eq i32 %11, %0
%13 = zext i1 %12 to i32
ret i32 %13
}
/* Variables and functions */
double __nv_sqrt(double);
double sqrt(double __a) { return __nv_sqrt(__a); }


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

x86 assembly (clang, -O2):
<sqrt>:
jmp    1030 <__nv_sqrt@plt>

LLVM IR (-O0):
define double @sqrt(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @__nv_sqrt(double %3)
ret double %4
}

LLVM IR (-O2):
define double @sqrt(double %0) {
%2 = tail call double @__nv_sqrt(double %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_autospawn_lock_release() {
  printf("NOT IMPLEMENTED:"
         "pa_autospawn_lock_release"
         "\n");
}


x86 assembly (clang, -O0):
<pa_autospawn_lock_release>:
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_autospawn_lock_release>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@str = [42 x i8] c"NOT IMPLEMENTED:pa_autospawn_lock_release\00"
define i32 @pa_autospawn_lock_release() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
int istext(const unsigned char input) {
  if ((input >= '0' && input <= '9') || (input >= 'a' && input <= 'z') ||
      input == ' ') {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<istext>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1124 <istext+0x24>
movzbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jle    114b <istext+0x4b>
movzbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     113e <istext+0x3e>
movzbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jle    114b <istext+0x4b>
movzbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jne    1157 <istext+0x57>
movl   $0x1,-0x4(%rbp)
jmp    115e <istext+0x5e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<istext>:
lea    -0x30(%rdi),%ecx
mov    $0x1,%eax
cmp    $0xa,%cl
jb     1121 <istext+0x21>
lea    -0x61(%rdi),%eax
cmp    $0x1a,%al
setb   %al
cmp    $0x20,%dil
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @istext(i8 zeroext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = icmp sge i32 %5, 48
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8, i8* %3
%9 = zext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %23, label %11
11: ; preds = %7, %1
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = icmp sge i32 %13, 97
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = load i8, i8* %3
%17 = zext i8 %16 to i32
%18 = icmp sle i32 %17, 122
br i1 %18, label %23, label %19
19: ; preds = %15, %11
%20 = load i8, i8* %3
%21 = zext i8 %20 to i32
%22 = icmp eq i32 %21, 32
br i1 %22, label %23, label %24
23: ; preds = %19, %15, %7
store i32 1, i32* %2
br label %25
24: ; preds = %19
store i32 0, i32* %2
br label %25
25: ; preds = %24, %23
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
define i32 @istext(i8 zeroext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = add i8 %0, -97
%6 = icmp ult i8 %5, 26
%7 = icmp eq i8 %0, 32
%8 = or i1 %7, %6
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %4, %1
%11 = phi i32 [ 1, %1 ], [ %9, %4 ]
ret i32 %11
}
int test_imm_5Euint16_reg(unsigned short val) {
  return ((val) & (0x5E << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_5Euint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0x5e,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_5Euint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 94
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ put32(unsigned int);
int /*<<< orphan*/ put8(int);
void mov_preg32preg32pimm32_reg8(int reg1, int reg2, unsigned int imm32,
                                 int reg8) {
  put8(0x88);
  put8(0x84 | (reg8 << 3));
  put8((reg2 << 3) | reg1);
  put32(imm32);
}


x86 assembly (clang, -O0):
<mov_preg32preg32pimm32_reg8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    $0x88,%edi
call   1030 <put8@plt>
mov    -0x10(%rbp),%edi
shl    $0x3,%edi
or     $0x84,%edi
call   1030 <put8@plt>
mov    -0x8(%rbp),%edi
shl    $0x3,%edi
or     -0x4(%rbp),%edi
call   1030 <put8@plt>
mov    -0xc(%rbp),%edi
call   1040 <put32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mov_preg32preg32pimm32_reg8>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%r15d
mov    $0x88,%edi
call   1030 <put8@plt>
shl    $0x3,%ebx
or     $0x84,%ebx
mov    %ebx,%edi
call   1030 <put8@plt>
shl    $0x3,%ebp
or     %r15d,%ebp
mov    %ebp,%edi
call   1030 <put8@plt>
mov    %r14d,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <put32@plt>

LLVM IR (-O0):
define void @mov_preg32preg32pimm32_reg8(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = call i32 @put8(i32 136)
%10 = load i32, i32* %8
%11 = shl i32 %10, 3
%12 = or i32 132, %11
%13 = call i32 @put8(i32 %12)
%14 = load i32, i32* %6
%15 = shl i32 %14, 3
%16 = load i32, i32* %5
%17 = or i32 %15, %16
%18 = call i32 @put8(i32 %17)
%19 = load i32, i32* %7
%20 = call i32 @put32(i32 %19)
ret void
}

LLVM IR (-O2):
define void @mov_preg32preg32pimm32_reg8(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @put8(i32 136)
%6 = shl i32 %3, 3
%7 = or i32 %6, 132
%8 = tail call i32 @put8(i32 %7)
%9 = shl i32 %1, 3
%10 = or i32 %9, %0
%11 = tail call i32 @put8(i32 %10)
%12 = tail call i32 @put32(i32 %2)
ret void
}
/* Type definitions */
struct timezone {
  int dummy;
};
struct timeval {
  double tv_sec;
  double tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, struct timezone *);
double __gettime() {
  struct timeval v;
  gettimeofday(&v, (struct timezone *)NULL);
  return v.tv_sec + v.tv_usec / 1.0e6;
}


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

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

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

LLVM IR (-O2):
%struct.timeval = type { double, double }
%struct.timezone = type { i32 }
define double @__gettime() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load double, double* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load double, double* %6
%8 = fdiv double %7, 1.000000e+06
%9 = fadd double %5, %8
ret double %9
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
int *malloc(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int *p = malloc(sizeof(int));
  free(p);
  int *q = malloc(sizeof(int));
  printf("%d\n", p == q);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <free@plt>
mov    $0x4,%edi
call   1050 <malloc@plt>
xor    %esi,%esi
cmp    %rax,%rbx
sete   %sil
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
store i32 0, i32* %1
%4 = call i32* @malloc(i32 4)
store i32* %4, i32** %2
%5 = load i32*, i32** %2
%6 = call i32 @free(i32* %5)
%7 = call i32* @malloc(i32 4)
store i32* %7, i32** %3
%8 = load i32*, i32** %2
%9 = load i32*, i32** %3
%10 = icmp eq i32* %8, %9
%11 = zext i1 %10 to i32
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32* @malloc(i32 4)
%2 = tail call i32 @free(i32* %1)
%3 = tail call i32* @malloc(i32 4)
%4 = icmp eq i32* %1, %3
%5 = zext i1 %4 to i32
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
void xxx(int argc) {
  int x;
#pragma omp master taskloop
  for (int i = 0; i < 10; ++i)
    argc = x;
}


x86 assembly (clang, -O0):
<xxx>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    112c <xxx+0x2c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <xxx+0xe>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @xxx(i32 %0) {
ret void
}
void WDTimerInit(unsigned long ulConfig) {
  ;
  (*((volatile unsigned long *)(0x40002C00))) &= ~0x0000007F;
  (*((volatile unsigned long *)(0x40002C00))) |= ulConfig;
}


x86 assembly (clang, -O0):
<WDTimerInit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0x40002c00,%eax
mov    (%rax),%rcx
and    $0xffffffffffffff80,%rcx
mov    $0x40002c00,%eax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    $0x40002c00,%ecx
mov    (%rcx),%rcx
or     %rax,%rcx
mov    $0x40002c00,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<WDTimerInit>:
andq   $0xffffffffffffff80,0x40002c00
40 80
or     %rdi,0x40002c00
40
ret

LLVM IR (-O0):
define void @WDTimerInit(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load volatile i64, i64* inttoptr (i64 1073753088 to i64*)
%4 = and i64 %3, -128
store volatile i64 %4, i64* inttoptr (i64 1073753088 to i64*)
%5 = load i64, i64* %2
%6 = load volatile i64, i64* inttoptr (i64 1073753088 to i64*)
%7 = or i64 %6, %5
store volatile i64 %7, i64* inttoptr (i64 1073753088 to i64*)
ret void
}

LLVM IR (-O2):
define void @WDTimerInit(i64 %0) {
%2 = load volatile i64, i64* inttoptr (i64 1073753088 to i64*)
%3 = and i64 %2, -128
store volatile i64 %3, i64* inttoptr (i64 1073753088 to i64*)
%4 = load volatile i64, i64* inttoptr (i64 1073753088 to i64*)
%5 = or i64 %4, %0
store volatile i64 %5, i64* inttoptr (i64 1073753088 to i64*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lua_error(char *);
void *realloc(void *, size_t);
void *luaI_realloc(void *oldblock, unsigned long size) {
  void *block = realloc(oldblock, (size_t)size);
  if (block == 0)
    lua_error("not enough memory");
  return block;
}


x86 assembly (clang, -O0):
<luaI_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1158 <luaI_realloc+0x38>
lea    0xead(%rip),%rdi
call   1040 <lua_error@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<luaI_realloc>:
push   %rbx
call   1030 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <luaI_realloc+0x1a>
lea    0xecb(%rip),%rdi
call   1040 <lua_error@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"not enough memory\00"
define i8* @luaI_realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @lua_error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %2
%14 = load i8*, i8** %5
ret i8* %14
}

LLVM IR (-O2):
@.str = [18 x i8] c"not enough memory\00"
define noalias i8* @luaI_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @lua_error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret i8* %3
}
void INT_Excep_SCIFA9_TXIF9(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_SCIFA9_TXIF9() {
ret void
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
uint16_t rot16r2(uint16_t x) { return (x >> 2) | (x << 14); }


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

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

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

LLVM IR (-O2):
define i32 @rot16r2(i32 %0) {
%2 = ashr i32 %0, 2
%3 = shl i32 %0, 14
%4 = or i32 %2, %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ HAL_IncTick();
int /*<<< orphan*/ Toggle_Leds();
void SysTick_Handler(void) {
  Toggle_Leds();
  HAL_IncTick();
}


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

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

LLVM IR (-O0):
define void @SysTick_Handler() {
%1 = call i32 (...) @Toggle_Leds()
%2 = call i32 (...) @HAL_IncTick()
ret void
}

LLVM IR (-O2):
define void @SysTick_Handler() {
%1 = tail call i32 (...) @Toggle_Leds()
%2 = tail call i32 (...) @HAL_IncTick()
ret void
}
/* Variables and functions */
int findBlockIndex(int, int, int);
int /*<<< orphan*/ printf(char *);
void setBlockAmount(int entId, int block, int amount) {
  if (amount == 0) {
    printf("Sorry, we cannot delete items yet - for now it will just have to "
           "be a zero entry item\n");
  }
  int index = findBlockIndex(entId, block, -1);
}


x86 assembly (clang, -O0):
<setBlockAmount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1147 <setBlockAmount+0x27>
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0xffffffff,%edx
call   1040 <findBlockIndex@plt>
mov    %eax,-0x10(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setBlockAmount>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
test   %edx,%edx
jne    1137 <setBlockAmount+0x17>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%edi
mov    %ebx,%esi
mov    $0xffffffff,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <findBlockIndex@plt>

LLVM IR (-O0):
@.str = [87 x i8] c"Sorry, we cannot delete items yet - for now it will just have to be a zero entry item\0A\00"
define void @setBlockAmount(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i32 @printf(i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %3
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = call i32 @findBlockIndex(i32 %13, i32 %14, i32 -1)
store i32 %15, i32* %7
ret void
}

LLVM IR (-O2):
@str = [86 x i8] c"Sorry, we cannot delete items yet - for now it will just have to be a zero entry item\00"
define void @setBlockAmount(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @str, i64 0, i64 0))
br label %7
7: ; preds = %5, %3
%8 = tail call i32 @findBlockIndex(i32 %0, i32 %1, i32 -1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isspace(int);
void t_isspace_0x46() {
  Assert_real((isspace(70) == 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_isspace.c",
              355, ("isspace should be 0 for F"));
}


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

x86 assembly (clang, -O2):
<t_isspace_0x46>:
push   %rax
mov    $0x46,%edi
call   1030 <isspace@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x163,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 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_isspace.c\00"
@.str.1 = [26 x i8] c"isspace should be 0 for F\00"
define void @t_isspace_0x46() {
%1 = call i64 @isspace(i32 70)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 355, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 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_isspace.c\00"
@.str.1 = [26 x i8] c"isspace should be 0 for F\00"
define void @t_isspace_0x46() {
%1 = tail call i64 @isspace(i32 70)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 355, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void EndSYNOPSIS_DARG(void) { fputs("@end table\n", stdout); }


x86 assembly (clang, -O0):
<EndSYNOPSIS_DARG>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <fputs@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<EndSYNOPSIS_DARG>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdi
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"@end table\0A\00"
@stdout = global i32 0
define void @EndSYNOPSIS_DARG() {
%1 = load i32, i32* @stdout
%2 = call i32 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"@end table\0A\00"
@stdout = global i32 0
define void @EndSYNOPSIS_DARG() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
double coxsafe(double x) {
  if (x < -200)
    return (-200);
  if (x > 22)
    return (22);
  return (x);
}


x86 assembly (clang, -O0):
<coxsafe>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  0xeef(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    112e <coxsafe+0x2e>
movsd  0xedc(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1161 <coxsafe+0x61>
movsd  -0x10(%rbp),%xmm0
movsd  0xecd(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1157 <coxsafe+0x57>
movsd  0xebb(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1161 <coxsafe+0x61>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<coxsafe>:
movsd  0xef8(%rip),%xmm1
minsd  %xmm0,%xmm1
movsd  0xef4(%rip),%xmm2
cmpltsd %xmm2,%xmm0
movapd %xmm0,%xmm3
andnpd %xmm1,%xmm3
andpd  %xmm2,%xmm0
orpd   %xmm3,%xmm0
ret

LLVM IR (-O0):
define double @coxsafe(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp olt double %4, -2.000000e+02
br i1 %5, label %6, label %7
6: ; preds = %1
store double -2.000000e+02, double* %2
br label %13
7: ; preds = %1
%8 = load double, double* %3
%9 = fcmp ogt double %8, 2.200000e+01
br i1 %9, label %10, label %11
10: ; preds = %7
store double 2.200000e+01, double* %2
br label %13
11: ; preds = %7
%12 = load double, double* %3
store double %12, double* %2
br label %13
13: ; preds = %11, %10, %6
%14 = load double, double* %2
ret double %14
}

LLVM IR (-O2):
define double @coxsafe(double %0) {
%2 = fcmp olt double %0, -2.000000e+02
%3 = fcmp ogt double %0, 2.200000e+01
%4 = select i1 %3, double 2.200000e+01, double %0
%5 = select i1 %2, double -2.000000e+02, double %4
ret double %5
}
__attribute__((__always___)) unsigned char readb(const volatile void *addr) {
  return *(volatile unsigned char *)addr;
}


x86 assembly (clang, -O0):
<readb>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<readb>:
mov    (%rdi),%al
ret

LLVM IR (-O0):
define zeroext i8 @readb(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load volatile i8, i8* %3
ret i8 %4
}

LLVM IR (-O2):
define zeroext i8 @readb(i8* %0) {
%2 = load volatile i8, i8* %0
ret i8 %2
}