xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
size_t offset(int, int, int);
uint8_t getpx(uint8_t *img, int w, int x, int y) {
  return img[offset(w, x, y)];
}


x86 assembly (clang, -O0):
<getpx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <offset@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    (%rax,%rcx,4),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getpx>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edi
mov    %edx,%esi
mov    %ecx,%edx
call   1030 <offset@plt>
mov    (%rbx,%rax,4),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @getpx(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 = load i32*, i32** %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i64 @offset(i32 %10, i32 %11, i32 %12)
%14 = getelementptr inbounds i32, i32* %9, i64 %13
%15 = load i32, i32* %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @getpx(i32* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i64 @offset(i32 %1, i32 %2, i32 %3)
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = load i32, i32* %6
ret i32 %7
}
int get_value(int i, int rshift) {
  int v;
  v = (i << 26) ^ (i << 18) ^ (i << 11) ^ (i << 3) ^ i;
  if (rshift < 32) {
    v &= (1 << rshift) - 1;
  }
  return v;
}


x86 assembly (clang, -O0):
<get_value>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1a,%eax
mov    -0x4(%rbp),%ecx
shl    $0x12,%ecx
xor    %ecx,%eax
mov    -0x4(%rbp),%ecx
shl    $0xb,%ecx
xor    %ecx,%eax
mov    -0x4(%rbp),%ecx
shl    $0x3,%ecx
xor    %ecx,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x20,-0x8(%rbp)
jge    114b <get_value+0x4b>
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
sub    $0x1,%eax
and    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_value>:
mov    %esi,%ecx
mov    %edi,%edx
shl    $0x12,%edx
mov    %edi,%eax
xor    %edi,%edx
lea    0x0(,%rdi,8),%esi
shl    $0x1a,%edi
shl    $0xb,%eax
xor    %edi,%eax
xor    %eax,%edx
xor    %esi,%edx
mov    $0xffffffff,%esi
mov    $0xffffffff,%eax
shl    %cl,%eax
cmp    $0x20,%ecx
not    %eax
cmovge %esi,%eax
and    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @get_value(i32 %0, i32 %1) {
%3 = shl i32 %0, 26
%4 = shl i32 %0, 18
%5 = shl i32 %0, 11
%6 = shl i32 %0, 3
%7 = xor i32 %4, %0
%8 = xor i32 %7, %3
%9 = xor i32 %8, %5
%10 = xor i32 %9, %6
%11 = icmp slt i32 %1, 32
%12 = shl nsw i32 -1, %1
%13 = xor i32 %12, -1
%14 = select i1 %11, i32 %13, i32 -1
%15 = and i32 %10, %14
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ AT_FDCWD;
int /*<<< orphan*/ O_RDONLY;
int openat(int /*<<< orphan*/, char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
void my_openat3() {
  int fd = openat(
      AT_FDCWD, "/home/zing/workspace/c/learn-c/cmake-build-debug/linux/fcntl",
      O_RDONLY);
  if (fd == -1) {
    perror("my_openat3");
    return;
  }
}


x86 assembly (clang, -O0):
<my_openat3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
mov    0x2eb0(%rip),%rax
mov    (%rax),%edx
lea    0xebf(%rip),%rsi
call   1030 <openat@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    115f <my_openat3+0x3f>
lea    0xee3(%rip),%rdi
call   1040 <perror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_openat3>:
push   %rax
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
mov    0x2eb7(%rip),%rax
mov    (%rax),%edx
lea    0xec6(%rip),%rsi
call   1030 <openat@plt>
cmp    $0xffffffff,%eax
je     1146 <my_openat3+0x26>
pop    %rax
ret
lea    0xef0(%rip),%rdi
pop    %rax
jmp    1040 <perror@plt>

LLVM IR (-O0):
@AT_FDCWD = global i32 0
@.str = [61 x i8] c"/home/zing/workspace/c/learn-c/cmake-build-debug/linux/fcntl\00"
@O_RDONLY = global i32 0
@.str.1 = [11 x i8] c"my_openat3\00"
define void @my_openat3() {
%1 = alloca i32
%2 = load i32, i32* @AT_FDCWD
%3 = load i32, i32* @O_RDONLY
%4 = call i32 @openat(i32 %2, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i32 %3)
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %7, %0
ret void
}

LLVM IR (-O2):
@AT_FDCWD = global i32 0
@.str = [61 x i8] c"/home/zing/workspace/c/learn-c/cmake-build-debug/linux/fcntl\00"
@O_RDONLY = global i32 0
@.str.1 = [11 x i8] c"my_openat3\00"
define void @my_openat3() {
%1 = load i32, i32* @AT_FDCWD
%2 = load i32, i32* @O_RDONLY
%3 = tail call i32 @openat(i32 %1, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %0, %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_make_realtime() {
  printf("NOT IMPLEMENTED:"
         "pa_make_realtime"
         "\n");
}


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

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

LLVM IR (-O2):
@str = [33 x i8] c"NOT IMPLEMENTED:pa_make_realtime\00"
define i32 @pa_make_realtime() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
main() {
  typedef struct A {
    int i, j, k;
    char buf[3];
  } A;
  A a = {};
  A b = {0};
  A c = {1};
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <memset@plt>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <memset@plt>
mov    0xec1(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xebe(%rip),%rax
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.A = type { i32, i32, i32, [3 x i8] }
@__const.main.c = %struct.A { i32 1, i32 0, i32 0, [3 x i8] zeroinitializer }
define i32 @main() {
%1 = alloca %struct.A
%2 = alloca %struct.A
%3 = alloca %struct.A
%4 = bitcast %struct.A* %1 to i8*
%5 = bitcast %struct.A* %2 to i8*
%6 = bitcast %struct.A* %3 to i8*
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int c() {
  printf("c() called\n");
  return 10;
}


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

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

LLVM IR (-O0):
@.str = [12 x i8] c"c() called\0A\00"
define i32 @c() {
%1 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 10
}

LLVM IR (-O2):
@str = [11 x i8] c"c() called\00"
define i32 @c() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret i32 10
}
int sum1(int x) {
  int i, sum = 0;
  for (i = 0; i <= x; i++)
    sum += i;
  return sum;
}


x86 assembly (clang, -O0):
<sum1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1138 <sum1+0x38>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1115 <sum1+0x15>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum1>:
mov    %edi,%eax
lea    -0x1(%rdi),%ecx
imul   %rax,%rcx
shr    %rcx
add    %edi,%ecx
xor    %eax,%eax
test   %edi,%edi
cmovns %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @sum1(i32 %0) {
%2 = icmp slt i32 %0, 0
%3 = zext i32 %0 to i33
%4 = add nsw i32 %0, -1
%5 = zext i32 %4 to i33
%6 = mul i33 %3, %5
%7 = lshr i33 %6, 1
%8 = trunc i33 %7 to i32
%9 = add i32 %8, %0
%10 = select i1 %2, i32 0, i32 %9
ret i32 %10
}
/* Variables and functions */
scalar_t__ bad(unsigned int);
int bads(unsigned n) {
  unsigned i;
  for (i = 0; i < n; i++) {
    if (bad(i)) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<bads>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    115f <bads+0x4f>
mov    -0xc(%rbp),%edi
call   1030 <bad@plt>
cmp    $0x0,%rax
je     114c <bads+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    1166 <bads+0x56>
jmp    1151 <bads+0x41>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1122 <bads+0x12>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bads>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
je     1133 <bads+0x23>
mov    %edi,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1030 <bad@plt>
test   %rax,%rax
jne    1137 <bads+0x27>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1120 <bads+0x10>
xor    %eax,%eax
jmp    113c <bads+0x2c>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @bads(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %5
3: ; preds = %5
%4 = icmp eq i32 %9, %0
br i1 %4, label %10, label %5
5: ; preds = %1, %3
%6 = phi i32 [ %9, %3 ], [ 0, %1 ]
%7 = tail call i64 @bad(i32 %6)
%8 = icmp eq i64 %7, 0
%9 = add nuw i32 %6, 1
br i1 %8, label %3, label %10
10: ; preds = %5, %3, %1
%11 = phi i32 [ 0, %1 ], [ 0, %3 ], [ 1, %5 ]
ret i32 %11
}
/* Type definitions */
struct AVLNode {
  int dummy;
};

/* Variables and functions */
struct AVLNode **_search_in(struct AVLNode **, struct AVLNode **, void *);
struct AVLNode *_search(struct AVLNode *tree, void *key) {
  struct AVLNode *hot = NULL;
  struct AVLNode **ret = _search_in(&tree, &hot, key);
  return *ret;
}


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

x86 assembly (clang, -O2):
<_search>:
sub    $0x18,%rsp
mov    %rsi,%rdx
mov    %rdi,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <_search_in@plt>
mov    (%rax),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.AVLNode = type { i32 }
define %struct.AVLNode* @_search(%struct.AVLNode* %0, i8* %1) {
%3 = alloca %struct.AVLNode*
%4 = alloca i8*
%5 = alloca %struct.AVLNode*
%6 = alloca %struct.AVLNode**
store %struct.AVLNode* %0, %struct.AVLNode** %3
store i8* %1, i8** %4
store %struct.AVLNode* null, %struct.AVLNode** %5
%7 = load i8*, i8** %4
%8 = call %struct.AVLNode** @_search_in(%struct.AVLNode** %3, %struct.AVLNode** %5, i8* %7)
store %struct.AVLNode** %8, %struct.AVLNode*** %6
%9 = load %struct.AVLNode**, %struct.AVLNode*** %6
%10 = load %struct.AVLNode*, %struct.AVLNode** %9
ret %struct.AVLNode* %10
}

LLVM IR (-O2):
%struct.AVLNode = type { i32 }
define %struct.AVLNode* @_search(%struct.AVLNode* %0, i8* %1) {
%3 = alloca %struct.AVLNode*
%4 = alloca %struct.AVLNode*
store %struct.AVLNode* %0, %struct.AVLNode** %3
%5 = bitcast %struct.AVLNode** %4 to i8*
store %struct.AVLNode* null, %struct.AVLNode** %4
%6 = call %struct.AVLNode** @_search_in(%struct.AVLNode** %3, %struct.AVLNode** %4, i8* %1)
%7 = load %struct.AVLNode*, %struct.AVLNode** %6
ret %struct.AVLNode* %7
}
/* Type definitions */
struct pattern {
  int dummy;
};

/* Variables and functions */
int offset(int, int, int, int);
int /*<<< orphan*/ play_attack_defend_n(int, int, int, int, int, int);
int autohelperowl_attackpat114(struct pattern *patt, int transformation,
                               int move, int color, int action) {
  int a;
  (void)patt;
  (void)color;
  (void)action;
  a = offset(-1, -1, move, transformation);
  return !play_attack_defend_n(color, 1, 2, a, move, move);
}


x86 assembly (clang, -O0):
<autohelperowl_attackpat114>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    $0xffffffff,%esi
mov    %esi,%edi
call   1040 <offset@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0x10(%rbp),%r9d
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <play_attack_defend_n@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<autohelperowl_attackpat114>:
push   %rbp
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %edx,%ebp
mov    %esi,%ecx
mov    $0xffffffff,%edi
mov    $0xffffffff,%esi
call   1040 <offset@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    $0x2,%edx
mov    %eax,%ecx
mov    %ebp,%r8d
mov    %ebp,%r9d
call   1030 <play_attack_defend_n@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.pattern = type { i32 }
define i32 @autohelperowl_attackpat114(%struct.pattern* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca %struct.pattern*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store %struct.pattern* %0, %struct.pattern** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%12 = load %struct.pattern*, %struct.pattern** %6
%13 = load i32, i32* %9
%14 = load i32, i32* %10
%15 = load i32, i32* %8
%16 = load i32, i32* %7
%17 = call i32 @offset(i32 -1, i32 -1, i32 %15, i32 %16)
store i32 %17, i32* %11
%18 = load i32, i32* %9
%19 = load i32, i32* %11
%20 = load i32, i32* %8
%21 = load i32, i32* %8
%22 = call i32 @play_attack_defend_n(i32 %18, i32 1, i32 2, i32 %19, i32 %20, i32 %21)
%23 = icmp ne i32 %22, 0
%24 = xor i1 %23, true
%25 = zext i1 %24 to i32
ret i32 %25
}

LLVM IR (-O2):
%struct.pattern = type { i32 }
define i32 @autohelperowl_attackpat114(%struct.pattern* nocapture readnone %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @offset(i32 -1, i32 -1, i32 %2, i32 %1)
%7 = tail call i32 @play_attack_defend_n(i32 %3, i32 1, i32 2, i32 %6, i32 %2, i32 %2)
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}
int test_imm_53int32_reg(int val) { return ((val) & (0x53 << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_53int32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x53,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_53int32_reg(i32 %0) {
%2 = and i32 %0, 83
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int rt_sysc_r32(int);
int mt7620_get_eco(void) { return rt_sysc_r32(0x0c) & 0xf; }


x86 assembly (clang, -O0):
<mt7620_get_eco>:
push   %rbp
mov    %rsp,%rbp
mov    $0xc,%edi
call   1030 <rt_sysc_r32@plt>
and    $0xf,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mt7620_get_eco>:
push   %rax
mov    $0xc,%edi
call   1030 <rt_sysc_r32@plt>
and    $0xf,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @mt7620_get_eco() {
%1 = call i32 @rt_sysc_r32(i32 12)
%2 = and i32 %1, 15
ret i32 %2
}

LLVM IR (-O2):
define i32 @mt7620_get_eco() {
%1 = tail call i32 @rt_sysc_r32(i32 12)
%2 = and i32 %1, 15
ret i32 %2
}
/* Type definitions */
typedef scalar_t__ uint16_t;

/* Variables and functions */
int inb(scalar_t__);
int serial_transmit_empty(uint16_t port) { return inb(port + 5) & 0x20; }


x86 assembly (clang, -O0):
<serial_transmit_empty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x5,%rdi
call   1030 <inb@plt>
and    $0x20,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serial_transmit_empty>:
push   %rax
add    $0x5,%rdi
call   1030 <inb@plt>
and    $0x20,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @serial_transmit_empty(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add nsw i64 %3, 5
%5 = call i32 @inb(i64 %4)
%6 = and i32 %5, 32
ret i32 %6
}

LLVM IR (-O2):
define i32 @serial_transmit_empty(i64 %0) {
%2 = add nsw i64 %0, 5
%3 = tail call i32 @inb(i64 %2)
%4 = and i32 %3, 32
ret i32 %4
}
/* Type definitions */
struct hedtri {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free_object(int, short *);
void free_hedtri(struct hedtri *tri) { free_object(62, (short *)tri); }


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

x86 assembly (clang, -O2):
<free_hedtri>:
mov    %rdi,%rsi
mov    $0x3e,%edi
jmp    1030 <free_object@plt>

LLVM IR (-O0):
%struct.hedtri = type { i32 }
define void @free_hedtri(%struct.hedtri* %0) {
%2 = alloca %struct.hedtri*
store %struct.hedtri* %0, %struct.hedtri** %2
%3 = load %struct.hedtri*, %struct.hedtri** %2
%4 = bitcast %struct.hedtri* %3 to i16*
%5 = call i32 @free_object(i32 62, i16* %4)
ret void
}

LLVM IR (-O2):
%struct.hedtri = type { i32 }
define void @free_hedtri(%struct.hedtri* %0) {
%2 = bitcast %struct.hedtri* %0 to i16*
%3 = tail call i32 @free_object(i32 62, i16* %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct in_addr {
  int /*<<< orphan*/ s_addr;
};

/* Variables and functions */
char *inet_ntoa(struct in_addr);
char *printip(uint32_t ip) {
  struct in_addr in;
  in.s_addr = ip;
  return inet_ntoa(in);
}


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

x86 assembly (clang, -O2):
<printip>:
jmp    1030 <inet_ntoa@plt>

LLVM IR (-O0):
%struct.in_addr = type { i32 }
define i8* @printip(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.in_addr
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %3, i32 0, i32 0
store i32 %4, i32* %5
%6 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %3, i32 0, i32 0
%7 = load i32, i32* %6
%8 = call i8* @inet_ntoa(i32 %7)
ret i8* %8
}

LLVM IR (-O2):
define i8* @printip(i32 %0) {
%2 = tail call i8* @inet_ntoa(i32 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ nc_error(char *);
void *realloc(void *, size_t);
void *MYrealloc(void *ptr, size_t size) {
  void *r;
  if (!(r = realloc(ptr, size)))
    nc_error("memory allocation rejected!");
  return r;
}


x86 assembly (clang, -O0):
<MYrealloc>:
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)
cmp    $0x0,%rax
jne    1157 <MYrealloc+0x37>
lea    0xeae(%rip),%rdi
call   1040 <nc_error@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [28 x i8] c"memory allocation rejected!\00"
define i8* @MYrealloc(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 = icmp ne i8* %8, null
br i1 %9, label %12, label %10
10: ; preds = %2
%11 = call i32 @nc_error(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %2
%13 = load i8*, i8** %5
ret i8* %13
}

LLVM IR (-O2):
@.str = [28 x i8] c"memory allocation rejected!\00"
define noalias i8* @MYrealloc(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 @nc_error(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print(int *array, int size) {
  int i;
  for (i = 0; i < size; i++) {
    printf(" %d", array[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <print+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <print+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <print+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c" %d\00"
define void @print(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close_database();
void free_global_memory_database() { close_database(); }


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

x86 assembly (clang, -O2):
<free_global_memory_database>:
xor    %eax,%eax
jmp    1030 <close_database@plt>

LLVM IR (-O0):
define void @free_global_memory_database() {
%1 = call i32 (...) @close_database()
ret void
}

LLVM IR (-O2):
define void @free_global_memory_database() {
%1 = tail call i32 (...) @close_database()
ret void
}
unsigned long int unsignedlongint_ignoring_unsignedlong(unsigned long int x,
                                                        unsigned long y) {
  return x;
}


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

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

LLVM IR (-O0):
define i64 @unsignedlongint_ignoring_unsignedlong(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
ret i64 %5
}

LLVM IR (-O2):
define i64 @unsignedlongint_ignoring_unsignedlong(i64 returned %0, i64 %1) {
ret i64 %0
}
/* Variables and functions */
int strlen(char *);
int string_len_strlen(char *text_string) { return strlen(text_string) - 1; }


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

x86 assembly (clang, -O2):
<string_len_strlen>:
push   %rax
call   1030 <strlen@plt>
add    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @string_len_strlen(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @strlen(i8* %3)
%5 = sub nsw i32 %4, 1
ret i32 %5
}

LLVM IR (-O2):
define i32 @string_len_strlen(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, -1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(void *);
void *realloc(void *, size_t);
int /*<<< orphan*/ stderr;
void *safe_realloc(void *ptr, size_t new_size) {
  void *temp_ptr = realloc(ptr, new_size);
  if (temp_ptr == NULL) {
    fprintf(stderr, "Unexpected behaviour: realloc");
    free(ptr);
    exit(1);
  }
  return temp_ptr;
}


x86 assembly (clang, -O0):
<safe_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   1050 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1194 <safe_realloc+0x54>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
lea    0xe84(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_realloc>:
push   %rbx
mov    %rdi,%rbx
call   1050 <realloc@plt>
test   %rax,%rax
je     1150 <safe_realloc+0x10>
pop    %rbx
ret
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
lea    0xea0(%rip),%rsi
call   1040 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c"Unexpected behaviour: realloc\00"
define i8* @safe_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 %17
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%14 = load i8*, i8** %3
%15 = call i32 @free(i8* %14)
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %2
%18 = load i8*, i8** %5
ret i8* %18
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"Unexpected behaviour: realloc\00"
define noalias i8* @safe_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 %10
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @free(i8* %0)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
ret i8* %3
}
char *sp_make_system_slash(char *path) {
  char *save = path;
  while (*path) {
    if (*path == '\\')
      *path = '/';
    path++;
  }
  return save;
}


x86 assembly (clang, -O0):
<sp_make_system_slash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <sp_make_system_slash+0x45>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    1134 <sp_make_system_slash+0x34>
mov    -0x8(%rbp),%rax
movb   $0x2f,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <sp_make_system_slash+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sp_make_system_slash>:
mov    %rdi,%rax
mov    %rdi,%rcx
jmp    1117 <sp_make_system_slash+0x17>
nopl   0x0(%rax,%rax,1)
movb   $0x2f,(%rcx)
add    $0x1,%rcx
movzbl (%rcx),%edx
cmp    $0x5c,%dl
je     1110 <sp_make_system_slash+0x10>
test   %dl,%dl
jne    1113 <sp_make_system_slash+0x13>
ret

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

LLVM IR (-O2):
define i8* @sp_make_system_slash(i8* returned %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = load i8, i8* %3
switch i8 %4, label %6 [
i8 0, label %8
i8 92, label %5
]
5: ; preds = %2
store i8 47, i8* %3
br label %6
6: ; preds = %2, %5
%7 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
8: ; preds = %2
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
void __attribute__((constructor)) mdbg_init_mem_alloc(void) {
  write(2, "init\n", 5);
}


x86 assembly (clang, -O0):
<mdbg_init_mem_alloc>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
lea    0xee0(%rip),%rsi
mov    $0x5,%edx
call   1030 <write@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<mdbg_init_mem_alloc>:
lea    0xee9(%rip),%rsi
mov    $0x2,%edi
mov    $0x5,%edx
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"init\0A\00"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @mdbg_init_mem_alloc, i8* null }]
define void @mdbg_init_mem_alloc() {
%1 = call i32 @write(i32 2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"init\0A\00"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @mdbg_init_mem_alloc, i8* null }]
define void @mdbg_init_mem_alloc() {
%1 = tail call i32 @write(i32 2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ atomic_postadd_uint64_t(int /*<<< orphan*/ *, int);
uint64_t atomic_postinc_uint64_t(uint64_t *var) {
  return atomic_postadd_uint64_t(var, 1);
}


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

x86 assembly (clang, -O2):
<atomic_postinc_uint64_t>:
mov    $0x1,%esi
jmp    1030 <atomic_postadd_uint64_t@plt>

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

LLVM IR (-O2):
define i32 @atomic_postinc_uint64_t(i32* %0) {
%2 = tail call i32 @atomic_postadd_uint64_t(i32* %0, i32 1)
ret i32 %2
}
void hugo_samplevolume(int vol) {}


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

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

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

LLVM IR (-O2):
define void @hugo_samplevolume(i32 %0) {
ret void
}
adrx0adr1_set(r0, r1, x0, x1, p0, p1) float r0, r1;
float *p0, *p1;
{
  (((float *)10000000)[x0]) =
      (*((float *)(11111111 & ~(__alignof__(float) - 1))));
}


x86 assembly (clang, -O0):
<adrx0adr1_set>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm1,-0x30(%rbp)
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
cvtsd2ss %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm0
movss  %xmm1,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    $0xa98ac4,%eax
movss  (%rax),%xmm0
movslq -0x10(%rbp),%rcx
mov    $0x989680,%eax
movss  %xmm0,(%rax,%rcx,4)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adrx0adr1_set>:
movss  0xa98ac4,%xmm0
movslq %edi,%rax
movss  %xmm0,0x989680(,%rax,4)
ret

LLVM IR (-O0):
define i32 @adrx0adr1_set(double %0, double %1, i32 %2, i32 %3, float* %4, float* %5) {
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca i32
%12 = alloca float*
%13 = alloca float*
%14 = fptrunc double %0 to float
%15 = fptrunc double %1 to float
store float %14, float* %8
store float %15, float* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store float* %4, float** %12
store float* %5, float** %13
%16 = load float, float* inttoptr (i64 11111108 to float*)
%17 = load i32, i32* %10
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds float, float* inttoptr (i64 10000000 to float*), i64 %18
store float %16, float* %19
%20 = load i32, i32* %7
ret i32 %20
}

LLVM IR (-O2):
define i32 @adrx0adr1_set(double %0, double %1, i32 %2, i32 %3, float* nocapture readnone %4, float* nocapture readnone %5) {
%7 = load float, float* inttoptr (i64 11111108 to float*)
%8 = sext i32 %2 to i64
%9 = getelementptr inbounds float, float* inttoptr (i64 10000000 to float*), i64 %8
store float %7, float* %9
ret i32 undef
}
/* Type definitions */
typedef scalar_t__ pid_t;

/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
scalar_t__ waitpid(int, int *, int /*<<< orphan*/);
void pce_sigchld_handler(int signal) {
  pid_t pid;
  int status;
  do {
    pid = waitpid(-1, &status, WNOHANG);
  } while (pid > 0);
}


x86 assembly (clang, -O0):
<pce_sigchld_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
lea    -0x14(%rbp),%rsi
call   1030 <waitpid@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jg     111b <pce_sigchld_handler+0xb>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pce_sigchld_handler>:
push   %r14
push   %rbx
push   %rax
mov    0x2ecd(%rip),%r14
lea    0x4(%rsp),%rbx
mov    (%r14),%edx
mov    $0xffffffff,%edi
mov    %rbx,%rsi
call   1030 <waitpid@plt>
test   %rax,%rax
jg     1120 <pce_sigchld_handler+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@WNOHANG = global i32 0
define void @pce_sigchld_handler(i32 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i32
store i32 %0, i32* %2
br label %5
5: ; preds = %8, %1
%6 = load i32, i32* @WNOHANG
%7 = call i64 @waitpid(i32 -1, i32* %4, i32 %6)
store i64 %7, i64* %3
br label %8
8: ; preds = %5
%9 = load i64, i64* %3
%10 = icmp sgt i64 %9, 0
br i1 %10, label %5, label %11
11: ; preds = %8
ret void
}

LLVM IR (-O2):
@WNOHANG = global i32 0
define void @pce_sigchld_handler(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
br label %4
4: ; preds = %4, %1
%5 = load i32, i32* @WNOHANG
%6 = call i64 @waitpid(i32 -1, i32* %2, i32 %5)
%7 = icmp sgt i64 %6, 0
br i1 %7, label %4, label %8
8: ; preds = %4
ret void
}
/* Variables and functions */
unsigned short size2hash(size_t size) {
  if (size <= (16 * 128)) {
    return (unsigned short)(size + 16 - 1) / 16;
  } else if (size <= ((16 * 128) + (64 * 608))) {
    return (unsigned short)(size - (16 * 128) + 64 - 1) / 64 + 128;
  } else {
    return 0xffff;
  }
}


x86 assembly (clang, -O0):
<size2hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x800,-0x10(%rbp)
ja     1136 <size2hash+0x36>
mov    -0x10(%rbp),%rax
add    $0x10,%rax
sub    $0x1,%rax
movzwl %ax,%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %ax,-0x2(%rbp)
jmp    1175 <size2hash+0x75>
cmpq   $0xa000,-0x10(%rbp)
ja     116f <size2hash+0x6f>
mov    -0x10(%rbp),%rax
sub    $0x800,%rax
add    $0x40,%rax
sub    $0x1,%rax
movzwl %ax,%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
add    $0x80,%eax
mov    %ax,-0x2(%rbp)
jmp    1175 <size2hash+0x75>
movw   $0xffff,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<size2hash>:
cmp    $0x800,%rdi
ja     1113 <size2hash+0x13>
add    $0xf,%edi
movzwl %di,%eax
shr    $0x4,%eax
ret
mov    $0xffff,%ax
cmp    $0xa000,%rdi
ja     112f <size2hash+0x2f>
add    $0xfffff83f,%edi
movzwl %di,%eax
shr    $0x6,%eax
sub    $0xffffff80,%eax
ret

LLVM IR (-O0):
define zeroext i16 @size2hash(i64 %0) {
%2 = alloca i16
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = icmp ule i64 %4, 2048
br i1 %5, label %6, label %14
6: ; preds = %1
%7 = load i64, i64* %3
%8 = add i64 %7, 16
%9 = sub i64 %8, 1
%10 = trunc i64 %9 to i16
%11 = zext i16 %10 to i32
%12 = sdiv i32 %11, 16
%13 = trunc i32 %12 to i16
store i16 %13, i16* %2
br label %28
14: ; preds = %1
%15 = load i64, i64* %3
%16 = icmp ule i64 %15, 40960
br i1 %16, label %17, label %27
17: ; preds = %14
%18 = load i64, i64* %3
%19 = sub i64 %18, 2048
%20 = add i64 %19, 64
%21 = sub i64 %20, 1
%22 = trunc i64 %21 to i16
%23 = zext i16 %22 to i32
%24 = sdiv i32 %23, 64
%25 = add nsw i32 %24, 128
%26 = trunc i32 %25 to i16
store i16 %26, i16* %2
br label %28
27: ; preds = %14
store i16 -1, i16* %2
br label %28
28: ; preds = %27, %17, %6
%29 = load i16, i16* %2
ret i16 %29
}

LLVM IR (-O2):
define zeroext i16 @size2hash(i64 %0) {
%2 = icmp ult i64 %0, 2049
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = trunc i64 %0 to i16
%5 = add nuw nsw i16 %4, 15
%6 = lshr i16 %5, 4
br label %14
7: ; preds = %1
%8 = icmp ult i64 %0, 40961
br i1 %8, label %9, label %14
9: ; preds = %7
%10 = trunc i64 %0 to i16
%11 = add i16 %10, -1985
%12 = lshr i16 %11, 6
%13 = add nuw nsw i16 %12, 128
br label %14
14: ; preds = %7, %9, %3
%15 = phi i16 [ %6, %3 ], [ %13, %9 ], [ -1, %7 ]
ret i16 %15
}
/* Variables and functions */
int orig_listen(int, int);
int listen(int sockfd, int backlog) {
  if (backlog < 8)
    backlog = 8;
  return orig_listen(sockfd, backlog);
}


x86 assembly (clang, -O0):
<listen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jge    112f <listen+0x1f>
movl   $0x8,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <orig_listen@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<listen>:
cmp    $0x9,%esi
mov    $0x8,%eax
cmovl  %eax,%esi
jmp    1030 <orig_listen@plt>

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

LLVM IR (-O2):
define i32 @listen(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 8
%4 = select i1 %3, i32 %1, i32 8
%5 = tail call i32 @orig_listen(i32 %0, i32 %4)
ret i32 %5
}
void mt_dcm_restore(void) {}


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

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

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

LLVM IR (-O2):
define void @mt_dcm_restore() {
ret void
}
int sum(int p1, int p2) { return p1 + p2; }


x86 assembly (clang, -O0):
<sum>:
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):
<sum>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @sum(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 @sum(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ text;
};
struct TYPE_4__ {
  TYPE_1__ data;
};
typedef TYPE_2__ XIMStatusDrawCallbackStruct;

/* Variables and functions */
void *get_XIMStatusDrawCallbackStruct_data_text(void *_p) {
  return (void *)((XIMStatusDrawCallbackStruct *)_p)->data.text;
}


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

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

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i64 }
define i8* @get_XIMStatusDrawCallbackStruct_data_text(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_4__*
%5 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i32 0, i32 0
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 0
%7 = load i64, i64* %6
%8 = inttoptr i64 %7 to i8*
ret i8* %8
}

LLVM IR (-O2):
define i8* @get_XIMStatusDrawCallbackStruct_data_text(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
void SDCard_DisableTxInt(void) {}


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

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

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

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

/* Variables and functions */
int get_parent_pid(int);
int /*<<< orphan*/ printf(char *, int);
void process_pid(pid_t pid) {
  pid_t parent = 0;
  while ((parent = get_parent_pid(pid)) != 0) {
    pid = parent;
    printf("%d\n", parent);
  }
}


x86 assembly (clang, -O0):
<process_pid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <get_parent_pid@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     1160 <process_pid+0x40>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
jmp    1132 <process_pid+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_pid>:
push   %r14
push   %rbx
push   %rax
call   1040 <get_parent_pid@plt>
test   %eax,%eax
je     1157 <process_pid+0x37>
mov    %eax,%ebx
lea    0xeca(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,%edi
call   1040 <get_parent_pid@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    1140 <process_pid+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define void @process_pid(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %8, %1
%5 = load i32, i32* %2
%6 = call i32 @get_parent_pid(i32 %5)
store i32 %6, i32* %3
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = load i32, i32* %3
store i32 %9, i32* %2
%10 = load i32, i32* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %4
12: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @process_pid(i32 %0) {
%2 = tail call i32 @get_parent_pid(i32 %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ %2, %1 ]
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 @get_parent_pid(i32 %5)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %1
ret void
}