xunge/DecIR huggingface dataset:
void gs_size(long display, long *x, long *y, long *w, long *h) {}


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

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

LLVM IR (-O0):
define void @gs_size(i64 %0, i64* %1, i64* %2, i64* %3, i64* %4) {
%6 = alloca i64
%7 = alloca i64*
%8 = alloca i64*
%9 = alloca i64*
%10 = alloca i64*
store i64 %0, i64* %6
store i64* %1, i64** %7
store i64* %2, i64** %8
store i64* %3, i64** %9
store i64* %4, i64** %10
ret void
}

LLVM IR (-O2):
define void @gs_size(i64 %0, i64* nocapture %1, i64* nocapture %2, i64* nocapture %3, i64* nocapture %4) {
ret void
}
int test_imm_BFuint16_reg(unsigned short val) {
  return ((val) & (0xBF << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_BFuint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 191
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main(int argc, char **argv) {
  puts("hello, world");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%rip),%rdi
call   1030 <puts@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>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"hello, world\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"hello, world\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ _soundclear(unsigned char);
void sound_makesilence() { _soundclear(((unsigned char)0)); }


x86 assembly (clang, -O0):
<sound_makesilence>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <_soundclear@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sound_makesilence>:
xor    %edi,%edi
jmp    1030 <_soundclear@plt>

LLVM IR (-O0):
define void @sound_makesilence() {
%1 = call i32 @_soundclear(i8 zeroext 0)
ret void
}

LLVM IR (-O2):
define void @sound_makesilence() {
%1 = tail call i32 @_soundclear(i8 zeroext 0)
ret void
}
/* Variables and functions */
double ReflexTestData_GetMaxResponseTime();
double LcdModel_GetMaxResponseTime() {
  return ReflexTestData_GetMaxResponseTime();
}


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

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

LLVM IR (-O0):
define double @LcdModel_GetMaxResponseTime() {
%1 = call double (...) @ReflexTestData_GetMaxResponseTime()
ret double %1
}

LLVM IR (-O2):
define double @LcdModel_GetMaxResponseTime() {
%1 = tail call double (...) @ReflexTestData_GetMaxResponseTime()
ret double %1
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
void usage() {
  fprintf(stdout, "Unpack/integrity check tool for system firmware.\n"
                  "Usage: sysextract [-cx] <input file> -o <output dir>\n"
                  "\t-c <file>        perform integrity check of <file>\n"
                  "\t-x <file>        extract <file>. Default destination is "
                  "current working dir\n"
                  "\t-o <output dir>  output to <output dir>\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):
@stdout = global i32 0
@.str = [273 x i8] c"Unpack/integrity check tool for system firmware.\0AUsage: sysextract [-cx] <input file> -o <output dir>\0A\09-c <file> perform integrity check of <file>\0A\09-x <file> extract <file>. Default destination is current working dir\0A\09-o <output dir> output to <output dir>\0A\00"
define void @usage() {
%1 = load i32, i32* @stdout
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([273 x i8], [273 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [273 x i8] c"Unpack/integrity check tool for system firmware.\0AUsage: sysextract [-cx] <input file> -o <output dir>\0A\09-c <file> perform integrity check of <file>\0A\09-x <file> extract <file>. Default destination is current working dir\0A\09-o <output dir> output to <output dir>\0A\00"
define void @usage() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([273 x i8], [273 x i8]* @.str, i64 0, i64 0))
ret void
}
int test_imm_87uint16_mem(unsigned short *val) {
  return ((*val) & (-0x87 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_87uint16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%edx
and    $0xffffff79,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_87uint16_mem>:
movzwl (%rdi),%eax
test   $0xff79,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_87uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -135
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void io_wait(void) { asm volatile("outb %%al, $0x80" : : "a"(0)); }


x86 assembly (clang, -O0):
<io_wait>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
out    %al,$0x80
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_wait>:
xor    %eax,%eax
out    %al,$0x80
ret

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

LLVM IR (-O2):
define void @io_wait() {
tail call void asm sideeffect "outb %al, $$0x80", "{ax},~{dirflag},~{fpsr},~{flags}"(i32 0)
ret void
}
int getint(unsigned char *data) { return data[0] + data[1] * 0x0100; }


x86 assembly (clang, -O0):
<getint>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getint>:
movzwl (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @getint(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = mul nsw i32 %10, 256
%12 = add nsw i32 %6, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @getint(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = shl nuw nsw i32 %6, 8
%8 = or i32 %7, %3
ret i32 %8
}
/* Type definitions */
struct forth_instance {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ putc(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ st_pop(struct forth_instance *);
int /*<<< orphan*/ stdout;
void emit(struct forth_instance *fi) { putc(st_pop(fi), stdout); }


x86 assembly (clang, -O0):
<emit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <st_pop@plt>
mov    %eax,%edi
mov    0x2ea2(%rip),%rax
mov    (%rax),%esi
call   1040 <putc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit>:
push   %rax
call   1030 <st_pop@plt>
mov    0x2eb3(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
pop    %rax
jmp    1040 <putc@plt>

LLVM IR (-O0):
%struct.forth_instance = type { i32 }
@stdout = global i32 0
define void @emit(%struct.forth_instance* %0) {
%2 = alloca %struct.forth_instance*
store %struct.forth_instance* %0, %struct.forth_instance** %2
%3 = load %struct.forth_instance*, %struct.forth_instance** %2
%4 = call i32 @st_pop(%struct.forth_instance* %3)
%5 = load i32, i32* @stdout
%6 = call i32 @putc(i32 %4, i32 %5)
ret void
}

LLVM IR (-O2):
%struct.forth_instance = type { i32 }
@stdout = global i32 0
define void @emit(%struct.forth_instance* %0) {
%2 = tail call i32 @st_pop(%struct.forth_instance* %0)
%3 = load i32, i32* @stdout
%4 = tail call i32 @putc(i32 %2, i32 %3)
ret void
}
/* Variables and functions */
int cbmarch_get_eoi(int);
int cbm_get_eoi(int HandleDevice) {
  ;
  return cbmarch_get_eoi(HandleDevice);
}


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

x86 assembly (clang, -O2):
<cbm_get_eoi>:
jmp    1030 <cbmarch_get_eoi@plt>

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

LLVM IR (-O2):
define i32 @cbm_get_eoi(i32 %0) {
%2 = tail call i32 @cbmarch_get_eoi(i32 %0)
ret i32 %2
}
int ChkCcmpKeyLen(unsigned long len) {
  return len != 0 && len != 16 ? (0) : (1);
}


x86 assembly (clang, -O0):
<ChkCcmpKeyLen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     1123 <ChkCcmpKeyLen+0x23>
cmpq   $0x10,-0x8(%rbp)
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%dl
mov    $0x1,%eax
xor    %ecx,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ChkCcmpKeyLen>:
xor    %eax,%eax
test   $0xffffffffffffffef,%rdi
sete   %al
ret

LLVM IR (-O0):
define i32 @ChkCcmpKeyLen(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i64, i64* %2
%7 = icmp ne i64 %6, 16
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 0, i32 1
ret i32 %11
}

LLVM IR (-O2):
define i32 @ChkCcmpKeyLen(i64 %0) {
%2 = and i64 %0, -17
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
void goto_level(int level) {}


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

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

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

LLVM IR (-O2):
define void @goto_level(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_version(void) {
  printf("bin2dec version %s\n", ("1.6"));
  printf("James Hendrie - hendrie.james@gmail.com\n");
}


x86 assembly (clang, -O0):
<print_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xef2(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_version>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xee5(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedb(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"bin2dec version %s\0A\00"
@.str.1 = [4 x i8] c"1.6\00"
@.str.2 = [41 x i8] c"James Hendrie - hendrie.james@gmail.com\0A\00"
define void @print_version() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"bin2dec version %s\0A\00"
@.str.1 = [4 x i8] c"1.6\00"
@str = [40 x i8] c"James Hendrie - hendrie.james@gmail.com\00"
define void @print_version() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void help(const char *name) {
  fprintf(stderr, "Usage: %s [args...] [-- [mtdiag args..]]\n", name);
  fprintf(stderr, "  -v, --verbose   Be verbose\n");
  fprintf(stderr, "  -h, --help      Display this help message\n");
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
lea    0xeea(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<help>:
push   %rbx
mov    %rdi,%rdx
mov    0x2ec5(%rip),%rbx
mov    (%rbx),%edi
lea    0xedc(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xef6(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf04(%rip),%rsi
xor    %eax,%eax
pop    %rbx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [42 x i8] c"Usage: %s [args...] [-- [mtdiag args..]]\0A\00"
@.str.1 = [30 x i8] c" -v, --verbose Be verbose\0A\00"
@.str.2 = [45 x i8] c" -h, --help Display this help message\0A\00"
define void @help(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @stderr
%7 = call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* @stderr
%9 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [42 x i8] c"Usage: %s [args...] [-- [mtdiag args..]]\0A\00"
@.str.1 = [30 x i8] c" -v, --verbose Be verbose\0A\00"
@.str.2 = [45 x i8] c" -h, --help Display this help message\0A\00"
define void @help(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0))
ret void
}
is_table_end(s) char *s;
{
  if (!prefix(".TE", s))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<is_table_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <prefix@plt>
cmp    $0x0,%eax
jne    1143 <is_table_end+0x33>
movl   $0x0,-0x4(%rbp)
jmp    114a <is_table_end+0x3a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_table_end>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <prefix@plt>
xor    %ecx,%ecx
test   %eax,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c".TE\00"
define i32 @is_table_end(i8* %0) {
%2 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @prefix to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = icmp ne i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
int ft_itoa_root(int number, unsigned long root) {
  if (root < 0x01)
    return (0x00);
  else if (root == 0x01)
    return (number);
  else
    return (number * ft_itoa_root(number, --root));
}


x86 assembly (clang, -O0):
<ft_itoa_root>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x1,-0x10(%rbp)
jae    1136 <ft_itoa_root+0x26>
movl   $0x0,-0x4(%rbp)
jmp    1171 <ft_itoa_root+0x61>
cmpq   $0x1,-0x10(%rbp)
jne    114c <ft_itoa_root+0x3c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1171 <ft_itoa_root+0x61>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
add    $0xffffffffffffffff,%rsi
mov    %rsi,-0x10(%rbp)
call   1030 <ft_itoa_root@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_itoa_root>:
mov    %edi,%eax
mov    $0x1,%ecx
test   %rsi,%rsi
je     1122 <ft_itoa_root+0x22>
nopl   0x0(%rax)
cmp    $0x1,%rsi
je     1124 <ft_itoa_root+0x24>
add    $0xffffffffffffffff,%rsi
imul   %eax,%ecx
test   %rsi,%rsi
jne    1110 <ft_itoa_root+0x10>
xor    %eax,%eax
imul   %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_itoa_root(i32 %0, i64 %1) {
br label %3
3: ; preds = %6, %2
%4 = phi i32 [ 1, %2 ], [ %8, %6 ]
%5 = phi i64 [ %1, %2 ], [ %7, %6 ]
switch i64 %5, label %6 [
i64 0, label %9
i64 1, label %10
]
6: ; preds = %3
%7 = add i64 %5, -1
%8 = mul nsw i32 %4, %0
br label %3
9: ; preds = %3
br label %10
10: ; preds = %3, %9
%11 = phi i32 [ 0, %9 ], [ %0, %3 ]
%12 = mul nsw i32 %11, %4
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int main() {
  FILE *f = fopen("testing", "w");
  fputs("testing", f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    0xecb(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xeaf(%rip),%rdi
call   1030 <fputs@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
lea    0xed9(%rip),%rsi
mov    %rbx,%rdi
call   1030 <fopen@plt>
mov    $0x7,%esi
mov    $0x1,%edx
mov    %rbx,%rdi
mov    %rax,%rcx
call   1040 <fwrite@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"testing\00"
@.str.1 = [2 x i8] c"w\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @fputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"testing\00"
@.str.1 = [2 x i8] c"w\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64 7, i64 1, i32* %1)
ret i32 0
}
double exp(double x) {
  const double a0 = 4.221396646731853477890919644216017231587;
  const double a1 = -2.615291204757967766624186359891455241753;
  const double a2 = -1.032749880400710397703832804115474876830;
  const double a3 = 6.586172186945825481523412117510136175816e-1;
  const double a4 = 1.532916782209180014540976136050537099408e-1;
  return a0 + x * (a1 + x * (a2 + x * (a3 + x * a4)));
}


x86 assembly (clang, -O0):
<exp>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xeea(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xee5(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xee8(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xed3(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm3
movsd  0xeb2(%rip),%xmm4
mulsd  %xmm4,%xmm3
movsd  0xeae(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0xe8e(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe76(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe5e(%rip),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<exp>:
movsd  0xef8(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xef4(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xef0(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xeec(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  0xee8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @exp(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %2
store double 0x4010E2B5CD74A127, double* %3
store double 0xC004EC1DCB8F9D84, double* %4
store double 0xBFF08624BD144DAC, double* %5
store double 0x3FE513646ADC05D5, double* %6
store double 0x3FC39F0FCC5A9922, double* %7
%8 = load double, double* %2
%9 = load double, double* %2
%10 = load double, double* %2
%11 = load double, double* %2
%12 = call double @llvm.fmuladd.f64(double %11, double 0x3FC39F0FCC5A9922, double 0x3FE513646ADC05D5)
%13 = call double @llvm.fmuladd.f64(double %10, double %12, double 0xBFF08624BD144DAC)
%14 = call double @llvm.fmuladd.f64(double %9, double %13, double 0xC004EC1DCB8F9D84)
%15 = call double @llvm.fmuladd.f64(double %8, double %14, double 0x4010E2B5CD74A127)
ret double %15
}

LLVM IR (-O2):
define double @exp(double %0) {
%2 = tail call double @llvm.fmuladd.f64(double %0, double 0x3FC39F0FCC5A9922, double 0x3FE513646ADC05D5)
%3 = tail call double @llvm.fmuladd.f64(double %0, double %2, double 0xBFF08624BD144DAC)
%4 = tail call double @llvm.fmuladd.f64(double %0, double %3, double 0xC004EC1DCB8F9D84)
%5 = tail call double @llvm.fmuladd.f64(double %0, double %4, double 0x4010E2B5CD74A127)
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ ShowMsg(char *);
int main() {
  char *hw = "hello";
  ShowMsg(hw);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
define i32 @main() {
%1 = tail call i32 @ShowMsg(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int mul2OK(int x) {
  int bit31 = x >> 31 & 0x1;
  int bit30 = x >> 30 & 0x1;
  return ~(bit31 ^ bit30) & 0x1;
}


x86 assembly (clang, -O0):
<mul2OK>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1f,%eax
and    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1e,%eax
and    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
xor    -0xc(%rbp),%eax
xor    $0xffffffff,%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mul2OK>:
mov    %edi,%eax
shr    $0x1e,%eax
and    $0x1,%eax
not    %edi
shr    $0x1f,%edi
xor    %edi,%eax
ret

LLVM IR (-O0):
define i32 @mul2OK(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = ashr i32 %5, 31
%7 = and i32 %6, 1
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = ashr i32 %8, 30
%10 = and i32 %9, 1
store i32 %10, i32* %4
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = xor i32 %11, %12
%14 = xor i32 %13, -1
%15 = and i32 %14, 1
ret i32 %15
}

LLVM IR (-O2):
define i32 @mul2OK(i32 %0) {
%2 = lshr i32 %0, 30
%3 = and i32 %2, 1
%4 = xor i32 %0, -1
%5 = lshr i32 %4, 31
%6 = xor i32 %5, %3
ret i32 %6
}
extern int foo(void) { return 42; }


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

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

LLVM IR (-O0):
define i32 @foo() {
ret i32 42
}

LLVM IR (-O2):
define i32 @foo() {
ret i32 42
}
void I422ToARGBRow_Any_NEON() {}


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

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

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

LLVM IR (-O2):
define void @I422ToARGBRow_Any_NEON() {
ret void
}
int test_imm_B6int16_mem(short *val) {
  return ((*val) & (-0xB6 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_B6int16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%edx
and    $0xffffff4a,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_B6int16_mem>:
movzwl (%rdi),%eax
test   $0xff4a,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_B6int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -182
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ ST7735_OutChar(int);
int fputc(int ch, FILE *f) {
  ST7735_OutChar(ch);
  return 1;
}


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

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

LLVM IR (-O0):
define i32 @fputc(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%5 = load i32, i32* %3
%6 = call i32 @ST7735_OutChar(i32 %5)
ret i32 1
}

LLVM IR (-O2):
define i32 @fputc(i32 %0, i32* nocapture readnone %1) {
%3 = tail call i32 @ST7735_OutChar(i32 %0)
ret i32 1
}
unsigned int version_8to32(const unsigned int major, const unsigned int minor,
                           const unsigned int revision,
                           const unsigned int development) {
  return ((major & 0xFFU) << 24) | ((minor & 0xFFU) << 16) |
         ((revision & 0xFFU) << 8) | (development & 0xFFU);
}


x86 assembly (clang, -O0):
<version_8to32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
shl    $0x18,%eax
mov    -0x8(%rbp),%ecx
and    $0xff,%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%ecx
and    $0xff,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
and    $0xff,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<version_8to32>:
shl    $0x18,%edi
movzbl %sil,%eax
shl    $0x10,%eax
or     %edi,%eax
shl    $0x8,%edx
movzwl %dx,%edx
or     %eax,%edx
movzbl %cl,%eax
or     %edx,%eax
ret

LLVM IR (-O0):
define i32 @version_8to32(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = and i32 %9, 255
%11 = shl i32 %10, 24
%12 = load i32, i32* %6
%13 = and i32 %12, 255
%14 = shl i32 %13, 16
%15 = or i32 %11, %14
%16 = load i32, i32* %7
%17 = and i32 %16, 255
%18 = shl i32 %17, 8
%19 = or i32 %15, %18
%20 = load i32, i32* %8
%21 = and i32 %20, 255
%22 = or i32 %19, %21
ret i32 %22
}

LLVM IR (-O2):
define i32 @version_8to32(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = shl i32 %0, 24
%6 = shl i32 %1, 16
%7 = and i32 %6, 16711680
%8 = or i32 %7, %5
%9 = shl i32 %2, 8
%10 = and i32 %9, 65280
%11 = or i32 %8, %10
%12 = and i32 %3, 255
%13 = or i32 %11, %12
ret i32 %13
}
/* Variables and functions */
unsigned char *random_dict(unsigned char *, size_t, unsigned char *, size_t);
unsigned char *generate_dict_random(unsigned char *out, size_t out_len,
                                    unsigned char *dict, size_t dict_len) {
  return random_dict(out, out_len, dict, dict_len);
}


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

x86 assembly (clang, -O2):
<generate_dict_random>:
jmp    1030 <random_dict@plt>

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

LLVM IR (-O2):
define i8* @generate_dict_random(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = tail call i8* @random_dict(i8* %0, i64 %1, i8* %2, i64 %3)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
int main() {
  getchar();
  printf("main...\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [8 x i8] c"main...\00"
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void XtCvtStringToAcceleratorTable() {}


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

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

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

LLVM IR (-O2):
define void @XtCvtStringToAcceleratorTable() {
ret void
}
/* Variables and functions */
int spidev_msg(int, char *, int /*<<< orphan*/, size_t);
int spi_write(int fd, char *buf, size_t len) {
  return spidev_msg(fd, buf, 0, len);
}


x86 assembly (clang, -O0):
<spi_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
xor    %edx,%edx
call   1030 <spidev_msg@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spi_write>:
mov    %rdx,%rcx
xor    %edx,%edx
jmp    1030 <spidev_msg@plt>

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

LLVM IR (-O2):
define i32 @spi_write(i32 %0, i8* %1, i64 %2) {
%4 = tail call i32 @spidev_msg(i32 %0, i8* %1, i32 0, i64 %2)
ret i32 %4
}
int my_strlen(char *s) {
  int i = 0;
  while (s[i] != 0)
    i++;
  return i;
}


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

x86 assembly (clang, -O2):
<my_strlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <my_strlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @my_strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ port_disable();
void chSysDisable(void) {
  port_disable();
  ;
}


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

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

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

LLVM IR (-O2):
define void @chSysDisable() {
%1 = tail call i32 (...) @port_disable()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Inst_Printf(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ Off_Reg_Bank(int);
void Move_From_Reg_X(int index) {
  Inst_Printf("movl", "%s,%%eax", Off_Reg_Bank(index * 4));
}


x86 assembly (clang, -O0):
<Move_From_Reg_X>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
shl    $0x2,%edi
call   1040 <Off_Reg_Bank@plt>
mov    %eax,%edx
lea    0xec1(%rip),%rdi
lea    0xebf(%rip),%rsi
call   1030 <Inst_Printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Move_From_Reg_X>:
push   %rax
shl    $0x2,%edi
call   1040 <Off_Reg_Bank@plt>
lea    0xed0(%rip),%rdi
lea    0xece(%rip),%rsi
mov    %eax,%edx
pop    %rax
jmp    1030 <Inst_Printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"movl\00"
@.str.1 = [9 x i8] c"%s,%%eax\00"
define void @Move_From_Reg_X(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 4
%5 = call i32 @Off_Reg_Bank(i32 %4)
%6 = call i32 @Inst_Printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"movl\00"
@.str.1 = [9 x i8] c"%s,%%eax\00"
define void @Move_From_Reg_X(i32 %0) {
%2 = shl nsw i32 %0, 2
%3 = tail call i32 @Off_Reg_Bank(i32 %2)
%4 = tail call i32 @Inst_Printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret void
}
/* Variables and functions */
int get_current_century(int);
int get_next_century(int optional_current_year) {
  int current_century = get_current_century(optional_current_year);
  return current_century + 100;
}


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

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

LLVM IR (-O0):
define i32 @get_next_century(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @get_current_century(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 100
ret i32 %7
}

LLVM IR (-O2):
define i32 @get_next_century(i32 %0) {
%2 = tail call i32 @get_current_century(i32 %0)
%3 = add nsw i32 %2, 100
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void func4(void) { printf("Hello from func4.c\n"); }


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

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

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

LLVM IR (-O2):
@str = [19 x i8] c"Hello from func4.c\00"
define void @func4() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void f4(int x) { printf("%d\n", x); }


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define void @f4(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @f4(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Type definitions */
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
int riva128_mmio_read(int, void *);
uint16_t riva128_mmio_read_w(uint32_t addr, void *p) {
  addr &= 0xffffff;
  return (riva128_mmio_read(addr + 0, p) << 0) |
         (riva128_mmio_read(addr + 1, p) << 8);
}


x86 assembly (clang, -O0):
<riva128_mmio_read_w>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
add    $0x0,%edi
mov    -0x10(%rbp),%rsi
call   1030 <riva128_mmio_read@plt>
shl    $0x0,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    -0x10(%rbp),%rsi
call   1030 <riva128_mmio_read@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
shl    $0x8,%ecx
or     %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<riva128_mmio_read_w>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
and    $0xffffff,%ebp
mov    %ebp,%edi
call   1030 <riva128_mmio_read@plt>
mov    %eax,%r14d
add    $0x1,%ebp
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <riva128_mmio_read@plt>
shl    $0x8,%eax
or     %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @riva128_mmio_read_w(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = and i32 %5, 16777215
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 0
%9 = load i8*, i8** %4
%10 = call i32 @riva128_mmio_read(i32 %8, i8* %9)
%11 = shl i32 %10, 0
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
%14 = load i8*, i8** %4
%15 = call i32 @riva128_mmio_read(i32 %13, i8* %14)
%16 = shl i32 %15, 8
%17 = or i32 %11, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @riva128_mmio_read_w(i32 %0, i8* %1) {
%3 = and i32 %0, 16777215
%4 = tail call i32 @riva128_mmio_read(i32 %3, i8* %1)
%5 = add nuw nsw i32 %3, 1
%6 = tail call i32 @riva128_mmio_read(i32 %5, i8* %1)
%7 = shl i32 %6, 8
%8 = or i32 %7, %4
ret i32 %8
}
/* Variables and functions */
int getpid();
int /*<<< orphan*/ printf(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ pthread_self();
void *thread_start(void *arg) {
  printf("thread_start pid %d thread_id %lx\n", getpid(), pthread_self());
  return NULL;
}


x86 assembly (clang, -O0):
<thread_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1050 <pthread_self@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xea7(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread_start>:
push   %rbx
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <pthread_self@plt>
lea    0xeb8(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"thread_start pid %d thread_id %lx\0A\00"
define i8* @thread_start(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @getpid()
%4 = call i32 (...) @pthread_self()
%5 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
ret i8* null
}

LLVM IR (-O2):
@.str = [35 x i8] c"thread_start pid %d thread_id %lx\0A\00"
define noalias i8* @thread_start(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 (...) @pthread_self()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3)
ret i8* null
}
/* Variables and functions */
int strcmp(char *, char *);
int fileSort(const void *e1, const void *e2) {
  return strcmp(*(char **)e1, *(char **)e2);
}


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

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

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

LLVM IR (-O2):
define i32 @fileSort(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(1) %6)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *, int, char *);
int /*<<< orphan*/ printfail();
void ffail(char *file, int line, char *msg) {
  printfail();
  printf("%s:%d: %s\n", file, line, msg);
  exit(1);
}


x86 assembly (clang, -O0):
<ffail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1040 <printfail@plt>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<ffail>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <printfail@plt>
lea    0xeb6(%rip),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %r14,%rcx
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"%s:%d: %s\0A\00"
define void @ffail(i8* %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 = call i32 (...) @printfail()
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = load i8*, i8** %6
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %8, i32 %9, i8* %10)
%12 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [11 x i8] c"%s:%d: %s\0A\00"
define void @ffail(i8* %0, i32 %1, i8* %2) {
%4 = tail call i32 (...) @printfail()
%5 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i8* %2)
%6 = tail call i32 @exit(i32 1)
unreachable
}