xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ CompileArgument();
int /*<<< orphan*/ WriteInstruction(char *);
void CR_Beep(void) {
  CompileArgument();
  WriteInstruction("ld (sndtyp),a");
}


x86 assembly (clang, -O0):
<CR_Beep>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <CompileArgument@plt>
lea    0xece(%rip),%rdi
call   1040 <WriteInstruction@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<CR_Beep>:
push   %rax
xor    %eax,%eax
call   1030 <CompileArgument@plt>
lea    0xed1(%rip),%rdi
pop    %rax
jmp    1040 <WriteInstruction@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"ld (sndtyp),a\00"
define void @CR_Beep() {
%1 = call i32 (...) @CompileArgument()
%2 = call i32 @WriteInstruction(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"ld (sndtyp),a\00"
define void @CR_Beep() {
%1 = tail call i32 (...) @CompileArgument()
%2 = tail call i32 @WriteInstruction(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EAST_BL(int);
scalar_t__ EAST_BR_0(int);
int if_op(bool aa, int bb, int cc) {
  EAST_BL(3);
  int ret = cc;
  if (EAST_BR_0(aa)) {
    EAST_BL(4);
    ret = bb;
  }
  return ret;
}


x86 assembly (clang, -O0):
<if_op>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    $0x3,%edi
call   1040 <EAST_BL@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <EAST_BR_0@plt>
cmp    $0x0,%rax
je     1163 <if_op+0x43>
mov    $0x4,%edi
call   1040 <EAST_BL@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<if_op>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %esi,%r14d
mov    %edi,%ebx
mov    $0x3,%edi
call   1040 <EAST_BL@plt>
mov    %ebx,%edi
call   1030 <EAST_BR_0@plt>
test   %rax,%rax
je     114e <if_op+0x2e>
mov    $0x4,%edi
call   1040 <EAST_BL@plt>
mov    %r14d,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @if_op(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 = call i32 @EAST_BL(i32 3)
%9 = load i32, i32* %6
store i32 %9, i32* %7
%10 = load i32, i32* %4
%11 = call i64 @EAST_BR_0(i32 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %3
%14 = call i32 @EAST_BL(i32 4)
%15 = load i32, i32* %5
store i32 %15, i32* %7
br label %16
16: ; preds = %13, %3
%17 = load i32, i32* %7
ret i32 %17
}

LLVM IR (-O2):
define i32 @if_op(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @EAST_BL(i32 3)
%5 = tail call i64 @EAST_BR_0(i32 %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call i32 @EAST_BL(i32 4)
br label %9
9: ; preds = %7, %3
%10 = phi i32 [ %1, %7 ], [ %2, %3 ]
ret i32 %10
}
int myatoi(const char *s) {
  int v = 0;
  for (; *s; s++) {
    v *= 10;
    v += (*s - '0');
  }
  return v;
}


x86 assembly (clang, -O0):
<myatoi>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1144 <myatoi+0x44>
imul   $0xa,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <myatoi+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<myatoi>:
mov    (%rdi),%cl
test   %cl,%cl
je     1128 <myatoi+0x28>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
lea    (%rax,%rax,4),%eax
movsbl %cl,%ecx
lea    (%rcx,%rax,2),%eax
add    $0xffffffd0,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <myatoi+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @myatoi(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %13, %4 ], [ %2, %1 ]
%6 = phi i32 [ %11, %4 ], [ 0, %1 ]
%7 = phi i8* [ %12, %4 ], [ %0, %1 ]
%8 = mul nsw i32 %6, 10
%9 = sext i8 %5 to i32
%10 = add i32 %8, -48
%11 = add i32 %10, %9
%12 = getelementptr inbounds i8, i8* %7, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %4, %1
%16 = phi i32 [ 0, %1 ], [ %11, %4 ]
ret i32 %16
}
/* Type definitions */
struct sector {
  int dummy;
};

/* Variables and functions */
scalar_t__ error();
int /*<<< orphan*/ free_object(int, short *);
void free_sector(struct sector *sec) {
  free_object(56, (short *)sec);
  if (error())
    return;
}


x86 assembly (clang, -O0):
<free_sector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x38,%edi
call   1030 <free_object@plt>
mov    $0x0,%al
call   1040 <error@plt>
cmp    $0x0,%rax
je     1150 <free_sector+0x30>
jmp    1150 <free_sector+0x30>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_sector>:
push   %rax
mov    %rdi,%rsi
mov    $0x38,%edi
call   1030 <free_object@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <error@plt>

LLVM IR (-O0):
%struct.sector = type { i32 }
define void @free_sector(%struct.sector* %0) {
%2 = alloca %struct.sector*
store %struct.sector* %0, %struct.sector** %2
%3 = load %struct.sector*, %struct.sector** %2
%4 = bitcast %struct.sector* %3 to i16*
%5 = call i32 @free_object(i32 56, i16* %4)
%6 = call i64 (...) @error()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
br label %9
9: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
%struct.sector = type { i32 }
define void @free_sector(%struct.sector* %0) {
%2 = bitcast %struct.sector* %0 to i16*
%3 = tail call i32 @free_object(i32 56, i16* %2)
%4 = tail call i64 (...) @error()
ret void
}
unsigned int hash(char *str, char *end) {
  unsigned int hash = 2166136261;
  unsigned char c;
  while ((str != end) && (c = *str++)) {
    hash ^= c;
    hash *= 16777619;
  }
  return hash;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x811c9dc5,-0x14(%rbp)
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmp    -0x10(%rbp),%rcx
mov    %al,-0x16(%rbp)
je     1146 <hash+0x46>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0x15(%rbp)
movzbl %al,%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x16(%rbp)
mov    -0x16(%rbp),%al
test   $0x1,%al
jne    1156 <hash+0x56>
jmp    116f <hash+0x6f>
movzbl -0x15(%rbp),%eax
xor    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
imul   $0x1000193,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <hash+0x13>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    $0x811c9dc5,%eax
cmp    %rsi,%rdi
je     1128 <hash+0x28>
nopw   0x0(%rax,%rax,1)
movzbl (%rdi),%ecx
test   %ecx,%ecx
je     1128 <hash+0x28>
add    $0x1,%rdi
xor    %ecx,%eax
imul   $0x1000193,%eax,%eax
cmp    %rsi,%rdi
jne    1110 <hash+0x10>
ret

LLVM IR (-O0):
define i32 @hash(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 -2128831035, i32* %5
br label %7
7: ; preds = %19, %2
%8 = load i8*, i8** %3
%9 = load i8*, i8** %4
%10 = icmp ne i8* %8, %9
br i1 %10, label %11, label %17
11: ; preds = %7
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %3
%14 = load i8, i8* %12
store i8 %14, i8* %6
%15 = zext i8 %14 to i32
%16 = icmp ne i32 %15, 0
br label %17
17: ; preds = %11, %7
%18 = phi i1 [ false, %7 ], [ %16, %11 ]
br i1 %18, label %19, label %26
19: ; preds = %17
%20 = load i8, i8* %6
%21 = zext i8 %20 to i32
%22 = load i32, i32* %5
%23 = xor i32 %22, %21
store i32 %23, i32* %5
%24 = load i32, i32* %5
%25 = mul i32 %24, 16777619
store i32 %25, i32* %5
br label %7
26: ; preds = %17
%27 = load i32, i32* %5
ret i32 %27
}

LLVM IR (-O2):
define i32 @hash(i8* %0, i8* readnone %1) {
%3 = icmp eq i8* %0, %1
br i1 %3, label %15, label %4
4: ; preds = %2, %9
%5 = phi i8* [ %11, %9 ], [ %0, %2 ]
%6 = phi i32 [ %13, %9 ], [ -2128831035, %2 ]
%7 = load i8, i8* %5
%8 = icmp eq i8 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %4
%10 = zext i8 %7 to i32
%11 = getelementptr inbounds i8, i8* %5, i64 1
%12 = xor i32 %6, %10
%13 = mul i32 %12, 16777619
%14 = icmp eq i8* %11, %1
br i1 %14, label %15, label %4
15: ; preds = %4, %9, %2
%16 = phi i32 [ -2128831035, %2 ], [ %13, %9 ], [ %6, %4 ]
ret i32 %16
}
/* Type definitions */
struct node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  struct node *p;
  printf("iiii");
  return 0;
}


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

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

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [5 x i8] c"iiii\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.node*
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [5 x i8] c"iiii\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int rpc_listen_finish(int sd, void *args) { return 0; }


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

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

LLVM IR (-O0):
define i32 @rpc_listen_finish(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
ret i32 0
}

LLVM IR (-O2):
define i32 @rpc_listen_finish(i32 %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
void *calloc(int, size_t);
int /*<<< orphan*/ die(char *);
void *zalloc(size_t sz) {
  void *mem;
  mem = calloc(1, sz);
  if (!mem && sz)
    die("Out of memory");
  return mem;
}


x86 assembly (clang, -O0):
<zalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x1,%edi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1160 <zalloc+0x40>
cmpq   $0x0,-0x8(%rbp)
je     1160 <zalloc+0x40>
lea    0xea5(%rip),%rdi
call   1040 <die@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x1,%edi
mov    %rbx,%rsi
call   1030 <calloc@plt>
mov    %rax,%r14
test   %rbx,%rbx
je     114d <zalloc+0x2d>
test   %r14,%r14
jne    114d <zalloc+0x2d>
lea    0xeb8(%rip),%rdi
call   1040 <die@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"Out of memory\00"
define i8* @zalloc(i64 %0) {
%2 = tail call i8* @calloc(i32 1, i64 %0)
%3 = icmp eq i8* %2, null
%4 = icmp ne i64 %0, 0
%5 = and i1 %4, %3
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @die(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ ndsctl_action(char *, char *, char *);
void ndsctl_untrust(void) {
  ndsctl_action("untrust", "MAC %s untrusted.\n",
                "Failed to untrust MAC %s.\n");
}


x86 assembly (clang, -O0):
<ndsctl_untrust>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee6(%rip),%rsi
lea    0xef2(%rip),%rdx
call   1030 <ndsctl_action@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ndsctl_untrust>:
lea    0xee9(%rip),%rdi
lea    0xeea(%rip),%rsi
lea    0xef6(%rip),%rdx
jmp    1030 <ndsctl_action@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"untrust\00"
@.str.1 = [19 x i8] c"MAC %s untrusted.\0A\00"
@.str.2 = [27 x i8] c"Failed to untrust MAC %s.\0A\00"
define void @ndsctl_untrust() {
%1 = call i32 @ndsctl_action(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"untrust\00"
@.str.1 = [19 x i8] c"MAC %s untrusted.\0A\00"
@.str.2 = [27 x i8] c"Failed to untrust MAC %s.\0A\00"
define void @ndsctl_untrust() {
%1 = tail call i32 @ndsctl_action(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ logicAnd(int, int);
int logicNot(int /*<<< orphan*/);
int main() {
  int in = 1;
  int alsoIn = 1;
  return logicNot(logicAnd(in, alsoIn));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <logicAnd@plt>
mov    %eax,%edi
call   1040 <logicNot@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
mov    $0x1,%esi
call   1030 <logicAnd@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <logicNot@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @logicAnd(i32 1, i32 1)
%2 = tail call i32 @logicNot(i32 %1)
ret i32 %2
}
void fc_init_network(void) {}


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

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

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

LLVM IR (-O2):
define void @fc_init_network() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ die(char *);
void *malloc(size_t);
void *xmalloc(size_t n) {
  void *p = malloc(n);
  if (!p)
    die("out of core");
  return p;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1150 <xmalloc+0x30>
lea    0xeb5(%rip),%rdi
call   1040 <die@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [12 x i8] c"out of core\00"
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @die(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ rules_prompt();
void command_prolog(int id, char *input) {
  (void)id;
  (void)input;
  rules_prompt();
}


x86 assembly (clang, -O0):
<command_prolog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <rules_prompt@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @command_prolog(i32 %0, i8* nocapture readnone %1) {
%3 = tail call i32 (...) @rules_prompt()
ret void
}
/* Type definitions */
struct mlist {
  int dummy;
};
struct magic_set {
  int dummy;
};

/* Variables and functions */
struct mlist *file_apprentice(struct magic_set *, char const *, int);
int /*<<< orphan*/ free_mlist(struct mlist *);
int magic_compile(struct magic_set *ms, const char *magicfile) {
  struct mlist *ml = file_apprentice(ms, magicfile, 2);
  free_mlist(ml);
  return ml ? 0 : -1;
}


x86 assembly (clang, -O0):
<magic_compile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x2,%edx
call   1040 <file_apprentice@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free_mlist@plt>
mov    -0x18(%rbp),%rdx
mov    $0xffffffff,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<magic_compile>:
push   %rbx
mov    $0x2,%edx
call   1040 <file_apprentice@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <free_mlist@plt>
cmp    $0x1,%rbx
sbb    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.magic_set = type { i32 }
%struct.mlist = type { i32 }
define i32 @magic_compile(%struct.magic_set* %0, i8* %1) {
%3 = alloca %struct.magic_set*
%4 = alloca i8*
%5 = alloca %struct.mlist*
store %struct.magic_set* %0, %struct.magic_set** %3
store i8* %1, i8** %4
%6 = load %struct.magic_set*, %struct.magic_set** %3
%7 = load i8*, i8** %4
%8 = call %struct.mlist* @file_apprentice(%struct.magic_set* %6, i8* %7, i32 2)
store %struct.mlist* %8, %struct.mlist** %5
%9 = load %struct.mlist*, %struct.mlist** %5
%10 = call i32 @free_mlist(%struct.mlist* %9)
%11 = load %struct.mlist*, %struct.mlist** %5
%12 = icmp ne %struct.mlist* %11, null
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 0, i32 -1
ret i32 %14
}

LLVM IR (-O2):
%struct.magic_set = type { i32 }
%struct.mlist = type { i32 }
define i32 @magic_compile(%struct.magic_set* %0, i8* %1) {
%3 = tail call %struct.mlist* @file_apprentice(%struct.magic_set* %0, i8* %1, i32 2)
%4 = tail call i32 @free_mlist(%struct.mlist* %3)
%5 = icmp eq %struct.mlist* %3, null
%6 = sext i1 %5 to i32
ret i32 %6
}
void gtk_icon_source_new() {}


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

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

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

LLVM IR (-O2):
define void @gtk_icon_source_new() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CommentPopDown();
int /*<<< orphan*/ TagsPopDown();
void ResetFrontEnd() {
  CommentPopDown();
  TagsPopDown();
  return;
}


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

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

LLVM IR (-O0):
define void @ResetFrontEnd() {
%1 = call i32 (...) @CommentPopDown()
%2 = call i32 (...) @TagsPopDown()
ret void
}

LLVM IR (-O2):
define void @ResetFrontEnd() {
%1 = tail call i32 (...) @CommentPopDown()
%2 = tail call i32 (...) @TagsPopDown()
ret void
}
RCU_DEF_INIT_FUNC(user_m1_init, param) {}


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

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

LLVM IR (-O0):
define i32 @RCU_DEF_INIT_FUNC(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* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @RCU_DEF_INIT_FUNC(i32 %0, i32 %1) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ go();
int /*<<< orphan*/ init(int, char **);
int main(int argc, char *argv[]) {
  init(argc, argv);
  go();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1040 <init@plt>
xor    %eax,%eax
call   1030 <go@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @init(i32 %6, i8** %7)
%9 = call i32 (...) @go()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @init(i32 %0, i8** %1)
%4 = tail call i32 (...) @go()
ret i32 0
}
int reverse_number(int num) {
  int new_value;
  while (num != 0) {
    new_value = (new_value * 10) + (num % 10);
    num /= 10;
  }
  return new_value;
}


x86 assembly (clang, -O0):
<reverse_number>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     113e <reverse_number+0x3e>
imul   $0xa,-0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0xc(%rbp),%eax
add    %edx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    1107 <reverse_number+0x7>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @reverse_number(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %12, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ undef, %1 ]
%5 = phi i32 [ %9, %3 ], [ %0, %1 ]
%6 = mul nsw i32 %4, 10
%7 = srem i32 %5, 10
%8 = add nsw i32 %6, %7
%9 = sdiv i32 %5, 10
%10 = add i32 %5, 9
%11 = icmp ult i32 %10, 19
br i1 %11, label %12, label %3
12: ; preds = %3, %1
%13 = phi i32 [ undef, %1 ], [ %8, %3 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ os_free(void *);
void a_memFree(void *ptr) {
  if (ptr) {
    os_free(ptr);
  }
}


x86 assembly (clang, -O0):
<a_memFree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <a_memFree+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <os_free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_memFree>:
test   %rdi,%rdi
je     111a <a_memFree+0xa>
jmp    1030 <os_free@plt>
ret

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

LLVM IR (-O2):
define void @a_memFree(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @os_free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int usage(const char *argv0) {
  printf("pplib "
         "v2.05 less toxic i hope"
         ", "
         "p.jackowski@gust.org.pl"
         "\n");
  printf("usage: %s file1.pdf file2.pdf ...\n", argv0);
  return 0;
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rbx
lea    0xef8(%rip),%rdi
call   1030 <puts@plt>
lea    0xec9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [56 x i8] c"pplib v2.05 less toxic i hope, p.jackowski@gust.org.pl\0A\00"
@.str.1 = [35 x i8] c"usage: %s file1.pdf file2.pdf ...\0A\00"
define i32 @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [35 x i8] c"usage: %s file1.pdf file2.pdf ...\0A\00"
@str = [55 x i8] c"pplib v2.05 less toxic i hope, p.jackowski@gust.org.pl\00"
define i32 @usage(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ arm_arith_add(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ arm_data_regr_op();
void arm_add_regr() { arm_arith_add(arm_data_regr_op(), 0); }


x86 assembly (clang, -O0):
<arm_add_regr>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <arm_data_regr_op@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1040 <arm_arith_add@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<arm_add_regr>:
push   %rax
xor    %eax,%eax
call   1030 <arm_data_regr_op@plt>
mov    %eax,%edi
xor    %esi,%esi
pop    %rax
jmp    1040 <arm_arith_add@plt>

LLVM IR (-O0):
define void @arm_add_regr() {
%1 = call i32 (...) @arm_data_regr_op()
%2 = call i32 @arm_arith_add(i32 %1, i32 0)
ret void
}

LLVM IR (-O2):
define void @arm_add_regr() {
%1 = tail call i32 (...) @arm_data_regr_op()
%2 = tail call i32 @arm_arith_add(i32 %1, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ot(char *);
defbyte() { ot("DB "); }


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"DB \00"
define i32 @defbyte() {
%1 = alloca i32
%2 = call i32 @ot(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [4 x i8] c"DB \00"
define i32 @defbyte() {
%1 = tail call i32 @ot(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int sqrt(int);
int nnmath_get_distance(int x1, int y1, int x2, int y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}


x86 assembly (clang, -O0):
<nnmath_get_distance>:
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    -0x4(%rbp),%edi
sub    -0xc(%rbp),%edi
mov    -0x4(%rbp),%eax
sub    -0xc(%rbp),%eax
imul   %eax,%edi
mov    -0x8(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    -0x10(%rbp),%ecx
imul   %ecx,%eax
add    %eax,%edi
call   1030 <sqrt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nnmath_get_distance>:
sub    %edx,%edi
imul   %edi,%edi
sub    %ecx,%esi
imul   %esi,%esi
add    %esi,%edi
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define i32 @nnmath_get_distance(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* %7
%11 = sub nsw i32 %9, %10
%12 = load i32, i32* %5
%13 = load i32, i32* %7
%14 = sub nsw i32 %12, %13
%15 = mul nsw i32 %11, %14
%16 = load i32, i32* %6
%17 = load i32, i32* %8
%18 = sub nsw i32 %16, %17
%19 = load i32, i32* %6
%20 = load i32, i32* %8
%21 = sub nsw i32 %19, %20
%22 = mul nsw i32 %18, %21
%23 = add nsw i32 %15, %22
%24 = call i32 @sqrt(i32 %23)
ret i32 %24
}

LLVM IR (-O2):
define i32 @nnmath_get_distance(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = sub nsw i32 %0, %2
%6 = mul nsw i32 %5, %5
%7 = sub nsw i32 %1, %3
%8 = mul nsw i32 %7, %7
%9 = add nuw nsw i32 %8, %6
%10 = tail call i32 @sqrt(i32 %9)
ret i32 %10
}
/* Variables and functions */
int strlen(char const *);
char *strstr(char const *, char const *);
size_t ad_utils_substr_exists(const char *str, const char *substr) {
  size_t substr_count = 0;
  const char *p, *s = str;
  while (s < str && (p = strstr(s, substr))) {
    s = p + strlen(substr);
    substr_count++;
  }
  return substr_count;
}


x86 assembly (clang, -O0):
<ad_utils_substr_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rcx
xor    %eax,%eax
cmp    -0x8(%rbp),%rcx
mov    %al,-0x29(%rbp)
jae    116e <ad_utils_substr_exists+0x4e>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
setne  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    117e <ad_utils_substr_exists+0x5e>
jmp    11b0 <ad_utils_substr_exists+0x90>
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1140 <ad_utils_substr_exists+0x20>
mov    -0x18(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i64 @ad_utils_substr_exists(i8* %0, i8* %1) {
ret i64 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print_array(int *a, int n) {
  for (int i = 0; i < n; i++) {
    printf("%d ", a[i]);
  }
}


x86 assembly (clang, -O0):
<print_array>:
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    1157 <print_array+0x47>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print_array+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1145 <print_array+0x35>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <print_array+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
define void @print_array(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 @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
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @print_array(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %7
6: ; preds = %7, %2
ret void
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %12, %7 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %6, label %7
}
void get_proximity_rawdata(char *pchRcvDataFrame, int *iDataIdx,
                           struct sensor_value *sensorsdata) {
  return;
}


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

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

LLVM IR (-O0):
%struct.sensor_value = type opaque
define void @get_proximity_rawdata(i8* %0, i32* %1, %struct.sensor_value* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca %struct.sensor_value*
store i8* %0, i8** %4
store i32* %1, i32** %5
store %struct.sensor_value* %2, %struct.sensor_value** %6
ret void
}

LLVM IR (-O2):
%struct.sensor_value = type opaque
define void @get_proximity_rawdata(i8* nocapture %0, i32* nocapture %1, %struct.sensor_value* nocapture %2) {
ret void
}
void EXTI2_IRQHandler(void) {}


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

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

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

LLVM IR (-O2):
define void @EXTI2_IRQHandler() {
ret void
}
int count_char(const char *string, char lookfor) {
  int count = 0;
  while (*string != '\0') {
    if (*string == lookfor)
      count++;
    string++;
  };
  return count;
}


x86 assembly (clang, -O0):
<count_char>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1152 <count_char+0x52>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1141 <count_char+0x41>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1115 <count_char+0x15>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_char>:
mov    (%rdi),%cl
test   %cl,%cl
je     1126 <count_char+0x26>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
xor    %edx,%edx
cmp    %sil,%cl
sete   %dl
add    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <count_char+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @count_char(i8* nocapture %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i32 [ %11, %5 ], [ 0, %2 ]
%8 = phi i8* [ %12, %5 ], [ %0, %2 ]
%9 = icmp eq i8 %6, %1
%10 = zext i1 %9 to i32
%11 = add nuw nsw i32 %7, %10
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i32 [ 0, %2 ], [ %11, %5 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("Usage: realm-dump <file> [<ref>]\n");
  exit(1);
}


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

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

LLVM IR (-O0):
@.str = [34 x i8] c"Usage: realm-dump <file> [<ref>]\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [33 x i8] c"Usage: realm-dump <file> [<ref>]\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
__attribute__((always_)) int register_trace_mm_pagevec_free(
    void (*probe)(void *__data, struct page *page, int cold), void *data) {
  return -38;
}


x86 assembly (clang, -O0):
<register_trace_mm_pagevec_free>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xffffffda,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.page = type opaque
define i32 @register_trace_mm_pagevec_free(void (i8*, %struct.page*, i32)* %0, i8* %1) {
%3 = alloca void (i8*, %struct.page*, i32)*
%4 = alloca i8*
store void (i8*, %struct.page*, i32)* %0, void (i8*, %struct.page*, i32)** %3
store i8* %1, i8** %4
ret i32 -38
}

LLVM IR (-O2):
%struct.page = type opaque
define i32 @register_trace_mm_pagevec_free(void (i8*, %struct.page*, i32)* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 -38
}
child(i) int i;
{
  int n;
  n = getpid();
  exit(i);
}


x86 assembly (clang, -O0):
<child>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<child>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define i32 @child(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 (...) @getpid()
store i32 %4, i32* %3
%5 = load i32, i32* %2
unreachable
}

LLVM IR (-O2):
define i32 @child(i32 %0) {
%2 = tail call i32 (...) @getpid()
tail call void @exit(i32 %0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ _SC_MQ_OPEN_MAX;
int /*<<< orphan*/ _SC_MQ_PRIO_MAX;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sysconf(int /*<<< orphan*/);
int main(int argc, char **argv) {
  printf("MQ_OPEN_MAX = %ld, MQ_PRIO_MAX = %ld\n", sysconf(_SC_MQ_OPEN_MAX),
         sysconf(_SC_MQ_PRIO_MAX));
  exit(0);
}


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)
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
call   1040 <sysconf@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
call   1040 <sysconf@plt>
mov    -0x14(%rbp),%esi
mov    %eax,%edx
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
call   1040 <sysconf@plt>
mov    %eax,%ebx
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
call   1040 <sysconf@plt>
lea    0xeaa(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"MQ_OPEN_MAX = %ld, MQ_PRIO_MAX = %ld\0A\00"
@_SC_MQ_OPEN_MAX = global i32 0
@_SC_MQ_PRIO_MAX = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* @_SC_MQ_OPEN_MAX
%7 = call i32 @sysconf(i32 %6)
%8 = load i32, i32* @_SC_MQ_PRIO_MAX
%9 = call i32 @sysconf(i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %9)
%11 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [38 x i8] c"MQ_OPEN_MAX = %ld, MQ_PRIO_MAX = %ld\0A\00"
@_SC_MQ_OPEN_MAX = global i32 0
@_SC_MQ_PRIO_MAX = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @_SC_MQ_OPEN_MAX
%4 = tail call i32 @sysconf(i32 %3)
%5 = load i32, i32* @_SC_MQ_PRIO_MAX
%6 = tail call i32 @sysconf(i32 %5)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %6)
%8 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ pA(char *, char const *, char const *);
void read_mem(const char *regname_data, const char *regname_address) {
  pA("PALMEM0(%s, T_SINT32, mem_ptr, %s);", regname_data, regname_address);
}


x86 assembly (clang, -O0):
<read_mem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xed1(%rip),%rdi
call   1030 <pA@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_mem>:
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee3(%rip),%rdi
jmp    1030 <pA@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"PALMEM0(%s, T_SINT32, mem_ptr, %s);\00"
define void @read_mem(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @pA(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"PALMEM0(%s, T_SINT32, mem_ptr, %s);\00"
define void @read_mem(i8* %0, i8* %1) {
%3 = tail call i32 @pA(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ put32(unsigned int);
int /*<<< orphan*/ put8(int);
void idiv_m32(unsigned int *m32) {
  put8(0xF7);
  put8(0x3D);
  put32((unsigned int)(m32));
}


x86 assembly (clang, -O0):
<idiv_m32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0xf7,%edi
call   1030 <put8@plt>
mov    $0x3d,%edi
call   1030 <put8@plt>
mov    -0x8(%rbp),%rax
mov    %eax,%edi
call   1040 <put32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<idiv_m32>:
push   %rbx
mov    %rdi,%rbx
mov    $0xf7,%edi
call   1030 <put8@plt>
mov    $0x3d,%edi
call   1030 <put8@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <put32@plt>

LLVM IR (-O0):
define void @idiv_m32(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = call i32 @put8(i32 247)
%4 = call i32 @put8(i32 61)
%5 = load i32*, i32** %2
%6 = ptrtoint i32* %5 to i32
%7 = call i32 @put32(i32 %6)
ret void
}

LLVM IR (-O2):
define void @idiv_m32(i32* %0) {
%2 = tail call i32 @put8(i32 247)
%3 = tail call i32 @put8(i32 61)
%4 = ptrtoint i32* %0 to i64
%5 = trunc i64 %4 to i32
%6 = tail call i32 @put32(i32 %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clear_io_bit(int, int);
void TOSH_MAKE_RADIO_VREF_INPUT() { clear_io_bit(-3, 1); }


x86 assembly (clang, -O0):
<TOSH_MAKE_RADIO_VREF_INPUT>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfffffffd,%edi
mov    $0x1,%esi
call   1030 <clear_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_MAKE_RADIO_VREF_INPUT>:
mov    $0xfffffffd,%edi
mov    $0x1,%esi
jmp    1030 <clear_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_MAKE_RADIO_VREF_INPUT() {
%1 = call i32 @clear_io_bit(i32 -3, i32 1)
ret void
}

LLVM IR (-O2):
define void @TOSH_MAKE_RADIO_VREF_INPUT() {
%1 = tail call i32 @clear_io_bit(i32 -3, i32 1)
ret void
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t uint_16_le(const uint8_t *const p) {
  return (((int)p[0] & 0xff) | ((int)p[1] & 0xff) << 8);
}


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

x86 assembly (clang, -O2):
<uint_16_le>:
movzbl (%rdi),%ecx
mov    0x8(%rdi),%eax
shl    $0x8,%eax
movzwl %ax,%eax
or     %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @uint_16_le(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = trunc i64 %2 to i32
%4 = and i32 %3, 255
%5 = getelementptr inbounds i64, i64* %0, i64 1
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
%8 = shl i32 %7, 8
%9 = and i32 %8, 65280
%10 = or i32 %9, %4
ret i32 %10
}