xunge/DecIR huggingface dataset:
pwskip(ap) char *ap;
{
  register char *p;
  p = ap;
  while (*p != ':') {
    if (*p == 0)
      return (p);
    p++;
  }
  *p++ = 0;
  return (p);
}


x86 assembly (clang, -O0):
<pwskip>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
je     114d <pwskip+0x4d>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    113c <pwskip+0x3c>
mov    -0x18(%rbp),%rax
mov    %eax,-0x4(%rbp)
jmp    1166 <pwskip+0x66>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1110 <pwskip+0x10>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pwskip>:
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rax),%ecx
test   %cl,%cl
je     1129 <pwskip+0x29>
cmp    $0x3a,%cl
je     1122 <pwskip+0x22>
add    $0x1,%rax
jmp    1110 <pwskip+0x10>
movb   $0x0,(%rax)
add    $0x1,%rax
ret

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

LLVM IR (-O2):
define i32 @pwskip(i8* %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %5 [
i8 58, label %7
i8 0, label %9
]
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2
%8 = getelementptr inbounds i8, i8* %3, i64 1
store i8 0, i8* %3
br label %9
9: ; preds = %2, %7
%10 = phi i8* [ %8, %7 ], [ %3, %2 ]
%11 = ptrtoint i8* %10 to i64
%12 = trunc i64 %11 to i32
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ errno;
char *strerror(int /*<<< orphan*/);
char *sock_geterror(void) { return strerror(errno); }


x86 assembly (clang, -O0):
<sock_geterror>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
call   1030 <strerror@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sock_geterror>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <strerror@plt>

LLVM IR (-O0):
@errno = global i32 0
define i8* @sock_geterror() {
%1 = load i32, i32* @errno
%2 = call i8* @strerror(i32 %1)
ret i8* %2
}

LLVM IR (-O2):
@errno = global i32 0
define i8* @sock_geterror() {
%1 = load i32, i32* @errno
%2 = tail call i8* @strerror(i32 %1)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ v3_servo_disconnect(short);
int disconnect_servos() {
  short i;
  for (i = 0; i < 4; i++) {
    v3_servo_disconnect(i);
  }
}


x86 assembly (clang, -O0):
<disconnect_servos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movw   $0x0,-0x6(%rbp)
movswl -0x6(%rbp),%eax
cmp    $0x4,%eax
jge    1145 <disconnect_servos+0x35>
movswl -0x6(%rbp),%edi
call   1030 <v3_servo_disconnect@plt>
mov    -0x6(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x6(%rbp)
jmp    111e <disconnect_servos+0xe>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disconnect_servos>:
push   %rax
xor    %edi,%edi
call   1030 <v3_servo_disconnect@plt>
mov    $0x1,%edi
call   1030 <v3_servo_disconnect@plt>
mov    $0x2,%edi
call   1030 <v3_servo_disconnect@plt>
mov    $0x3,%edi
pop    %rax
jmp    1030 <v3_servo_disconnect@plt>

LLVM IR (-O0):
define i32 @disconnect_servos() {
%1 = alloca i32
%2 = alloca i16
store i16 0, i16* %2
br label %3
3: ; preds = %10, %0
%4 = load i16, i16* %2
%5 = sext i16 %4 to i32
%6 = icmp slt i32 %5, 4
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = load i16, i16* %2
%9 = call i32 @v3_servo_disconnect(i16 signext %8)
br label %10
10: ; preds = %7
%11 = load i16, i16* %2
%12 = add i16 %11, 1
store i16 %12, i16* %2
br label %3
13: ; preds = %3
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
define i32 @disconnect_servos() {
%1 = tail call i32 @v3_servo_disconnect(i16 signext 0)
%2 = tail call i32 @v3_servo_disconnect(i16 signext 1)
%3 = tail call i32 @v3_servo_disconnect(i16 signext 2)
%4 = tail call i32 @v3_servo_disconnect(i16 signext 3)
ret i32 undef
}
void foo_1_1_1_2_2_1_1_1_2() {}


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

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

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

LLVM IR (-O2):
define void @foo_1_1_1_2_2_1_1_1_2() {
ret void
}
int setenv(const char *var, const char *val) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @setenv(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
void check_tls_errors(struct context *c) {}


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

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

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

LLVM IR (-O2):
%struct.context = type opaque
define void @check_tls_errors(%struct.context* nocapture %0) {
ret void
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ fib(int);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int n = ((argc == 2) ? atoi(argv[1]) : 1);
  printf("%ld", fib(n));
  return (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)
cmpl   $0x2,-0x8(%rbp)
jne    1165 <main+0x35>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    1172 <main+0x42>
mov    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1172 <main+0x42>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <fib@plt>
mov    %eax,%esi
lea    0xe77(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %edi,%eax
mov    $0x1,%edi
cmp    $0x2,%eax
jne    1148 <main+0x18>
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
call   1040 <fib@plt>
lea    0xeac(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%ld\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
br label %8
8: ; preds = %2, %4
%9 = phi i32 [ %7, %4 ], [ 1, %2 ]
%10 = tail call i32 @fib(i32 %9)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ do_something(int);
int main() {
  do_something(2);
  do_something(3);
  do_something(5);
  do_something(70);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1030 <do_something@plt>
mov    $0x3,%edi
call   1030 <do_something@plt>
mov    $0x5,%edi
call   1030 <do_something@plt>
mov    $0x46,%edi
call   1030 <do_something@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
call   1030 <do_something@plt>
mov    $0x3,%edi
call   1030 <do_something@plt>
mov    $0x5,%edi
call   1030 <do_something@plt>
mov    $0x46,%edi
call   1030 <do_something@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @do_something(i32 2)
%2 = call i32 @do_something(i32 3)
%3 = call i32 @do_something(i32 5)
%4 = call i32 @do_something(i32 70)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @do_something(i32 2)
%2 = tail call i32 @do_something(i32 3)
%3 = tail call i32 @do_something(i32 5)
%4 = tail call i32 @do_something(i32 70)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ cbggckeeper(void *, void (*)(void *));
void cbglobalgc(void *ptr, void (*func)(void *)) {
  assert(ptr && func);
  cbggckeeper(ptr, func);
}


x86 assembly (clang, -O0):
<cbglobalgc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     114b <cbglobalgc+0x2b>
cmpq   $0x0,-0x10(%rbp)
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <cbggckeeper@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbglobalgc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
test   %rdi,%rdi
setne  %al
test   %rsi,%rsi
setne  %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <cbggckeeper@plt>

LLVM IR (-O0):
define void @cbglobalgc(i8* %0, void (i8*)* %1) {
%3 = alloca i8*
%4 = alloca void (i8*)*
store i8* %0, i8** %3
store void (i8*)* %1, void (i8*)** %4
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load void (i8*)*, void (i8*)** %4
%9 = icmp ne void (i8*)* %8, null
br label %10
10: ; preds = %7, %2
%11 = phi i1 [ false, %2 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i8*, i8** %3
%15 = load void (i8*)*, void (i8*)** %4
%16 = call i32 @cbggckeeper(i8* %14, void (i8*)* %15)
ret void
}

LLVM IR (-O2):
define void @cbglobalgc(i8* %0, void (i8*)* %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne void (i8*)* %1, null
%5 = and i1 %3, %4
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = tail call i32 @cbggckeeper(i8* %0, void (i8*)* %1)
ret void
}
int ConcreteTmSched(int timeout, void *data, void **timer_handler) { return 0; }


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

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

LLVM IR (-O0):
define i32 @ConcreteTmSched(i32 %0, i8* %1, i8** %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8**
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8** %2, i8*** %6
ret i32 0
}

LLVM IR (-O2):
define i32 @ConcreteTmSched(i32 %0, i8* nocapture readnone %1, i8** nocapture readnone %2) {
ret i32 0
}
/* Variables and functions */
char *check_alloc(int /*<<< orphan*/);
int /*<<< orphan*/ strdup(char const *);
char *xstrdup(const char *str) { return check_alloc(strdup(str)); }


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strdup@plt>
mov    %eax,%edi
call   1040 <check_alloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %rax
call   1030 <strdup@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <check_alloc@plt>

LLVM IR (-O0):
define i8* @xstrdup(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @strdup(i8* %3)
%5 = call i8* @check_alloc(i32 %4)
ret i8* %5
}

LLVM IR (-O2):
define i8* @xstrdup(i8* %0) {
%2 = tail call i32 @strdup(i8* %0)
%3 = tail call i8* @check_alloc(i32 %2)
ret i8* %3
}
/* Variables and functions */
scalar_t__ malloc(int);
void malloc_formal_leak_bad(int *x) { x = (int *)malloc(sizeof(int *)); }


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

x86 assembly (clang, -O2):
<malloc_formal_leak_bad>:
mov    $0x8,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define void @malloc_formal_leak_bad(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = call i64 @malloc(i32 8)
%4 = inttoptr i64 %3 to i32*
store i32* %4, i32** %2
ret void
}

LLVM IR (-O2):
define void @malloc_formal_leak_bad(i32* nocapture readnone %0) {
%2 = tail call i64 @malloc(i32 8)
ret void
}
void danger(void) { ((void (*)(void))0xdeadbeef)(); }


x86 assembly (clang, -O0):
<danger>:
push   %rbp
mov    %rsp,%rbp
mov    $0xdeadbeef,%eax
call   *%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<danger>:
mov    $0xdeadbeef,%eax
jmp    *%rax

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

LLVM IR (-O2):
define void @danger() {
tail call void inttoptr (i64 3735928559 to void ()*)()
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
void changespidirection(bool in) {
  if (in)
    (*(volatile uint8_t *)((0x500A + 2))) &= ~(1 << 3);
  else
    (*(volatile uint8_t *)((0x500A + 2))) |= (1 << 3);
}


x86 assembly (clang, -O0):
<changespidirection>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1127 <changespidirection+0x27>
mov    $0x500c,%eax
mov    (%rax),%ecx
and    $0xfffffff7,%ecx
mov    $0x500c,%eax
mov    %ecx,(%rax)
jmp    1138 <changespidirection+0x38>
mov    $0x500c,%eax
mov    (%rax),%ecx
or     $0x8,%ecx
mov    $0x500c,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<changespidirection>:
xor    %eax,%eax
test   %edi,%edi
sete   %al
mov    0x500c,%ecx
and    $0xfffffff7,%ecx
lea    (%rcx,%rax,8),%eax
mov    %eax,0x500c
ret

LLVM IR (-O0):
define void @changespidirection(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load volatile i32, i32* inttoptr (i64 20492 to i32*)
%7 = and i32 %6, -9
store volatile i32 %7, i32* inttoptr (i64 20492 to i32*)
br label %11
8: ; preds = %1
%9 = load volatile i32, i32* inttoptr (i64 20492 to i32*)
%10 = or i32 %9, 8
store volatile i32 %10, i32* inttoptr (i64 20492 to i32*)
br label %11
11: ; preds = %8, %5
ret void
}

LLVM IR (-O2):
define void @changespidirection(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = load volatile i32, i32* inttoptr (i64 20492 to i32*)
%4 = and i32 %3, -9
%5 = select i1 %2, i32 8, i32 0
%6 = or i32 %4, %5
store volatile i32 %6, i32* inttoptr (i64 20492 to i32*)
ret void
}
const char *str_expr_compound_lit(void) { return "compound-lit"; }


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

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

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

LLVM IR (-O2):
@.str = [13 x i8] c"compound-lit\00"
define i8* @str_expr_compound_lit() {
ret i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0)
}
short int fn2(short int x, unsigned long y) { return x << y; }


x86 assembly (clang, -O0):
<fn2>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
movswl -0x2(%rbp),%eax
mov    -0x10(%rbp),%rcx
shl    %cl,%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn2>:
mov    %rsi,%rcx
movzwl %di,%eax
shl    %cl,%eax
ret

LLVM IR (-O0):
define signext i16 @fn2(i16 signext %0, i64 %1) {
%3 = alloca i16
%4 = alloca i64
store i16 %0, i16* %3
store i64 %1, i64* %4
%5 = load i16, i16* %3
%6 = sext i16 %5 to i32
%7 = load i64, i64* %4
%8 = trunc i64 %7 to i32
%9 = shl i32 %6, %8
%10 = trunc i32 %9 to i16
ret i16 %10
}

LLVM IR (-O2):
define signext i16 @fn2(i16 signext %0, i64 %1) {
%3 = zext i16 %0 to i32
%4 = trunc i64 %1 to i32
%5 = shl i32 %3, %4
%6 = trunc i32 %5 to i16
ret i16 %6
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hello, World!\n");
  return (EXIT_SUCCESS);
}


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>
mov    0x2eae(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [15 x i8] c"Hello, World!\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [14 x i8] c"Hello, World!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ _outsl_ns(void *, void const *, unsigned long);
void iowrite32_rep(void *addr, const void *src, unsigned long count) {
  _outsl_ns(addr, src, count);
}


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

x86 assembly (clang, -O2):
<iowrite32_rep>:
jmp    1030 <_outsl_ns@plt>

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

LLVM IR (-O2):
define void @iowrite32_rep(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @_outsl_ns(i8* %0, i8* %1, i64 %2)
ret void
}
int FLOAT_ALMOST_EQUAL(double f1, double f2) {
  double d = (f1 >= f2 ? f1 - f2 : f2 - f1);
  double m = (f2 >= 0.0 ? f2 : -f2) * 0.01;
  return d < m;
}


x86 assembly (clang, -O0):
<FLOAT_ALMOST_EQUAL>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1132 <FLOAT_ALMOST_EQUAL+0x32>
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1141 <FLOAT_ALMOST_EQUAL+0x41>
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     116c <FLOAT_ALMOST_EQUAL+0x6c>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    118d <FLOAT_ALMOST_EQUAL+0x8d>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xe66(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FLOAT_ALMOST_EQUAL>:
movapd %xmm1,%xmm2
subsd  %xmm0,%xmm2
movapd %xmm1,%xmm3
cmpnlesd %xmm0,%xmm3
subsd  %xmm1,%xmm0
andpd  %xmm3,%xmm2
andnpd %xmm0,%xmm3
orpd   %xmm2,%xmm3
movapd 0xed7(%rip),%xmm0
xorpd  %xmm1,%xmm0
xorpd  %xmm2,%xmm2
cmplesd %xmm1,%xmm2
andpd  %xmm2,%xmm1
andnpd %xmm0,%xmm2
orpd   %xmm1,%xmm2
mulsd  0xec6(%rip),%xmm2
xor    %eax,%eax
ucomisd %xmm3,%xmm2
seta   %al
ret

LLVM IR (-O0):
define i32 @FLOAT_ALMOST_EQUAL(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %3
store double %1, double* %4
%7 = load double, double* %3
%8 = load double, double* %4
%9 = fcmp oge double %7, %8
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load double, double* %3
%12 = load double, double* %4
%13 = fsub double %11, %12
br label %18
14: ; preds = %2
%15 = load double, double* %4
%16 = load double, double* %3
%17 = fsub double %15, %16
br label %18
18: ; preds = %14, %10
%19 = phi double [ %13, %10 ], [ %17, %14 ]
store double %19, double* %5
%20 = load double, double* %4
%21 = fcmp oge double %20, 0.000000e+00
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = load double, double* %4
br label %27
24: ; preds = %18
%25 = load double, double* %4
%26 = fneg double %25
br label %27
27: ; preds = %24, %22
%28 = phi double [ %23, %22 ], [ %26, %24 ]
%29 = fmul double %28, 1.000000e-02
store double %29, double* %6
%30 = load double, double* %5
%31 = load double, double* %6
%32 = fcmp olt double %30, %31
%33 = zext i1 %32 to i32
ret i32 %33
}

LLVM IR (-O2):
define i32 @FLOAT_ALMOST_EQUAL(double %0, double %1) {
%3 = fcmp ult double %0, %1
%4 = fsub double %0, %1
%5 = fsub double %1, %0
%6 = select i1 %3, double %5, double %4
%7 = fcmp oge double %1, 0.000000e+00
%8 = fneg double %1
%9 = select i1 %7, double %1, double %8
%10 = fmul double %9, 1.000000e-02
%11 = fcmp olt double %6, %10
%12 = zext i1 %11 to i32
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ ttlval;

/* Variables and functions */
int /*<<< orphan*/ IPPROTO_IP;
int /*<<< orphan*/ IP_MULTICAST_TTL;
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, unsigned char *,
               int);
int wfaSetSockMcastSendOpt(int sockfd) {
  unsigned char ttlval = 1;
  return setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, &ttlval,
                    sizeof(ttlval));
}


x86 assembly (clang, -O0):
<wfaSetSockMcastSendOpt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movb   $0x1,-0x5(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebf(%rip),%rax
mov    (%rax),%esi
mov    0x2ea6(%rip),%rax
mov    (%rax),%edx
lea    -0x5(%rbp),%rcx
mov    $0x1,%r8d
call   1030 <setsockopt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wfaSetSockMcastSendOpt>:
push   %rax
movb   $0x1,0x7(%rsp)
mov    0x2ecb(%rip),%rax
mov    (%rax),%esi
mov    0x2eb2(%rip),%rax
mov    (%rax),%edx
lea    0x7(%rsp),%rcx
mov    $0x1,%r8d
call   1030 <setsockopt@plt>
pop    %rcx
ret

LLVM IR (-O0):
@IPPROTO_IP = global i32 0
@IP_MULTICAST_TTL = global i32 0
define i32 @wfaSetSockMcastSendOpt(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
store i8 1, i8* %3
%4 = load i32, i32* %2
%5 = load i32, i32* @IPPROTO_IP
%6 = load i32, i32* @IP_MULTICAST_TTL
%7 = call i32 @setsockopt(i32 %4, i32 %5, i32 %6, i8* %3, i32 1)
ret i32 %7
}

LLVM IR (-O2):
@IPPROTO_IP = global i32 0
@IP_MULTICAST_TTL = global i32 0
define i32 @wfaSetSockMcastSendOpt(i32 %0) {
%2 = alloca i8
store i8 1, i8* %2
%3 = load i32, i32* @IPPROTO_IP
%4 = load i32, i32* @IP_MULTICAST_TTL
%5 = call i32 @setsockopt(i32 %0, i32 %3, i32 %4, i8* %2, i32 1)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ __bound_new_region(void *, size_t);
void *libc_malloc(size_t);
void *__bound_malloc(size_t size, const void *caller) {
  void *ptr;
  ptr = libc_malloc(size + 1);
  if (!ptr)
    return NULL;
  __bound_new_region(ptr, size);
  return ptr;
}


x86 assembly (clang, -O0):
<__bound_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1040 <libc_malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1159 <__bound_malloc+0x39>
movq   $0x0,-0x8(%rbp)
jmp    116e <__bound_malloc+0x4e>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <__bound_new_region@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__bound_malloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
add    $0x1,%rdi
call   1040 <libc_malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1143 <__bound_malloc+0x23>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <__bound_new_region@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @__bound_malloc(i64 %0, i8* nocapture readnone %1) {
%3 = add i64 %0, 1
%4 = tail call i8* @libc_malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @__bound_new_region(i8* %4, i64 %0)
br label %8
8: ; preds = %2, %6
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long long);
void STEST905(long long v) {
  printf("C905:(%13lld):(1234567890123):Call by value long long literal\n", v);
}


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

x86 assembly (clang, -O2):
<STEST905>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [63 x i8] c"C905:(%13lld):(1234567890123):Call by value long long literal\0A\00"
define void @STEST905(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i64 %3)
ret void
}

LLVM IR (-O2):
@.str = [63 x i8] c"C905:(%13lld):(1234567890123):Call by value long long literal\0A\00"
define void @STEST905(i64 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i64 %0)
ret void
}
/* Variables and functions */
int _hex_to_int(char *);
double ignition_timming_advance(char *data) {
  return (_hex_to_int(data) - 128.) / 2.;
}


x86 assembly (clang, -O0):
<ignition_timming_advance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <_hex_to_int@plt>
cvtsi2sd %eax,%xmm0
movsd  0xed7(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xec3(%rip),%xmm1
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ignition_timming_advance>:
push   %rax
call   1030 <_hex_to_int@plt>
cvtsi2sd %eax,%xmm0
addsd  0xede(%rip),%xmm0
mulsd  0xede(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @ignition_timming_advance(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @_hex_to_int(i8* %3)
%5 = sitofp i32 %4 to double
%6 = fsub double %5, 1.280000e+02
%7 = fdiv double %6, 2.000000e+00
ret double %7
}

LLVM IR (-O2):
define double @ignition_timming_advance(i8* %0) {
%2 = tail call i32 @_hex_to_int(i8* %0)
%3 = sitofp i32 %2 to double
%4 = fadd double %3, -1.280000e+02
%5 = fmul double %4, 5.000000e-01
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isprint(int);
void t_isprint_0xdb() {
  Assert_real((isprint(219) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isprint.c",
              1100, ("isprint should be 0 for 0xdb"));
}


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

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

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

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isprint.c\00"
@.str.1 = [29 x i8] c"isprint should be 0 for 0xdb\00"
define void @t_isprint_0xdb() {
%1 = tail call i64 @isprint(i32 219)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1100, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t ppz8_pzi_decodebuf_samples(uint32_t pzidatalen) {
  if (pzidatalen < 0x920)
    return 0;
  return (pzidatalen - 0x920) * 2;
}


x86 assembly (clang, -O0):
<ppz8_pzi_decodebuf_samples>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x920,-0x8(%rbp)
jge    1120 <ppz8_pzi_decodebuf_samples+0x20>
movl   $0x0,-0x4(%rbp)
jmp    112e <ppz8_pzi_decodebuf_samples+0x2e>
mov    -0x8(%rbp),%eax
sub    $0x920,%eax
shl    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ppz8_pzi_decodebuf_samples>:
xor    %ecx,%ecx
cmp    $0x920,%edi
lea    -0x1240(%rdi,%rdi,1),%eax
cmovl  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @ppz8_pzi_decodebuf_samples(i32 %0) {
%2 = icmp slt i32 %0, 2336
%3 = shl i32 %0, 1
%4 = add i32 %3, -4672
%5 = select i1 %2, i32 0, i32 %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() { fprintf(stderr, "Usage: not what you did u fuckin idiot\n"); }


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [40 x i8] c"Usage: not what you did u fuckin idiot\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [40 x i8] c"Usage: not what you did u fuckin idiot\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef scalar_t__ uint32_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int32_t cmp32(uint32_t a, uint32_t b) { return (int32_t)(a - b); }


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

x86 assembly (clang, -O2):
<cmp32>:
mov    %rdi,%rax
sub    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @cmp32(i64 %0, i64 %1) {
%3 = sub nsw i64 %0, %1
%4 = trunc i64 %3 to i32
ret i32 %4
}
int dummy() {}


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

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

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

LLVM IR (-O2):
define i32 @dummy() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ control_read(int);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
void *control_thread(void *data) {
  control_read(*((int *)data));
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<control_thread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1030 <control_read@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<control_thread>:
push   %rax
mov    (%rdi),%edi
call   1030 <control_read@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
define i8* @control_thread(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = bitcast i8* %4 to i32*
%6 = load i32, i32* %5
%7 = call i32 @control_read(i32 %6)
%8 = call i32 @pthread_exit(i32* null)
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
define noalias i8* @control_thread(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @control_read(i32 %3)
%5 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
}
/* Variables and functions */
size_t ZBUFF_recommendedCInSize(void) { return (128 * 1024); }


x86 assembly (clang, -O0):
<ZBUFF_recommendedCInSize>:
push   %rbp
mov    %rsp,%rbp
mov    $0x20000,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @ZBUFF_recommendedCInSize() {
ret i64 131072
}

LLVM IR (-O2):
define i64 @ZBUFF_recommendedCInSize() {
ret i64 131072
}
/* Variables and functions */
int /*<<< orphan*/ mm_init_units();
void mm_init(void) { mm_init_units(); }


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

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

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

LLVM IR (-O2):
define void @mm_init() {
%1 = tail call i32 (...) @mm_init_units()
ret void
}
void outopsep() {}


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

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

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

LLVM IR (-O2):
define void @outopsep() {
ret void
}
/* Type definitions */
struct NumArray {
  int dummy;
};

/* Variables and functions */
int prefixSum(struct NumArray *, int);
int sumRange(struct NumArray *numArray, int i, int j) {
  if (i > 0)
    return prefixSum(numArray, j) - prefixSum(numArray, i - 1);
  else
    return prefixSum(numArray, j);
}


x86 assembly (clang, -O0):
<sumRange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1159 <sumRange+0x49>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1030 <prefixSum@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
sub    $0x1,%esi
call   1030 <prefixSum@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1168 <sumRange+0x58>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1030 <prefixSum@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sumRange>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
mov    %edx,%esi
call   1030 <prefixSum@plt>
mov    %eax,%ebx
test   %ebp,%ebp
jle    1135 <sumRange+0x25>
add    $0xffffffff,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <prefixSum@plt>
sub    %eax,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.NumArray = type { i32 }
define i32 @sumRange(%struct.NumArray* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.NumArray*
%6 = alloca i32
%7 = alloca i32
store %struct.NumArray* %0, %struct.NumArray** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load i32, i32* %6
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %19
10: ; preds = %3
%11 = load %struct.NumArray*, %struct.NumArray** %5
%12 = load i32, i32* %7
%13 = call i32 @prefixSum(%struct.NumArray* %11, i32 %12)
%14 = load %struct.NumArray*, %struct.NumArray** %5
%15 = load i32, i32* %6
%16 = sub nsw i32 %15, 1
%17 = call i32 @prefixSum(%struct.NumArray* %14, i32 %16)
%18 = sub nsw i32 %13, %17
store i32 %18, i32* %4
br label %23
19: ; preds = %3
%20 = load %struct.NumArray*, %struct.NumArray** %5
%21 = load i32, i32* %7
%22 = call i32 @prefixSum(%struct.NumArray* %20, i32 %21)
store i32 %22, i32* %4
br label %23
23: ; preds = %19, %10
%24 = load i32, i32* %4
ret i32 %24
}

LLVM IR (-O2):
%struct.NumArray = type { i32 }
define i32 @sumRange(%struct.NumArray* %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 0
%5 = tail call i32 @prefixSum(%struct.NumArray* %0, i32 %2)
br i1 %4, label %6, label %10
6: ; preds = %3
%7 = add nsw i32 %1, -1
%8 = tail call i32 @prefixSum(%struct.NumArray* %0, i32 %7)
%9 = sub nsw i32 %5, %8
br label %10
10: ; preds = %3, %6
%11 = phi i32 [ %9, %6 ], [ %5, %3 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("       *\n");
  printf("      *\n");
  printf("     *\n");
  printf("*   *\n");
  printf(" * *\n");
  printf("  *\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
lea    0xea3(%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 <puts@plt>
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb1(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [9 x i8] c" *\00"
@str.6 = [8 x i8] c" *\00"
@str.7 = [7 x i8] c" *\00"
@str.8 = [6 x i8] c"* *\00"
@str.9 = [5 x i8] c" * *\00"
@str.10 = [4 x i8] c" *\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.6, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.7, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.8, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.9, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.10, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct tl880_dev {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ tl880_apu_init_ioc(struct tl880_dev *);
void tl880_apu_stop_ioc(struct tl880_dev *tl880dev) {
  tl880_apu_init_ioc(tl880dev);
}


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

x86 assembly (clang, -O2):
<tl880_apu_stop_ioc>:
jmp    1030 <tl880_apu_init_ioc@plt>

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

LLVM IR (-O2):
%struct.tl880_dev = type { i32 }
define void @tl880_apu_stop_ioc(%struct.tl880_dev* %0) {
%2 = tail call i32 @tl880_apu_init_ioc(%struct.tl880_dev* %0)
ret void
}
/* Variables and functions */
bool ifContainsFive(int num) {
  if (num == 5)
    return true;
  while (num > 0) {
    if (num % 10 == 5)
      return true;
    num /= 10;
  }
  return false;
}


x86 assembly (clang, -O0):
<ifContainsFive>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jne    111d <ifContainsFive+0x1d>
movl   $0x1,-0x4(%rbp)
jmp    1166 <ifContainsFive+0x66>
jmp    1122 <ifContainsFive+0x22>
cmpl   $0x0,-0x8(%rbp)
jle    115f <ifContainsFive+0x5f>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x5,%edx
jne    114c <ifContainsFive+0x4c>
movl   $0x1,-0x4(%rbp)
jmp    1166 <ifContainsFive+0x66>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1122 <ifContainsFive+0x22>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ifContainsFive>:
mov    $0x1,%eax
cmp    $0x5,%edi
je     1146 <ifContainsFive+0x46>
test   %edi,%edi
jle    1144 <ifContainsFive+0x44>
mov    $0xcccccccd,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
imul   $0xcccccccd,%edi,%edx
add    $0xffffffff,%edx
ror    %edx
cmp    $0x1999999a,%edx
jb     1146 <ifContainsFive+0x46>
mov    %edi,%edx
imul   %rcx,%rdx
shr    $0x23,%rdx
cmp    $0x9,%edi
mov    %edx,%edi
ja     1120 <ifContainsFive+0x20>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @ifContainsFive(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 5
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %2
br label %20
7: ; preds = %1
br label %8
8: ; preds = %16, %7
%9 = load i32, i32* %3
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %19
11: ; preds = %8
%12 = load i32, i32* %3
%13 = srem i32 %12, 10
%14 = icmp eq i32 %13, 5
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 1, i32* %2
br label %20
16: ; preds = %11
%17 = load i32, i32* %3
%18 = sdiv i32 %17, 10
store i32 %18, i32* %3
br label %8
19: ; preds = %8
store i32 0, i32* %2
br label %20
20: ; preds = %19, %15, %6
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
define i32 @ifContainsFive(i32 %0) {
%2 = icmp eq i32 %0, 5
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %12
5: ; preds = %3, %10
%6 = phi i32 [ %8, %10 ], [ %0, %3 ]
%7 = urem i32 %6, 10
%8 = udiv i32 %6, 10
%9 = icmp eq i32 %7, 5
br i1 %9, label %12, label %10
10: ; preds = %5
%11 = icmp ult i32 %6, 10
br i1 %11, label %12, label %5
12: ; preds = %5, %10, %3, %1
%13 = phi i32 [ 1, %1 ], [ 0, %3 ], [ 1, %5 ], [ 0, %10 ]
ret i32 %13
}
void f(int *p) {
  int flag = 0;
  if (p) {
    flag = 1;
  }
  if (flag)
    *p = 1;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1121 <f+0x21>
movl   $0x1,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1135 <f+0x35>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
test   %rdi,%rdi
je     110b <f+0xb>
movl   $0x1,(%rdi)
ret

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

LLVM IR (-O2):
define void @f(i32* writeonly %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %4, label %3
3: ; preds = %1
store i32 1, i32* %0
br label %4
4: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print_separator();
int /*<<< orphan*/ print_string(char *);
void print_header(void) {
  print_string("System memory:\n\n");
  print_string("Base Address (high:low) | Length (high:low)       "
               "| Type\n");
  print_separator();
}


x86 assembly (clang, -O0):
<print_header>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <print_string@plt>
lea    0xeda(%rip),%rdi
call   1040 <print_string@plt>
mov    $0x0,%al
call   1030 <print_separator@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_header>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <print_string@plt>
lea    0xedd(%rip),%rdi
call   1040 <print_string@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <print_separator@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"System memory:\0A\0A\00"
@.str.1 = [58 x i8] c"Base Address (high:low) | Length (high:low) | Type\0A\00"
define void @print_header() {
%1 = call i32 @print_string(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @print_string(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 (...) @print_separator()
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"System memory:\0A\0A\00"
@.str.1 = [58 x i8] c"Base Address (high:low) | Length (high:low) | Type\0A\00"
define void @print_header() {
%1 = tail call i32 @print_string(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @print_string(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (...) @print_separator()
ret void
}