xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void help_ascii_art() {
  printf("    __  ___                __    _ ____     __    _ __     \n   /  "
         "|/  ____  ________  / /   (_/ _____  / /   (_/ /____ \n  / /|_/ / __ "
         "\\/ ___/ _ \\/ /   / / /_/ _ \\/ /   / / __/ _ \\\n / /  / / /_/ / / "
         " /  __/ /___/ / __/  __/ /___/ / /_/  __/\n/_/  /_/\\____/_/   "
         "\\___/_____/_/_/  \\___/_____/_/\\__/\\___/ \n\n");
  printf("\n\t\t   Version 1.2.3 Beta\n\n");
}


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

x86 assembly (clang, -O2):
<help_ascii_art>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0x1009(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [302 x i8] c" __ ___ __ _ ____ __ _ __ \0A / |/ ____ ________ / / (_/ _____ / / (_/ /____ \0A / /|_/ / __ \\/ ___/ _ \\/ / / / /_/ _ \\/ / / / __/ _ \\\0A / / / / /_/ / / / __/ /___/ / __/ __/ /___/ / /_/ __/\0A/_/ /_/\\____/_/ \\___/_____/_/_/ \\___/_____/_/\\__/\\___/ \0A\0A\00"
@.str.1 = [27 x i8] c"\0A\09\09 Version 1.2.3 Beta\0A\0A\00"
define void @help_ascii_art() {
%1 = call i32 @printf(i8* getelementptr inbounds ([302 x i8], [302 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [301 x i8] c" __ ___ __ _ ____ __ _ __ \0A / |/ ____ ________ / / (_/ _____ / / (_/ /____ \0A / /|_/ / __ \\/ ___/ _ \\/ / / / /_/ _ \\/ / / / __/ _ \\\0A / / / / /_/ / / / __/ /___/ / __/ __/ /___/ / /_/ __/\0A/_/ /_/\\____/_/ \\___/_____/_/_/ \\___/_____/_/\\__/\\___/ \0A\00"
@str.2 = [26 x i8] c"\0A\09\09 Version 1.2.3 Beta\0A\00"
define void @help_ascii_art() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([301 x i8], [301 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.2, i64 0, i64 0))
ret void
}
void prepare_command(unsigned char command, unsigned int reg_addr,
                     unsigned char *tx_buff) {
  tx_buff[0] = command;
  tx_buff[1] = (unsigned char)reg_addr;
}


x86 assembly (clang, -O0):
<prepare_command>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x1(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<prepare_command>:
mov    %dil,(%rdx)
mov    %sil,0x1(%rdx)
ret

LLVM IR (-O0):
define void @prepare_command(i8 zeroext %0, i32 %1, i8* %2) {
%4 = alloca i8
%5 = alloca i32
%6 = alloca i8*
store i8 %0, i8* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i8, i8* %4
%8 = load i8*, i8** %6
%9 = getelementptr inbounds i8, i8* %8, i64 0
store i8 %7, i8* %9
%10 = load i32, i32* %5
%11 = trunc i32 %10 to i8
%12 = load i8*, i8** %6
%13 = getelementptr inbounds i8, i8* %12, i64 1
store i8 %11, i8* %13
ret void
}

LLVM IR (-O2):
define void @prepare_command(i8 zeroext %0, i32 %1, i8* nocapture writeonly %2) {
store i8 %0, i8* %2
%4 = trunc i32 %1 to i8
%5 = getelementptr inbounds i8, i8* %2, i64 1
store i8 %4, i8* %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ die(char *, int);
void signal_fatal(int signum) {
  die("Sandbox keeper received fatal signal %d", signum);
}


x86 assembly (clang, -O0):
<signal_fatal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <die@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signal_fatal>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <die@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"Sandbox keeper received fatal signal %d\00"
define void @signal_fatal(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @die(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"Sandbox keeper received fatal signal %d\00"
define void @signal_fatal(i32 %0) {
%2 = tail call i32 @die(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ outb(int, int);
void intr_init(void) {
  outb(0x20, 0x11);
  outb(0x21, 0x50);
  outb(0x21, 0x04);
  outb(0x21, 0x01);
  outb(0xA0, 0x11);
  outb(0xA1, 0x70);
  outb(0xA1, 0x02);
  outb(0xA1, 0x01);
  return;
}


x86 assembly (clang, -O0):
<intr_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x20,%edi
mov    $0x11,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0x50,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0x4,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0x1,%esi
call   1030 <outb@plt>
mov    $0xa0,%edi
mov    $0x11,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0x70,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0x2,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0x1,%esi
call   1030 <outb@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<intr_init>:
push   %rax
mov    $0x20,%edi
mov    $0x11,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0x50,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0x4,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0x1,%esi
call   1030 <outb@plt>
mov    $0xa0,%edi
mov    $0x11,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0x70,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0x2,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0x1,%esi
pop    %rax
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @intr_init() {
%1 = call i32 @outb(i32 32, i32 17)
%2 = call i32 @outb(i32 33, i32 80)
%3 = call i32 @outb(i32 33, i32 4)
%4 = call i32 @outb(i32 33, i32 1)
%5 = call i32 @outb(i32 160, i32 17)
%6 = call i32 @outb(i32 161, i32 112)
%7 = call i32 @outb(i32 161, i32 2)
%8 = call i32 @outb(i32 161, i32 1)
ret void
}

LLVM IR (-O2):
define void @intr_init() {
%1 = tail call i32 @outb(i32 32, i32 17)
%2 = tail call i32 @outb(i32 33, i32 80)
%3 = tail call i32 @outb(i32 33, i32 4)
%4 = tail call i32 @outb(i32 33, i32 1)
%5 = tail call i32 @outb(i32 160, i32 17)
%6 = tail call i32 @outb(i32 161, i32 112)
%7 = tail call i32 @outb(i32 161, i32 2)
%8 = tail call i32 @outb(i32 161, i32 1)
ret void
}
int test(int a, int b, int c) { return a + b + c; }


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

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

LLVM IR (-O0):
define i32 @test(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = add nsw i32 %7, %8
%10 = load i32, i32* %6
%11 = add nsw i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @test(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, %0
%5 = add nsw i32 %4, %2
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void fu(void) { printf("\n This is a C code -  that is in Cfile\n"); }


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

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

LLVM IR (-O0):
@.str = [40 x i8] c"\0A This is a C code - that is in Cfile\0A\00"
define void @fu() {
%1 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [39 x i8] c"\0A This is a C code - that is in Cfile\00"
define void @fu() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ isspace(unsigned char);
char *stb_skipwhite(char *s) {
  while (isspace((unsigned char)*s))
    ++s;
  return s;
}


x86 assembly (clang, -O0):
<stb_skipwhite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     1143 <stb_skipwhite+0x33>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <stb_skipwhite+0xc>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stb_skipwhite>:
push   %rbx
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rbx
nopl   0x0(%rax,%rax,1)
movzbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <isspace@plt>
test   %rax,%rax
jne    1120 <stb_skipwhite+0x10>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @stb_skipwhite(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %8, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = call i64 @isspace(i8 zeroext %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %2
br label %3
11: ; preds = %3
%12 = load i8*, i8** %2
ret i8* %12
}

LLVM IR (-O2):
define i8* @stb_skipwhite(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %7, %2 ]
%4 = load i8, i8* %3
%5 = tail call i64 @isspace(i8 zeroext %4)
%6 = icmp eq i64 %5, 0
%7 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %6, label %8, label %2
8: ; preds = %2
ret i8* %3
}
void glColorPointer(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glColorPointer() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SilentWait();
int /*<<< orphan*/ printf(char *);
void Wait(void) {
  printf("\nPress <Return> to continue ...\n");
  SilentWait();
}


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

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

LLVM IR (-O0):
@.str = [33 x i8] c"\0APress <Return> to continue ...\0A\00"
define void @Wait() {
%1 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @SilentWait()
ret void
}

LLVM IR (-O2):
@str = [32 x i8] c"\0APress <Return> to continue ...\00"
define void @Wait() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @SilentWait()
ret void
}
void rop3_125_0_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = T ^ S;
  stk2 = ~stk2;
  stk1 = *D & stk2;
  stk1 = ~stk1;
  *D = stk1;
}


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

x86 assembly (clang, -O2):
<rop3_125_0_0>:
xor    %edx,%esi
mov    (%rdi),%al
not    %al
or     %sil,%al
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_125_0_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8, i8* %6
%10 = zext i8 %9 to i32
%11 = load i8, i8* %5
%12 = zext i8 %11 to i32
%13 = xor i32 %10, %12
%14 = trunc i32 %13 to i8
store i8 %14, i8* %8
%15 = load i8, i8* %8
%16 = zext i8 %15 to i32
%17 = xor i32 %16, -1
%18 = trunc i32 %17 to i8
store i8 %18, i8* %8
%19 = load i8*, i8** %4
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = load i8, i8* %8
%23 = zext i8 %22 to i32
%24 = and i32 %21, %23
%25 = trunc i32 %24 to i8
store i8 %25, i8* %7
%26 = load i8, i8* %7
%27 = zext i8 %26 to i32
%28 = xor i32 %27, -1
%29 = trunc i32 %28 to i8
store i8 %29, i8* %7
%30 = load i8, i8* %7
%31 = load i8*, i8** %4
store i8 %30, i8* %31
ret void
}

LLVM IR (-O2):
define void @rop3_125_0_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = xor i8 %2, %1
%5 = load i8, i8* %0
%6 = xor i8 %5, -1
%7 = or i8 %4, %6
store i8 %7, i8* %0
ret void
}
void encode(char *vals, char *buf) {}


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

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

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

LLVM IR (-O2):
define void @encode(i8* nocapture %0, i8* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ kill(int /*<<< orphan*/, int);
void propagate_condition(int signum) { kill(getpid(), signum); }


x86 assembly (clang, -O0):
<propagate_condition>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%edi
mov    -0x4(%rbp),%esi
call   1040 <kill@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<propagate_condition>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1040 <kill@plt>

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

LLVM IR (-O2):
define void @propagate_condition(i32 %0) {
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 @kill(i32 %2, i32 %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
char *fgets(char *, int, int /*<<< orphan*/ *);
void fgets_or_exit(char *buffer, int size, FILE *stream) {
  char *rep = fgets(buffer, size, stream);
  if (rep == NULL) {
    exit(0);
  }
}


x86 assembly (clang, -O0):
<fgets_or_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <fgets@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1159 <fgets_or_exit+0x39>
xor    %edi,%edi
call   1040 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgets_or_exit>:
push   %rax
call   1030 <fgets@plt>
test   %rax,%rax
je     112d <fgets_or_exit+0xd>
pop    %rax
ret
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @fgets_or_exit(i8* %0, i32 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = load i32*, i32** %6
%11 = call i8* @fgets(i8* %8, i32 %9, i32* %10)
store i8* %11, i8** %7
%12 = load i8*, i8** %7
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %16
14: ; preds = %3
%15 = call i32 @exit(i32 0)
unreachable
16: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @fgets_or_exit(i8* %0, i32 %1, i32* nocapture %2) {
%4 = tail call i8* @fgets(i8* %0, i32 %1, i32* %2)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %3
ret void
}
void be_uint16_write(void *ptr, unsigned v) {
  unsigned char *ptr8 = (unsigned char *)ptr;
  ptr8[1] = v & 0xFF;
  ptr8[0] = (v >> 8) & 0xFF;
}


x86 assembly (clang, -O0):
<be_uint16_write>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0xc(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<be_uint16_write>:
rol    $0x8,%si
mov    %si,(%rdi)
ret

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

LLVM IR (-O2):
define void @be_uint16_write(i8* nocapture writeonly %0, i32 %1) {
%3 = trunc i32 %1 to i8
%4 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %3, i8* %4
%5 = lshr i32 %1, 8
%6 = trunc i32 %5 to i8
store i8 %6, i8* %0
ret void
}
void foo491(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo491(i32 %0) {
ret void
}
/* Variables and functions */
char *getpwd(char *, size_t);
char *getcwd(char *buf, size_t size) { return getpwd(buf, size); }


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

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

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

LLVM IR (-O2):
define i8* @getcwd(i8* %0, i64 %1) {
%3 = tail call i8* @getpwd(i8* %0, i64 %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *xmalloc(size_t);
void *xcalloc(size_t nmemb, size_t size) {
  void *ptr;
  if ((ptr = xmalloc(nmemb * size)) == NULL)
    return NULL;
  memset(ptr, 0, nmemb * size);
  return ptr;
}


x86 assembly (clang, -O0):
<xcalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
imul   -0x18(%rbp),%rdi
call   1040 <xmalloc@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1159 <xcalloc+0x39>
movq   $0x0,-0x8(%rbp)
jmp    1175 <xcalloc+0x55>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rdx
imul   -0x18(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
imul   %rsi,%rbx
mov    %rbx,%rdi
call   1040 <xmalloc@plt>
mov    %rax,%r14
test   %rax,%rax
je     1148 <xcalloc+0x28>
mov    %r14,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @xcalloc(i64 %0, i64 %1) {
%3 = mul i64 %1, %0
%4 = tail call i8* @xmalloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @memset(i8* %4, i32 0, i64 %3)
br label %8
8: ; preds = %2, %6
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ func_44(int);
void testTortureExecute(void) {
  func_44(2);
  return;
}


x86 assembly (clang, -O0):
<testTortureExecute>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1030 <func_44@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<testTortureExecute>:
mov    $0x2,%edi
jmp    1030 <func_44@plt>

LLVM IR (-O0):
define void @testTortureExecute() {
%1 = call i32 @func_44(i32 2)
ret void
}

LLVM IR (-O2):
define void @testTortureExecute() {
%1 = tail call i32 @func_44(i32 2)
ret void
}
void foo_1_2_1_2_1_2_1_2_2() {}


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

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

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

LLVM IR (-O2):
define void @foo_1_2_1_2_1_2_1_2_2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ getpid();
int kill(int /*<<< orphan*/, int);
int __raise(int signo) { return kill(getpid(), signo); }


x86 assembly (clang, -O0):
<__raise>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%edi
mov    -0x4(%rbp),%esi
call   1040 <kill@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__raise>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1040 <kill@plt>

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

LLVM IR (-O2):
define i32 @__raise(i32 %0) {
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 @kill(i32 %2, i32 %0)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isalnum(int);
void t_isalnum_0xff() {
  Assert_real((isalnum(255) == 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_isalnum.c",
              1280, ("isalnum should be 0 for 0xff"));
}


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

x86 assembly (clang, -O2):
<t_isalnum_0xff>:
push   %rax
mov    $0xff,%edi
call   1030 <isalnum@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x500,%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_isalnum.c\00"
@.str.1 = [29 x i8] c"isalnum should be 0 for 0xff\00"
define void @t_isalnum_0xff() {
%1 = call i64 @isalnum(i32 255)
%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 1280, 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_isalnum.c\00"
@.str.1 = [29 x i8] c"isalnum should be 0 for 0xff\00"
define void @t_isalnum_0xff() {
%1 = tail call i64 @isalnum(i32 255)
%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 1280, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isodigit(int);
void t_isodigit_0x08() {
  Assert_real((isodigit(8) == 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_isodigit.c",
              45, ("isodigit should be 0 for 0x08"));
}


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

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

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

LLVM IR (-O2):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isodigit.c\00"
@.str.1 = [30 x i8] c"isodigit should be 0 for 0x08\00"
define void @t_isodigit_0x08() {
%1 = tail call i64 @isodigit(i32 8)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 45, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_get_user_name_malloc() {
  printf("NOT IMPLEMENTED:"
         "pa_get_user_name_malloc"
         "\n");
}


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

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

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

LLVM IR (-O2):
@str = [40 x i8] c"NOT IMPLEMENTED:pa_get_user_name_malloc\00"
define i32 @pa_get_user_name_malloc() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
unsigned int syscall(int);
unsigned int MCP_HAL_LOG_GetThreadId(void) { return syscall(224); }


x86 assembly (clang, -O0):
<MCP_HAL_LOG_GetThreadId>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe0,%edi
call   1030 <syscall@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<MCP_HAL_LOG_GetThreadId>:
mov    $0xe0,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
define i32 @MCP_HAL_LOG_GetThreadId() {
%1 = call i32 @syscall(i32 224)
ret i32 %1
}

LLVM IR (-O2):
define i32 @MCP_HAL_LOG_GetThreadId() {
%1 = tail call i32 @syscall(i32 224)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ PITCH_init();
int /*<<< orphan*/ ROLL_init();
int /*<<< orphan*/ YAW_init();
void COMPUTER_PROGRAMS_init(void) {
  PITCH_init();
  ROLL_init();
  YAW_init();
}


x86 assembly (clang, -O0):
<COMPUTER_PROGRAMS_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <PITCH_init@plt>
mov    $0x0,%al
call   1040 <ROLL_init@plt>
mov    $0x0,%al
call   1050 <YAW_init@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<COMPUTER_PROGRAMS_init>:
push   %rax
xor    %eax,%eax
call   1030 <PITCH_init@plt>
xor    %eax,%eax
call   1040 <ROLL_init@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <YAW_init@plt>

LLVM IR (-O0):
define void @COMPUTER_PROGRAMS_init() {
%1 = call i32 (...) @PITCH_init()
%2 = call i32 (...) @ROLL_init()
%3 = call i32 (...) @YAW_init()
ret void
}

LLVM IR (-O2):
define void @COMPUTER_PROGRAMS_init() {
%1 = tail call i32 (...) @PITCH_init()
%2 = tail call i32 (...) @ROLL_init()
%3 = tail call i32 (...) @YAW_init()
ret void
}
/* Variables and functions */
double abs(double);
double distance(double left, double right) { return abs(left - right); }


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

x86 assembly (clang, -O2):
<distance>:
subsd  %xmm1,%xmm0
jmp    1030 <abs@plt>

LLVM IR (-O0):
define double @distance(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fsub double %5, %6
%8 = call double @abs(double %7)
ret double %8
}

LLVM IR (-O2):
define double @distance(double %0, double %1) {
%3 = fsub double %0, %1
%4 = tail call double @abs(double %3)
ret double %4
}
int read_register(reg_addr)
char reg_addr;
{
  outb(0x70, reg_addr);
  return inb(0x71);
}


x86 assembly (clang, -O0):
<read_register>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%esi
mov    $0x70,%edi
mov    $0x0,%al
call   1030 <outb@plt>
mov    $0x71,%edi
mov    $0x0,%al
call   1040 <inb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_register>:
push   %rax
movsbl %dil,%esi
mov    $0x70,%edi
xor    %eax,%eax
call   1030 <outb@plt>
mov    $0x71,%edi
xor    %eax,%eax
pop    %rcx
jmp    1040 <inb@plt>

LLVM IR (-O0):
define i32 @read_register(i32 %0) {
%2 = alloca i8
%3 = trunc i32 %0 to i8
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = call i32 (i32, i32, ...) bitcast (i32 (...)* @outb to i32 (i32, i32, ...)*)(i32 112, i32 %5)
%7 = call i32 (i32, ...) bitcast (i32 (...)* @inb to i32 (i32, ...)*)(i32 113)
ret i32 %7
}

LLVM IR (-O2):
define i32 @read_register(i32 %0) {
%2 = shl i32 %0, 24
%3 = ashr exact i32 %2, 24
%4 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @outb to i32 (i32, i32, ...)*)(i32 112, i32 %3)
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @inb to i32 (i32, ...)*)(i32 113)
ret i32 %5
}
double test_dummy(void) { return 1; }


x86 assembly (clang, -O0):
<test_dummy>:
push   %rbp
mov    %rsp,%rbp
movsd  0xef4(%rip),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_dummy>:
movsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @test_dummy() {
ret double 1.000000e+00
}

LLVM IR (-O2):
define double @test_dummy() {
ret double 1.000000e+00
}
/* Type definitions */
struct event {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ event_del(struct event *);
int /*<<< orphan*/ printf(char *);
void timeout_cb(int fd, short event, void *arg) {
  printf("timeout fired, time to end test\n");
  event_del(*(struct event **)arg);
  return;
}


x86 assembly (clang, -O0):
<timeout_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %edi,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
mov    %rdx,-0x10(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <event_del@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeout_cb>:
push   %rbx
mov    %rdx,%rbx
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%rdi
pop    %rbx
jmp    1040 <event_del@plt>

LLVM IR (-O0):
%struct.event = type { i32 }
@.str = [33 x i8] c"timeout fired, time to end test\0A\00"
define void @timeout_cb(i32 %0, i16 signext %1, i8* %2) {
%4 = alloca i32
%5 = alloca i16
%6 = alloca i8*
store i32 %0, i32* %4
store i16 %1, i16* %5
store i8* %2, i8** %6
%7 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %6
%9 = bitcast i8* %8 to %struct.event**
%10 = load %struct.event*, %struct.event** %9
%11 = call i32 @event_del(%struct.event* %10)
ret void
}

LLVM IR (-O2):
%struct.event = type { i32 }
@str = [32 x i8] c"timeout fired, time to end test\00"
define void @timeout_cb(i32 %0, i16 signext %1, i8* nocapture %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%5 = bitcast i8* %2 to %struct.event**
%6 = load %struct.event*, %struct.event** %5
%7 = tail call i32 @event_del(%struct.event* %6)
ret void
}
int length(char *p) {
  int n;
  n = 0;
  while (*p != 0) {
    n++;
    p++;
  }
  return (n);
}


x86 assembly (clang, -O0):
<length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1139 <length+0x39>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <length+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<length>:
cmpb   $0x0,(%rdi)
je     111c <length+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <length+0x10>
ret
xor    %eax,%eax
ret

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

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

/* Variables and functions */
float mat2_determinant(float *);
__attribute__((always_)) float psmat2_determinant(struct mat2 *m) {
  return mat2_determinant((float *)m);
}


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

x86 assembly (clang, -O2):
<psmat2_determinant>:
jmp    1030 <mat2_determinant@plt>

LLVM IR (-O0):
%struct.mat2 = type { i32 }
define float @psmat2_determinant(%struct.mat2* %0) {
%2 = alloca %struct.mat2*
store %struct.mat2* %0, %struct.mat2** %2
%3 = load %struct.mat2*, %struct.mat2** %2
%4 = bitcast %struct.mat2* %3 to float*
%5 = call float @mat2_determinant(float* %4)
ret float %5
}

LLVM IR (-O2):
%struct.mat2 = type { i32 }
define float @psmat2_determinant(%struct.mat2* %0) {
%2 = bitcast %struct.mat2* %0 to float*
%3 = tail call float @mat2_determinant(float* %2)
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ LOG_DEBUG;
scalar_t__ daemon_init(char *, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int server();
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, int);
int main(int argc, char *argv[]) {
  if (daemon_init(argv[0], 0) < 0) {
    exit(-1);
  }
  int status;
  status = server();
  syslog(LOG_DEBUG, "exited with %d", status);
  return status;
}


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    -0x10(%rbp),%rax
mov    (%rax),%rdi
xor    %esi,%esi
call   1030 <daemon_init@plt>
cmp    $0x0,%rax
jge    1178 <main+0x38>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
mov    $0x0,%al
call   1040 <server@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xe6b(%rip),%rsi
call   1050 <syslog@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    (%rsi),%rdi
xor    %esi,%esi
call   1030 <daemon_init@plt>
test   %rax,%rax
js     1174 <main+0x34>
xor    %eax,%eax
call   1040 <server@plt>
mov    %eax,%ebx
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
lea    0xe97(%rip),%rsi
mov    %ebx,%edx
call   1050 <syslog@plt>
mov    %ebx,%eax
pop    %rbx
ret
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@LOG_DEBUG = global i32 0
@.str = [15 x i8] c"exited with %d\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 i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 0
%9 = load i8*, i8** %8
%10 = call i64 @daemon_init(i8* %9, i32 0)
%11 = icmp slt i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @exit(i32 -1)
unreachable
14: ; preds = %2
%15 = call i32 (...) @server()
store i32 %15, i32* %6
%16 = load i32, i32* @LOG_DEBUG
%17 = load i32, i32* %6
%18 = call i32 @syslog(i32 %16, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %6
ret i32 %19
}

LLVM IR (-O2):
@LOG_DEBUG = global i32 0
@.str = [15 x i8] c"exited with %d\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = tail call i64 @daemon_init(i8* %3, i32 0)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @exit(i32 -1)
unreachable
8: ; preds = %2
%9 = tail call i32 (...) @server()
%10 = load i32, i32* @LOG_DEBUG
%11 = tail call i32 @syslog(i32 %10, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %9)
ret i32 %9
}
void foo() {
  int z[10];
  z[2] = 34;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
movl   $0x22,-0x28(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @foo() {
%1 = alloca [10 x i32]
%2 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
store i32 34, i32* %2
ret void
}

LLVM IR (-O2):
define void @foo() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  float a[2], temp;
  a[0] = -0.375f;
  temp = (int)(a[0] / 0.03125f);
  assert(temp == -12.0f);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  0xee8(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xed2(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xeb0(%rip),%xmm1
ucomiss %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca [2 x float]
%2 = alloca float
%3 = getelementptr inbounds [2 x float], [2 x float]* %1, i64 0, i64 0
store float -3.750000e-01, float* %3
%4 = getelementptr inbounds [2 x float], [2 x float]* %1, i64 0, i64 0
%5 = load float, float* %4
%6 = fdiv float %5, 3.125000e-02
%7 = fptosi float %6 to i32
%8 = sitofp i32 %7 to float
store float %8, float* %2
%9 = load float, float* %2
%10 = fcmp oeq float %9, -1.200000e+01
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
ret i32 0
}
void f2(int age) {
  int test = age - age;
  age = age / test;
}


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* %2
%6 = sub nsw i32 %4, %5
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = sdiv i32 %7, %8
store i32 %9, i32* %2
ret void
}

LLVM IR (-O2):
define void @f2(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print_facts(int, int);
int main(void) {
  int i;
  int j;
  i = -8;
  j = 7;
  print_facts(i, j);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xfffffff8,%edi
mov    $0x7,%esi
call   1030 <print_facts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @print_facts(i32 -8, i32 7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, unsigned int, char const *, double);
void __ghdl_snprintf_fmtf(char *buf, unsigned int len, const char *format,
                          double v) {
  snprintf(buf, len, format, v);
}


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

x86 assembly (clang, -O2):
<__ghdl_snprintf_fmtf>:
jmp    1030 <snprintf@plt>

LLVM IR (-O0):
define void @__ghdl_snprintf_fmtf(i8* %0, i32 %1, i8* %2, double %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca double
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store double %3, double* %8
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = load i8*, i8** %7
%12 = load double, double* %8
%13 = call i32 @snprintf(i8* %9, i32 %10, i8* %11, double %12)
ret void
}

LLVM IR (-O2):
define void @__ghdl_snprintf_fmtf(i8* %0, i32 %1, i8* %2, double %3) {
%5 = tail call i32 @snprintf(i8* %0, i32 %1, i8* %2, double %3)
ret void
}
void led_stop(void) {}


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

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

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

LLVM IR (-O2):
define void @led_stop() {
ret void
}
int main() { return 1 | 2; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    $0x3,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 3
}
/* Variables and functions */
int /*<<< orphan*/ X6502_IRQBegin(int);
void MNNNIRQHook() { X6502_IRQBegin(0x001); }


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

x86 assembly (clang, -O2):
<MNNNIRQHook>:
mov    $0x1,%edi
jmp    1030 <X6502_IRQBegin@plt>

LLVM IR (-O0):
define void @MNNNIRQHook() {
%1 = call i32 @X6502_IRQBegin(i32 1)
ret void
}

LLVM IR (-O2):
define void @MNNNIRQHook() {
%1 = tail call i32 @X6502_IRQBegin(i32 1)
ret void
}
int uniphier_sld3_pll_init(const struct uniphier_board_data *bd) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.uniphier_board_data = type opaque
define i32 @uniphier_sld3_pll_init(%struct.uniphier_board_data* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int strcmp(char *, char *);
int compare(void *old, void *new) {
  char *str_old = (char *)old;
  char *str_new = (char *)new;
  return strcmp(str_new, str_old);
}


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

x86 assembly (clang, -O2):
<compare>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @compare(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(1) %0)
ret i32 %3
}
double cbrt(double x) { return 4; }


x86 assembly (clang, -O0):
<cbrt>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbrt>:
movsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @cbrt(double %0) {
%2 = alloca double
store double %0, double* %2
ret double 4.000000e+00
}

LLVM IR (-O2):
define double @cbrt(double %0) {
ret double 4.000000e+00
}