xunge/DecIR huggingface dataset:
/* Type definitions */
struct sockaddr {
  int dummy;
};

/* Variables and functions */
int accept(int, struct sockaddr *, unsigned int *);
int Xaccept(int s, struct sockaddr *a, int *l) {
  unsigned int rl;
  int code;
  rl = *l;
  code = accept(s, a, &rl);
  *l = rl;
  return code;
}


x86 assembly (clang, -O0):
<Xaccept>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1030 <accept@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Xaccept>:
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
mov    (%rdx),%eax
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdx
call   1030 <accept@plt>
mov    0xc(%rsp),%ecx
mov    %ecx,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
define i32 @Xaccept(i32 %0, %struct.sockaddr* %1, i32* %2) {
%4 = alloca i32
%5 = alloca %struct.sockaddr*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store %struct.sockaddr* %1, %struct.sockaddr** %5
store i32* %2, i32** %6
%9 = load i32*, i32** %6
%10 = load i32, i32* %9
store i32 %10, i32* %7
%11 = load i32, i32* %4
%12 = load %struct.sockaddr*, %struct.sockaddr** %5
%13 = call i32 @accept(i32 %11, %struct.sockaddr* %12, i32* %7)
store i32 %13, i32* %8
%14 = load i32, i32* %7
%15 = load i32*, i32** %6
store i32 %14, i32* %15
%16 = load i32, i32* %8
ret i32 %16
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
define i32 @Xaccept(i32 %0, %struct.sockaddr* %1, i32* nocapture %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = load i32, i32* %2
store i32 %6, i32* %4
%7 = call i32 @accept(i32 %0, %struct.sockaddr* %1, i32* %4)
%8 = load i32, i32* %4
store i32 %8, i32* %2
ret i32 %7
}
void inNsr2inNsrUnit_inNsr() {}


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

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

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

LLVM IR (-O2):
define void @inNsr2inNsrUnit_inNsr() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sti();
void irq_enable(void) { sti(); }


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

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

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

LLVM IR (-O2):
define void @irq_enable() {
%1 = tail call i32 (...) @sti()
ret void
}
void proc37() {}


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

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

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

LLVM IR (-O2):
define void @proc37() {
ret void
}
/* Variables and functions */
float rand_uniform();
float rand_uniform_clamped() { return rand_uniform() * 2.0f - 1.0f; }


x86 assembly (clang, -O0):
<rand_uniform_clamped>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand_uniform@plt>
addss  %xmm0,%xmm0
movss  0xed9(%rip),%xmm1
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_uniform_clamped>:
push   %rax
xor    %eax,%eax
call   1030 <rand_uniform@plt>
addss  %xmm0,%xmm0
addss  0xedc(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @rand_uniform_clamped() {
%1 = call float (...) @rand_uniform()
%2 = call float @llvm.fmuladd.f32(float %1, float 2.000000e+00, float -1.000000e+00)
ret float %2
}

LLVM IR (-O2):
define float @rand_uniform_clamped() {
%1 = tail call float (...) @rand_uniform()
%2 = tail call float @llvm.fmuladd.f32(float %1, float 2.000000e+00, float -1.000000e+00)
ret float %2
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
scalar_t__ stat(char const *, struct stat *);
bool file_exists(const char *path) {
  struct stat s;
  return stat(path, &s) == 0;
}


x86 assembly (clang, -O0):
<file_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_exists>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @file_exists(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @stat(i8* %4, %struct.stat* %3)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @file_exists(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
char *XSetLocaleModifiers() {}


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

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

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

LLVM IR (-O2):
define noalias i8* @XSetLocaleModifiers() {
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isodigit(int);
void t_isodigit_0x0f() {
  Assert_real((isodigit(15) == 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",
              80, ("isodigit should be 0 for 0x0f"));
}


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

x86 assembly (clang, -O2):
<t_isodigit_0x0f>:
push   %rax
mov    $0xf,%edi
call   1040 <isodigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x50,%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 0x0f\00"
define void @t_isodigit_0x0f() {
%1 = call i64 @isodigit(i32 15)
%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 80, 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 0x0f\00"
define void @t_isodigit_0x0f() {
%1 = tail call i64 @isodigit(i32 15)
%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 80, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
float dot(float x1, float y1, float x2, float y2) {
  return (x1 * x2 + y1 * y2);
}


x86 assembly (clang, -O0):
<dot>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
mulss  -0x10(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dot>:
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @dot(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %5
%10 = load float, float* %7
%11 = load float, float* %6
%12 = load float, float* %8
%13 = fmul float %11, %12
%14 = call float @llvm.fmuladd.f32(float %9, float %10, float %13)
ret float %14
}

LLVM IR (-O2):
define float @dot(float %0, float %1, float %2, float %3) {
%5 = fmul float %1, %3
%6 = tail call float @llvm.fmuladd.f32(float %0, float %2, float %5)
ret float %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void PrintSubTitles(char Title[50]) {
  printf("------------------------------------------------ %s "
         "------------------------------------------------\n",
         Title);
}


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

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

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

LLVM IR (-O2):
@.str = [102 x i8] c"------------------------------------------------ %s ------------------------------------------------\0A\00"
define void @PrintSubTitles(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
void __declfirstattr(void) {}


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

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

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

LLVM IR (-O2):
define void @__declfirstattr() {
ret void
}
/* Variables and functions */
char *get_standard_path(char *, char const *, char const *, char const *);
char *get_log_path(char *path, const char *name) {
  static const char *dir = "/var/log";
  static const char *ext = "log";
  return get_standard_path(path, dir, ext, name);
}


x86 assembly (clang, -O0):
<get_log_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2efd(%rip),%rsi
mov    0x2efe(%rip),%rdx
mov    -0x10(%rbp),%rcx
call   1030 <get_standard_path@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_log_path>:
mov    %rsi,%rcx
lea    0xee6(%rip),%rsi
lea    0xee4(%rip),%rdx
jmp    1030 <get_standard_path@plt>

LLVM IR (-O0):
@get_log_path.dir = internal global i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0)
@.str = [9 x i8] c"/var/log\00"
@get_log_path.ext = internal global i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0)
@.str.1 = [4 x i8] c"log\00"
define i8* @get_log_path(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** @get_log_path.dir
%7 = load i8*, i8** @get_log_path.ext
%8 = load i8*, i8** %4
%9 = call i8* @get_standard_path(i8* %5, i8* %6, i8* %7, i8* %8)
ret i8* %9
}

LLVM IR (-O2):
@.str = [9 x i8] c"/var/log\00"
@.str.1 = [4 x i8] c"log\00"
define i8* @get_log_path(i8* %0, i8* %1) {
%3 = tail call i8* @get_standard_path(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %1)
ret i8* %3
}
/* Variables and functions */
scalar_t__ strcmp(char *, char *);
bool eqstr(char *a, char *b) {
  if (strcmp(a, b) == 0)
    return true;
  return false;
}


x86 assembly (clang, -O0):
<eqstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1143 <eqstr+0x33>
movl   $0x1,-0x4(%rbp)
jmp    114a <eqstr+0x3a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eqstr>:
push   %rax
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @eqstr(i8* %0, i8* %1) {
%3 = tail call i64 @strcmp(i8* %0, i8* %1)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
void free(void *p __attribute__((__unused__))) {}


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

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

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

LLVM IR (-O2):
define void @free(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dpush(int);
int /*<<< orphan*/ from_char_string(char const *);
int tag_object(int /*<<< orphan*/);
void box_char_string(const char *str) {
  dpush(str ? tag_object(from_char_string(str)) : 7);
}


x86 assembly (clang, -O0):
<box_char_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     115f <box_char_string+0x2f>
mov    -0x8(%rbp),%rdi
call   1050 <from_char_string@plt>
mov    %eax,%edi
call   1030 <tag_object@plt>
mov    %eax,-0xc(%rbp)
jmp    116c <box_char_string+0x3c>
mov    $0x7,%eax
mov    %eax,-0xc(%rbp)
jmp    116c <box_char_string+0x3c>
mov    -0xc(%rbp),%edi
call   1040 <dpush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<box_char_string>:
test   %rdi,%rdi
je     114d <box_char_string+0x1d>
push   %rax
call   1050 <from_char_string@plt>
mov    %eax,%edi
call   1030 <tag_object@plt>
mov    %eax,%edi
add    $0x8,%rsp
jmp    1040 <dpush@plt>
mov    $0x7,%edi
jmp    1040 <dpush@plt>

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

LLVM IR (-O2):
define void @box_char_string(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @from_char_string(i8* %0)
%5 = tail call i32 @tag_object(i32 %4)
br label %6
6: ; preds = %1, %3
%7 = phi i32 [ %5, %3 ], [ 7, %1 ]
%8 = tail call i32 @dpush(i32 %7)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ __m64;

/* Variables and functions */
int /*<<< orphan*/ _mm_add_pi32(int /*<<< orphan*/, int /*<<< orphan*/);
__m64 test_mm_add_pi32(__m64 a, __m64 b) { return _mm_add_pi32(a, b); }


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

x86 assembly (clang, -O2):
<test_mm_add_pi32>:
jmp    1030 <_mm_add_pi32@plt>

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

LLVM IR (-O2):
define i32 @test_mm_add_pi32(i32 %0, i32 %1) {
%3 = tail call i32 @_mm_add_pi32(i32 %0, i32 %1)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ copro_opc7_write_mem(int /*<<< orphan*/, int /*<<< orphan*/);
void dbg_memwrite(uint32_t addr, uint32_t value) {
  copro_opc7_write_mem(addr, value);
}


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

x86 assembly (clang, -O2):
<dbg_memwrite>:
jmp    1030 <copro_opc7_write_mem@plt>

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

LLVM IR (-O2):
define void @dbg_memwrite(i32 %0, i32 %1) {
%3 = tail call i32 @copro_opc7_write_mem(i32 %0, i32 %1)
ret void
}
int unorddf2(double x, double y) { return (x != x) || (y != y); }


x86 assembly (clang, -O0):
<unorddf2>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x1,%al
ucomisd -0x8(%rbp),%xmm0
mov    %al,-0x11(%rbp)
jne    113e <unorddf2+0x3e>
jp     113e <unorddf2+0x3e>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
setne  %al
setp   %cl
or     %cl,%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unorddf2>:
xor    %eax,%eax
ucomisd %xmm1,%xmm0
setp   %al
ret

LLVM IR (-O0):
define i32 @unorddf2(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* %3
%7 = fcmp une double %5, %6
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = load double, double* %4
%10 = load double, double* %4
%11 = fcmp une double %9, %10
br label %12
12: ; preds = %8, %2
%13 = phi i1 [ true, %2 ], [ %11, %8 ]
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @unorddf2(double %0, double %1) {
%3 = fcmp uno double %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int atoi(char const *);
int crStrToInt(const char *str) {
  if (!str)
    return 0;
  return atoi(str);
}


x86 assembly (clang, -O0):
<crStrToInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <crStrToInt+0x23>
movl   $0x0,-0x4(%rbp)
jmp    113f <crStrToInt+0x2f>
mov    -0x10(%rbp),%rdi
call   1030 <atoi@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @crStrToInt(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @atoi(i8* %0)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ %4, %3 ], [ 0, %1 ]
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int romanToInt(char *);
int main() {
  printf("%d\n", romanToInt("DCXXI"));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [6 x i8] c"DCXXI\00"
define i32 @main() {
%1 = tail call i32 @romanToInt(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
int is_long_option(const char *arg) { return arg[1] == '-'; }


x86 assembly (clang, -O0):
<is_long_option>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2d,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_long_option>:
xor    %eax,%eax
cmpb   $0x2d,0x1(%rdi)
sete   %al
ret

LLVM IR (-O0):
define i32 @is_long_option(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 45
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @is_long_option(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, 45
%5 = zext i1 %4 to i32
ret i32 %5
}
extern void block_daemon(void) {
  int block;
  block = 1;
  while (block == 1) {
    info("%s: attachme, attachme...", __func__);
    sleep(2);
  }
}


x86 assembly (clang, -O0):
<block_daemon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    115f <block_daemon+0x3f>
lea    0xec0(%rip),%rdi
lea    0xed3(%rip),%rsi
mov    $0x0,%al
call   1040 <info@plt>
mov    $0x2,%edi
mov    $0x0,%al
call   1030 <sleep@plt>
jmp    112f <block_daemon+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<block_daemon>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%r14
lea    0xee8(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <info@plt>
mov    $0x2,%edi
xor    %eax,%eax
call   1030 <sleep@plt>
jmp    1140 <block_daemon+0x20>

LLVM IR (-O0):
@.str = [26 x i8] c"%s: attachme, attachme...\00"
@__func__.block_daemon = [13 x i8] c"block_daemon\00"
define void @block_daemon() {
%1 = alloca i32
store i32 1, i32* %1
br label %2
2: ; preds = %5, %0
%3 = load i32, i32* %1
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @info to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @__func__.block_daemon, i64 0, i64 0))
%7 = call i32 (i32, ...) bitcast (i32 (...)* @sleep to i32 (i32, ...)*)(i32 2)
br label %2
8: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"%s: attachme, attachme...\00"
@__func__.block_daemon = [13 x i8] c"block_daemon\00"
define void @block_daemon() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @info to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @__func__.block_daemon, i64 0, i64 0))
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @sleep to i32 (i32, ...)*)(i32 2)
br label %1
}
/* Type definitions */
struct VariableShare {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ error(char *);
int Resize_VariableDatabase(struct VariableShare *vsh, unsigned int newsize) {
  error("The Variable Share Object has run out of space and there is no code "
        "implemented for resizing it (yet) !");
  return 0;
}


x86 assembly (clang, -O0):
<Resize_VariableDatabase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <error@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.VariableShare = type { i32 }
@.str = [104 x i8] c"The Variable Share Object has run out of space and there is no code implemented for resizing it (yet) !\00"
define i32 @Resize_VariableDatabase(%struct.VariableShare* %0, i32 %1) {
%3 = alloca %struct.VariableShare*
%4 = alloca i32
store %struct.VariableShare* %0, %struct.VariableShare** %3
store i32 %1, i32* %4
%5 = call i32 @error(i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.VariableShare = type { i32 }
@.str = [104 x i8] c"The Variable Share Object has run out of space and there is no code implemented for resizing it (yet) !\00"
define i32 @Resize_VariableDatabase(%struct.VariableShare* nocapture readnone %0, i32 %1) {
%3 = tail call i32 @error(i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_table_header(void) {
  printf(" <form method=\"get\" action=\"\">\n"
         "  <table>\n"
         "   <thead>\n"
         "    <tr>\n"
         "     <th>Purchase?</th>\n"
         "     <th>Description</th>\n"
         "     <th>Qty</th>\n"
         "   </thead>\n"
         "   <tbody>\n");
}


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

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

LLVM IR (-O0):
@.str = [153 x i8] c" <form method=\22get\22 action=\22\22>\0A <table>\0A <thead>\0A <tr>\0A <th>Purchase?</th>\0A <th>Description</th>\0A <th>Qty</th>\0A </thead>\0A <tbody>\0A\00"
define void @print_table_header() {
%1 = call i32 @printf(i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [152 x i8] c" <form method=\22get\22 action=\22\22>\0A <table>\0A <thead>\0A <tr>\0A <th>Purchase?</th>\0A <th>Description</th>\0A <th>Qty</th>\0A </thead>\0A <tbody>\00"
define void @print_table_header() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([152 x i8], [152 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CompileMark(int, int);
void DoDo(void) { CompileMark(55, 3); }


x86 assembly (clang, -O0):
<DoDo>:
push   %rbp
mov    %rsp,%rbp
mov    $0x37,%edi
mov    $0x3,%esi
call   1030 <CompileMark@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<DoDo>:
mov    $0x37,%edi
mov    $0x3,%esi
jmp    1030 <CompileMark@plt>

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

LLVM IR (-O2):
define void @DoDo() {
%1 = tail call i32 @CompileMark(i32 55, i32 3)
ret void
}
/* Variables and functions */
scalar_t__ memcmp(char *, char *, int);
char s_eq_sudoku(char *s1, char *s2) { return memcmp(s1, s2, 81) == 0; }


x86 assembly (clang, -O0):
<s_eq_sudoku>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x51,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_eq_sudoku>:
push   %rax
mov    $0x51,%edx
call   1030 <memcmp@plt>
test   %rax,%rax
sete   %al
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @s_eq_sudoku(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i64 @memcmp(i8* %5, i8* %6, i32 81)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
%10 = trunc i32 %9 to i8
ret i8 %10
}

LLVM IR (-O2):
define signext i8 @s_eq_sudoku(i8* %0, i8* %1) {
%3 = tail call i64 @memcmp(i8* %0, i8* %1, i32 81)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i8
ret i8 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ htonl(scalar_t__);
scalar_t__ ntohl(int /*<<< orphan*/);
void _SUBTRACT_FROM_FIELD_UINT32(uint8_t *dst_ptr, uint8_t *src_ptr,
                                 int src_len) {
  *(uint32_t *)dst_ptr =
      htonl(ntohl(*(uint32_t *)dst_ptr) -
            ntohl(*(uint32_t *)(src_ptr + src_len - sizeof(uint32_t))));
}


x86 assembly (clang, -O0):
<_SUBTRACT_FROM_FIELD_UINT32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1040 <ntohl@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    -0x10(%rax,%rcx,4),%edi
call   1040 <ntohl@plt>
mov    -0x20(%rbp),%rdi
sub    %rax,%rdi
call   1030 <htonl@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_SUBTRACT_FROM_FIELD_UINT32>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%edi
call   1040 <ntohl@plt>
mov    %rax,%rbp
movslq %r15d,%rax
mov    -0x10(%r14,%rax,4),%edi
call   1040 <ntohl@plt>
sub    %rax,%rbp
mov    %rbp,%rdi
call   1030 <htonl@plt>
mov    %eax,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @_SUBTRACT_FROM_FIELD_UINT32(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* %7
%9 = call i64 @ntohl(i32 %8)
%10 = load i32*, i32** %5
%11 = load i32, i32* %6
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %10, i64 %12
%14 = getelementptr inbounds i32, i32* %13, i64 -4
%15 = load i32, i32* %14
%16 = call i64 @ntohl(i32 %15)
%17 = sub nsw i64 %9, %16
%18 = call i32 @htonl(i64 %17)
%19 = load i32*, i32** %4
store i32 %18, i32* %19
ret void
}

LLVM IR (-O2):
define void @_SUBTRACT_FROM_FIELD_UINT32(i32* nocapture %0, i32* nocapture %1, i32 %2) {
%4 = load i32, i32* %0
%5 = tail call i64 @ntohl(i32 %4)
%6 = sext i32 %2 to i64
%7 = getelementptr inbounds i32, i32* %1, i64 %6
%8 = getelementptr inbounds i32, i32* %7, i64 -4
%9 = load i32, i32* %8
%10 = tail call i64 @ntohl(i32 %9)
%11 = sub nsw i64 %5, %10
%12 = tail call i32 @htonl(i64 %11)
store i32 %12, i32* %0
ret void
}
void f(void) {
  int a[100], b[100];
#pragma hlt distribute
  for (int i = 0; i < 100; i++) {
    a[i] = i * 1;
    b[i] = 0;
  }
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2b0,%rsp
movl   $0x0,-0x324(%rbp)
cmpl   $0x64,-0x324(%rbp)
jge    115f <f+0x5f>
mov    -0x324(%rbp),%ecx
shl    $0x0,%ecx
movslq -0x324(%rbp),%rax
mov    %ecx,-0x190(%rbp,%rax,4)
movslq -0x324(%rbp),%rax
movl   $0x0,-0x320(%rbp,%rax,4)
mov    -0x324(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x324(%rbp)
jmp    1115 <f+0x15>
add    $0x2b0,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f() {
%1 = alloca [100 x i32]
%2 = alloca [100 x i32]
%3 = alloca i32
store i32 0, i32* %3
br label %4
4: ; preds = %16, %0
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 100
br i1 %6, label %7, label %19
7: ; preds = %4
%8 = load i32, i32* %3
%9 = mul nsw i32 %8, 1
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %11
store i32 %9, i32* %12
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %14
store i32 0, i32* %15
br label %16
16: ; preds = %7
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %4
19: ; preds = %4
ret void
}

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

/* Variables and functions */
scalar_t__ generic_ptr(int, int);
struct string *string_ptr(int number) {
  return ((struct string *)generic_ptr(47, number));
}


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

x86 assembly (clang, -O2):
<string_ptr>:
mov    %edi,%esi
mov    $0x2f,%edi
jmp    1030 <generic_ptr@plt>

LLVM IR (-O0):
%struct.string = type { i32 }
define %struct.string* @string_ptr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @generic_ptr(i32 47, i32 %3)
%5 = inttoptr i64 %4 to %struct.string*
ret %struct.string* %5
}

LLVM IR (-O2):
%struct.string = type { i32 }
define %struct.string* @string_ptr(i32 %0) {
%2 = tail call i64 @generic_ptr(i32 47, i32 %0)
%3 = inttoptr i64 %2 to %struct.string*
ret %struct.string* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
void m206initPPUSet8(uint16_t addr) { (void)addr; }


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

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

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

LLVM IR (-O2):
define void @m206initPPUSet8(i32 %0) {
ret void
}
int fn21(int i) {
  static const char g[10] = "abcdefghij";
  return g[i];
}


x86 assembly (clang, -O0):
<fn21>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rcx
lea    0xeee(%rip),%rax
movsbl (%rax,%rcx,1),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn21>:
movslq %edi,%rax
lea    0xef6(%rip),%rcx
movsbl (%rax,%rcx,1),%eax
ret

LLVM IR (-O0):
@fn21.g = internal constant [10 x i8] c"abcdefghij"
define i32 @fn21(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds [10 x i8], [10 x i8]* @fn21.g, i64 0, i64 %4
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
@fn21.g = internal unnamed_addr constant [10 x i8] c"abcdefghij"
define i32 @fn21(i32 %0) {
%2 = sext i32 %0 to i64
%3 = getelementptr inbounds [10 x i8], [10 x i8]* @fn21.g, i64 0, i64 %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
ret i32 %5
}
int max_strlen(const char *str, int maxlen) {
  int i = 0;
  while (str[i] != '\0')
    if (i == maxlen)
      break;
    else
      i += 1;
  return i;
}


x86 assembly (clang, -O0):
<max_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1146 <max_strlen+0x46>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1138 <max_strlen+0x38>
jmp    1146 <max_strlen+0x46>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <max_strlen+0x12>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max_strlen>:
mov    %esi,%ecx
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0x1(%rdx),%rax
cmpb   $0x0,(%rdi,%rdx,1)
je     1122 <max_strlen+0x22>
cmp    %rdx,%rcx
mov    %rax,%rdx
jne    1110 <max_strlen+0x10>
add    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @max_strlen(i8* nocapture %0, i32 %1) {
%3 = zext i32 %1 to i64
br label %4
4: ; preds = %4, %2
%5 = phi i64 [ %11, %4 ], [ 0, %2 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
%9 = icmp eq i64 %5, %3
%10 = select i1 %8, i1 true, i1 %9
%11 = add nuw nsw i64 %5, 1
br i1 %10, label %12, label %4
12: ; preds = %4
%13 = trunc i64 %5 to i32
ret i32 %13
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
int load_le32(const char *c) {
  const uint8_t *d = (const uint8_t *)c;
  uint32_t x = d[0] | (d[1] << 8) | (d[2] << 16) | (d[3] << 24);
  return (int)x;
}


x86 assembly (clang, -O0):
<load_le32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x8(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0xc(%rcx),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_le32>:
mov    0x4(%rdi),%ecx
mov    0x8(%rdi),%edx
shl    $0x8,%ecx
or     (%rdi),%ecx
shl    $0x10,%edx
mov    0xc(%rdi),%eax
shl    $0x18,%eax
or     %edx,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @load_le32(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = bitcast i8* %5 to i32*
store i32* %6, i32** %3
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 0
%9 = load i32, i32* %8
%10 = load i32*, i32** %3
%11 = getelementptr inbounds i32, i32* %10, i64 1
%12 = load i32, i32* %11
%13 = shl i32 %12, 8
%14 = or i32 %9, %13
%15 = load i32*, i32** %3
%16 = getelementptr inbounds i32, i32* %15, i64 2
%17 = load i32, i32* %16
%18 = shl i32 %17, 16
%19 = or i32 %14, %18
%20 = load i32*, i32** %3
%21 = getelementptr inbounds i32, i32* %20, i64 3
%22 = load i32, i32* %21
%23 = shl i32 %22, 24
%24 = or i32 %19, %23
store i32 %24, i32* %4
%25 = load i32, i32* %4
ret i32 %25
}

LLVM IR (-O2):
define i32 @load_le32(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = getelementptr inbounds i8, i8* %0, i64 4
%5 = bitcast i8* %4 to i32*
%6 = load i32, i32* %5
%7 = shl i32 %6, 8
%8 = or i32 %7, %3
%9 = getelementptr inbounds i8, i8* %0, i64 8
%10 = bitcast i8* %9 to i32*
%11 = load i32, i32* %10
%12 = shl i32 %11, 16
%13 = or i32 %8, %12
%14 = getelementptr inbounds i8, i8* %0, i64 12
%15 = bitcast i8* %14 to i32*
%16 = load i32, i32* %15
%17 = shl i32 %16, 24
%18 = or i32 %13, %17
ret i32 %18
}
/* Type definitions */
typedef int /*<<< orphan*/ u_char;

/* Variables and functions */
int /*<<< orphan*/ HuffInit();
int /*<<< orphan*/ printf(char *);
int sudp_init(u_char *data) {
  printf("- PLUGIN: Zdaemon huffman\n");
  if (data && !data[0]) {
    printf("- no plugin's options\n");
    return (1);
  }
  HuffInit();
  return (0);
}


x86 assembly (clang, -O0):
<sudp_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
cmpq   $0x0,-0x10(%rbp)
je     1168 <sudp_init+0x48>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1168 <sudp_init+0x48>
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1176 <sudp_init+0x56>
mov    $0x0,%al
call   1040 <HuffInit@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sudp_init>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
test   %rbx,%rbx
je     113a <sudp_init+0x1a>
cmpl   $0x0,(%rbx)
je     1145 <sudp_init+0x25>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <HuffInit@plt>
jmp    1156 <sudp_init+0x36>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"- PLUGIN: Zdaemon huffman\0A\00"
@.str.1 = [23 x i8] c"- no plugin's options\0A\00"
define i32 @sudp_init(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%5 = load i32*, i32** %3
%6 = icmp ne i32* %5, null
br i1 %6, label %7, label %14
7: ; preds = %1
%8 = load i32*, i32** %3
%9 = getelementptr inbounds i32, i32* %8, i64 0
%10 = load i32, i32* %9
%11 = icmp ne i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %7
%13 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %2
br label %16
14: ; preds = %7, %1
%15 = call i32 (...) @HuffInit()
store i32 0, i32* %2
br label %16
16: ; preds = %14, %12
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
@str = [26 x i8] c"- PLUGIN: Zdaemon huffman\00"
@str.2 = [22 x i8] c"- no plugin's options\00"
define i32 @sudp_init(i32* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%3 = icmp eq i32* %0, null
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = load i32, i32* %0
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.2, i64 0, i64 0))
br label %11
9: ; preds = %4, %1
%10 = tail call i32 (...) @HuffInit()
br label %11
11: ; preds = %9, %7
%12 = phi i32 [ 0, %9 ], [ 1, %7 ]
ret i32 %12
}
void foo(void (*f)(int *), int *p) { f(p); }


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

x86 assembly (clang, -O2):
<foo>:
mov    %rdi,%rax
mov    %rsi,%rdi
jmp    *%rax

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

LLVM IR (-O2):
define void @foo(void (i32*)* nocapture %0, i32* %1) {
tail call void %0(i32* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void vcl_stuff() { printf("Placeholder for a file with strange name\n"); }


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

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

LLVM IR (-O0):
@.str = [42 x i8] c"Placeholder for a file with strange name\0A\00"
define void @vcl_stuff() {
%1 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [41 x i8] c"Placeholder for a file with strange name\00"
define void @vcl_stuff() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
ret void
}
void prefetch_for_write(const void *addr) { __builtin_prefetch(addr, 1, 3); }


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

x86 assembly (clang, -O2):
<prefetch_for_write>:
prefetcht0 (%rdi)
ret

LLVM IR (-O0):
define void @prefetch_for_write(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
define void @prefetch_for_write(i8* nocapture %0) {
tail call void @llvm.prefetch.p0i8(i8* %0, i32 1, i32 3, i32 1)
ret void
}
void INT_Excep_RIIC1_EEI1(void) {}


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

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

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

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

/* Variables and functions */
int mode_version_katcp(struct katcp_dispatch *, int /*<<< orphan*/, char *, int,
                       int);
int version_katcp(struct katcp_dispatch *d, char *subsystem, int major,
                  int minor) {
  return mode_version_katcp(d, 0, subsystem, major, minor);
}


x86 assembly (clang, -O0):
<version_katcp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
xor    %esi,%esi
call   1030 <mode_version_katcp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<version_katcp>:
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %rsi,%rdx
xor    %esi,%esi
jmp    1030 <mode_version_katcp@plt>

LLVM IR (-O0):
%struct.katcp_dispatch = type { i32 }
define i32 @version_katcp(%struct.katcp_dispatch* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca %struct.katcp_dispatch*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store %struct.katcp_dispatch* %0, %struct.katcp_dispatch** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load %struct.katcp_dispatch*, %struct.katcp_dispatch** %5
%10 = load i8*, i8** %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @mode_version_katcp(%struct.katcp_dispatch* %9, i32 0, i8* %10, i32 %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
%struct.katcp_dispatch = type { i32 }
define i32 @version_katcp(%struct.katcp_dispatch* %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i32 @mode_version_katcp(%struct.katcp_dispatch* %0, i32 0, i8* %1, i32 %2, i32 %3)
ret i32 %5
}
int do_558() { return 558; }


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

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

LLVM IR (-O0):
define i32 @do_558() {
ret i32 558
}

LLVM IR (-O2):
define i32 @do_558() {
ret i32 558
}
/* Variables and functions */
int /*<<< orphan*/ e_absy();
int /*<<< orphan*/ e_ldx();
void e_ldx_absy() {
  e_absy();
  e_ldx();
}


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

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

LLVM IR (-O0):
define void @e_ldx_absy() {
%1 = call i32 (...) @e_absy()
%2 = call i32 (...) @e_ldx()
ret void
}

LLVM IR (-O2):
define void @e_ldx_absy() {
%1 = tail call i32 (...) @e_absy()
%2 = tail call i32 (...) @e_ldx()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bar();
int /*<<< orphan*/ foo(char const *);
int main(void) {
  const char *s = "Foo!";
  foo(s);
  bar();
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"Foo!\00"
define i32 @main() {
%1 = tail call i32 @foo(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @bar()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void utilFreeDeviceData(void *dptr) { free(dptr); }


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

x86 assembly (clang, -O2):
<utilFreeDeviceData>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @utilFreeDeviceData(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}