xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int strlen(char *);
int main(void) {
  int a = sizeof("wwww.baidu.com");
  int b = strlen("wwww.baidu.com");
  printf("%d, %d\n", a, b);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <strlen@plt>
lea    0xedb(%rip),%rdi
mov    $0xf,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [15 x i8] c"wwww.baidu.com\00"
@.str.1 = [8 x i8] c"%d, %d\0A\00"
define i32 @main() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 15, i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ set_message(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int menu() {
  char message[256];
  strcpy(message,
         "\n\nmenu : \n1.liste des referentiels\n2.contenu d'un "
         "referentiel\n3.telechargement d'un referentiel\n4.quitter\n");
  set_message(message);
  return 0;
}


x86 assembly (clang, -O0):
<menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
lea    -0x100(%rbp),%rdi
lea    0xec7(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x100(%rbp),%rdi
call   1040 <set_message@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu>:
push   %rbx
sub    $0x100,%rsp
lea    0xed1(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <set_message@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [107 x i8] c"\0A\0Amenu : \0A1.liste des referentiels\0A2.contenu d'un referentiel\0A3.telechargement d'un referentiel\0A4.quitter\0A\00"
define i32 @menu() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([107 x i8], [107 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%5 = call i32 @set_message(i8* %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [107 x i8] c"\0A\0Amenu : \0A1.liste des referentiels\0A2.contenu d'un referentiel\0A3.telechargement d'un referentiel\0A4.quitter\0A\00"
define i32 @menu() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([107 x i8], [107 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @set_message(i8* %2)
ret i32 0
}
void cxl_slbia(struct mm_struct *mm) {}


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

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

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

LLVM IR (-O2):
%struct.mm_struct = type opaque
define void @cxl_slbia(%struct.mm_struct* nocapture %0) {
ret void
}
void b(void) {}


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

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

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

LLVM IR (-O2):
define void @b() {
ret void
}
unsigned long djbhash(unsigned char *str) {
  unsigned long hash = 5381;
  int c;
  while ((c = *str++))
    hash = ((hash << 5) + hash) + c;
  return hash;
}


x86 assembly (clang, -O0):
<djbhash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x1505,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     114a <djbhash+0x4a>
mov    -0x10(%rbp),%rax
shl    $0x5,%rax
add    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <djbhash+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<djbhash>:
mov    (%rdi),%cl
test   %cl,%cl
je     112c <djbhash+0x2c>
add    $0x1,%rdi
mov    $0x1505,%eax
nop
mov    %rax,%rdx
shl    $0x5,%rdx
add    %rax,%rdx
movzbl %cl,%eax
add    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <djbhash+0x10>
ret
mov    $0x1505,%eax
ret

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

LLVM IR (-O2):
define i64 @djbhash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = phi i64 [ %11, %4 ], [ 5381, %1 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = mul i64 %7, 33
%10 = zext i8 %5 to i64
%11 = add i64 %9, %10
%12 = load i8, i8* %8
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i64 [ 5381, %1 ], [ %11, %4 ]
ret i64 %15
}
void init_pf_fold(int length) {}


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

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

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

LLVM IR (-O2):
define void @init_pf_fold(i32 %0) {
ret void
}
int range() { return 42; }


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

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

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

LLVM IR (-O2):
define i32 @range() {
ret i32 42
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ basename(char *);
int /*<<< orphan*/ errx(int /*<<< orphan*/, char *, int /*<<< orphan*/);
void syntax(char name[]) {
  errx(EXIT_FAILURE, "%s [-f format] [-w width] -d dbname -q query",
       basename(name));
}


x86 assembly (clang, -O0):
<syntax>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <basename@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%edx
lea    0xeb3(%rip),%rsi
call   1030 <errx@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<syntax>:
push   %rbx
mov    0x2eb8(%rip),%rax
mov    (%rax),%ebx
call   1040 <basename@plt>
lea    0xeca(%rip),%rsi
mov    %ebx,%edi
mov    %eax,%edx
pop    %rbx
jmp    1030 <errx@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [45 x i8] c"%s [-f format] [-w width] -d dbname -q query\00"
define void @syntax(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @EXIT_FAILURE
%4 = load i8*, i8** %2
%5 = call i32 @basename(i8* %4)
%6 = call i32 @errx(i32 %3, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %5)
ret void
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [45 x i8] c"%s [-f format] [-w width] -d dbname -q query\00"
define void @syntax(i8* %0) {
%2 = load i32, i32* @EXIT_FAILURE
%3 = tail call i32 @basename(i8* %0)
%4 = tail call i32 @errx(i32 %2, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}
/* Variables and functions */
double log(double);
double VAL2DB(double x) {
  if (x < 0.0000000298023223876953125)
    return -150.0;
  double v = log(x) * 8.6858896380650365530225783783321;
  return v < -150.0 ? -150.0 : v;
}


x86 assembly (clang, -O0):
<VAL2DB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  0xedb(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1142 <VAL2DB+0x32>
movsd  0xed0(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1196 <VAL2DB+0x86>
movsd  -0x10(%rbp),%xmm0
call   1030 <log@plt>
movsd  0xebc(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xea3(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1182 <VAL2DB+0x72>
movsd  0xe90(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    118c <VAL2DB+0x7c>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VAL2DB>:
push   %rax
movsd  0xeef(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1129 <VAL2DB+0x19>
movsd  0xed9(%rip),%xmm0
pop    %rax
ret
call   1030 <log@plt>
movapd %xmm0,%xmm1
mulsd  0xed6(%rip),%xmm1
movsd  0xebe(%rip),%xmm0
maxsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @VAL2DB(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %3
%5 = load double, double* %3
%6 = fcmp olt double %5, 0x3E60000000000000
br i1 %6, label %7, label %8
7: ; preds = %1
store double -1.500000e+02, double* %2
br label %19
8: ; preds = %1
%9 = load double, double* %3
%10 = call double @log(double %9)
%11 = fmul double %10, 0x40215F2CED384F29
store double %11, double* %4
%12 = load double, double* %4
%13 = fcmp olt double %12, -1.500000e+02
br i1 %13, label %14, label %15
14: ; preds = %8
br label %17
15: ; preds = %8
%16 = load double, double* %4
br label %17
17: ; preds = %15, %14
%18 = phi double [ -1.500000e+02, %14 ], [ %16, %15 ]
store double %18, double* %2
br label %19
19: ; preds = %17, %7
%20 = load double, double* %2
ret double %20
}

LLVM IR (-O2):
define double @VAL2DB(double %0) {
%2 = fcmp olt double %0, 0x3E60000000000000
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = tail call double @log(double %0)
%5 = fmul double %4, 0x40215F2CED384F29
%6 = fcmp olt double %5, -1.500000e+02
%7 = select i1 %6, double -1.500000e+02, double %5
br label %8
8: ; preds = %1, %3
%9 = phi double [ %7, %3 ], [ -1.500000e+02, %1 ]
ret double %9
}
void Vec4F_Copy(float *a, float *b) {
  b[0] = a[0];
  b[1] = a[1];
  b[2] = a[2];
  b[3] = a[3];
}


x86 assembly (clang, -O0):
<Vec4F_Copy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movss  0xc(%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Vec4F_Copy>:
movss  (%rdi),%xmm0
movss  %xmm0,(%rsi)
movss  0x4(%rdi),%xmm0
movss  %xmm0,0x4(%rsi)
movss  0x8(%rdi),%xmm0
movss  %xmm0,0x8(%rsi)
movss  0xc(%rdi),%xmm0
movss  %xmm0,0xc(%rsi)
ret

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

LLVM IR (-O2):
define void @Vec4F_Copy(float* nocapture %0, float* nocapture writeonly %1) {
%3 = load float, float* %0
store float %3, float* %1
%4 = getelementptr inbounds float, float* %0, i64 1
%5 = load float, float* %4
%6 = getelementptr inbounds float, float* %1, i64 1
store float %5, float* %6
%7 = getelementptr inbounds float, float* %0, i64 2
%8 = load float, float* %7
%9 = getelementptr inbounds float, float* %1, i64 2
store float %8, float* %9
%10 = getelementptr inbounds float, float* %0, i64 3
%11 = load float, float* %10
%12 = getelementptr inbounds float, float* %1, i64 3
store float %11, float* %12
ret void
}
/* Variables and functions */
int /*<<< orphan*/ hungarian();
int main() { hungarian(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @hungarian()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @hungarian()
ret i32 0
}
foo(char *filename, const char *modes) {}


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

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

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

LLVM IR (-O2):
define i32 @foo(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 undef
}
/* Variables and functions */
int a(int);
int b(int);
int func(int x) {
  int y = x * 11;
  int z = x * 17;
  if (y == 88)
    return a(z);
  else
    return b(z);
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
imul   $0xb,-0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
imul   $0x11,-0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x58,-0xc(%rbp)
jne    1153 <func+0x33>
mov    -0x10(%rbp),%edi
call   1040 <a@plt>
mov    %eax,-0x4(%rbp)
jmp    115e <func+0x3e>
mov    -0x10(%rbp),%edi
call   1030 <b@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func>:
mov    %edi,%eax
shl    $0x4,%edi
add    %eax,%edi
cmp    $0x8,%eax
jne    1131 <func+0x11>
jmp    1040 <a@plt>
jmp    1030 <b@plt>

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

LLVM IR (-O2):
define i32 @func(i32 %0) {
%2 = mul nsw i32 %0, 17
%3 = icmp eq i32 %0, 8
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @a(i32 %2)
br label %8
6: ; preds = %1
%7 = tail call i32 @b(i32 %2)
br label %8
8: ; preds = %6, %4
%9 = phi i32 [ %5, %4 ], [ %7, %6 ]
ret i32 %9
}
/* Variables and functions */
int genrand64_int64();
long long genrand64_int63(void) { return (long long)(genrand64_int64() >> 1); }


x86 assembly (clang, -O0):
<genrand64_int63>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <genrand64_int64@plt>
sar    $0x1,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<genrand64_int63>:
push   %rax
xor    %eax,%eax
call   1030 <genrand64_int64@plt>
sar    %eax
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i64 @genrand64_int63() {
%1 = call i32 (...) @genrand64_int64()
%2 = ashr i32 %1, 1
%3 = sext i32 %2 to i64
ret i64 %3
}

LLVM IR (-O2):
define i64 @genrand64_int63() {
%1 = tail call i32 (...) @genrand64_int64()
%2 = ashr i32 %1, 1
%3 = sext i32 %2 to i64
ret i64 %3
}
void reset(char *string, int size) {
  for (int i = 0; i < size; i++) {
    *(string + i) = 0;
  }
}


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

x86 assembly (clang, -O2):
<reset>:
test   %esi,%esi
jle    1122 <reset+0x12>
push   %rax
mov    %esi,%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define void @reset(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 = %15, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %18
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
store i8 0, i8* %14
br label %15
15: ; preds = %10
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 1
store i32 %17, i32* %5
br label %6
18: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @reset(i8* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %2
ret void
}
unsigned short RdFwVr(void) { return (0x0017); }


x86 assembly (clang, -O0):
<RdFwVr>:
push   %rbp
mov    %rsp,%rbp
mov    $0x17,%ax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<RdFwVr>:
mov    $0x17,%ax
ret

LLVM IR (-O0):
define zeroext i16 @RdFwVr() {
ret i16 23
}

LLVM IR (-O2):
define zeroext i16 @RdFwVr() {
ret i16 23
}
/* Variables and functions */
double transverse_distance(double);
double luminosity_distance(double z) {
  return ((1.0 + z) * transverse_distance(z));
}


x86 assembly (clang, -O0):
<luminosity_distance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xedb(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <transverse_distance@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<luminosity_distance>:
push   %rax
movsd  0xee7(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
call   1030 <transverse_distance@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @luminosity_distance(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fadd double 1.000000e+00, %3
%5 = load double, double* %2
%6 = call double @transverse_distance(double %5)
%7 = fmul double %4, %6
ret double %7
}

LLVM IR (-O2):
define double @luminosity_distance(double %0) {
%2 = fadd double %0, 1.000000e+00
%3 = tail call double @transverse_distance(double %0)
%4 = fmul double %2, %3
ret double %4
}
void AlarmToTimerC$0$Alarm$stop(void) { Atm128AlarmAsyncP$0$Alarm$stop(); }


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

x86 assembly (clang, -O2):
<AlarmToTimerC$0$Alarm$stop>:
xor    %eax,%eax
jmp    1030 <Atm128AlarmAsyncP$0$Alarm$stop@plt>

LLVM IR (-O0):
define void @"AlarmToTimerC$0$Alarm$stop"() {
%1 = call i32 (...) @"Atm128AlarmAsyncP$0$Alarm$stop"()
ret void
}

LLVM IR (-O2):
define void @"AlarmToTimerC$0$Alarm$stop"() {
%1 = tail call i32 (...) @"Atm128AlarmAsyncP$0$Alarm$stop"()
ret void
}
int indexedBinaryToInt(char *x, int *index, int n) {
  int val;
  int *idx;
  int *indexN;
  val = 0;
  indexN = index + n;
  for (idx = index; idx < indexN; idx++) {
    val <<= 1;
    val += x[*idx];
  }
  return val;
}


x86 assembly (clang, -O0):
<indexedBinaryToInt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    116e <indexedBinaryToInt+0x6e>
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
movslq (%rcx),%rcx
movsbl (%rax,%rcx,1),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x20(%rbp)
jmp    1131 <indexedBinaryToInt+0x31>
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<indexedBinaryToInt>:
test   %edx,%edx
jle    1124 <indexedBinaryToInt+0x24>
movslq %edx,%rax
lea    (%rsi,%rax,4),%rcx
xor    %eax,%eax
nopl   (%rax)
movslq (%rsi),%rdx
movsbl (%rdi,%rdx,1),%edx
lea    (%rdx,%rax,2),%eax
add    $0x4,%rsi
cmp    %rcx,%rsi
jb     1110 <indexedBinaryToInt+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @indexedBinaryToInt(i8* %0, i32* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
store i32 0, i32* %7
%10 = load i32*, i32** %5
%11 = load i32, i32* %6
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %10, i64 %12
store i32* %13, i32** %9
%14 = load i32*, i32** %5
store i32* %14, i32** %8
br label %15
15: ; preds = %31, %3
%16 = load i32*, i32** %8
%17 = load i32*, i32** %9
%18 = icmp ult i32* %16, %17
br i1 %18, label %19, label %34
19: ; preds = %15
%20 = load i32, i32* %7
%21 = shl i32 %20, 1
store i32 %21, i32* %7
%22 = load i8*, i8** %4
%23 = load i32*, i32** %8
%24 = load i32, i32* %23
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %22, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = load i32, i32* %7
%30 = add nsw i32 %29, %28
store i32 %30, i32* %7
br label %31
31: ; preds = %19
%32 = load i32*, i32** %8
%33 = getelementptr inbounds i32, i32* %32, i32 1
store i32* %33, i32** %8
br label %15
34: ; preds = %15
%35 = load i32, i32* %7
ret i32 %35
}

LLVM IR (-O2):
define i32 @indexedBinaryToInt(i8* nocapture %0, i32* %1, i32 %2) {
%4 = sext i32 %2 to i64
%5 = getelementptr inbounds i32, i32* %1, i64 %4
%6 = icmp sgt i32 %2, 0
br i1 %6, label %7, label %19
7: ; preds = %3, %7
%8 = phi i32 [ %16, %7 ], [ 0, %3 ]
%9 = phi i32* [ %17, %7 ], [ %1, %3 ]
%10 = shl i32 %8, 1
%11 = load i32, i32* %9
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = add nsw i32 %10, %15
%17 = getelementptr inbounds i32, i32* %9, i64 1
%18 = icmp ult i32* %17, %5
br i1 %18, label %7, label %19
19: ; preds = %7, %3
%20 = phi i32 [ 0, %3 ], [ %16, %7 ]
ret i32 %20
}
unsigned ROR(unsigned word, int i) {
  __asm__("rorl %%cl,%0" : "=r"(word) : "0"(word), "c"(i));
  return word;
}


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

x86 assembly (clang, -O2):
<ROR>:
mov    %esi,%ecx
mov    %edi,%eax
ror    %cl,%eax
ret

LLVM IR (-O0):
define i32 @ROR(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 asm "rorl %cl,$0", "=r,0,{cx},~{dirflag},~{fpsr},~{flags}"(i32 %5, i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
define i32 @ROR(i32 %0, i32 %1) {
%3 = tail call i32 asm "rorl %cl,$0", "=r,0,{cx},~{dirflag},~{fpsr},~{flags}"(i32 %0, i32 %1)
ret i32 %3
}
int op_left_assoc(const char c) {
  switch (c) {
  case '*':
  case '/':
  case '%':
  case '+':
  case '-':
  case '^':
  case '@':
    return 1;
  case '=':
    return 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<op_left_assoc>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x25,%eax
je     1188 <op_left_assoc+0x88>
jmp    111f <op_left_assoc+0x1f>
mov    -0xc(%rbp),%eax
add    $0xffffffd6,%eax
sub    $0x2,%eax
jb     1188 <op_left_assoc+0x88>
jmp    1133 <op_left_assoc+0x33>
mov    -0xc(%rbp),%eax
sub    $0x2d,%eax
je     1188 <op_left_assoc+0x88>
jmp    1144 <op_left_assoc+0x44>
mov    -0xc(%rbp),%eax
sub    $0x2f,%eax
je     1188 <op_left_assoc+0x88>
jmp    1155 <op_left_assoc+0x55>
mov    -0xc(%rbp),%eax
sub    $0x3d,%eax
je     1194 <op_left_assoc+0x94>
jmp    1166 <op_left_assoc+0x66>
mov    -0xc(%rbp),%eax
sub    $0x40,%eax
je     1188 <op_left_assoc+0x88>
jmp    1177 <op_left_assoc+0x77>
mov    -0xc(%rbp),%eax
sub    $0x5e,%eax
jne    11a0 <op_left_assoc+0xa0>
jmp    1188 <op_left_assoc+0x88>
movl   $0x1,-0x4(%rbp)
jmp    11a7 <op_left_assoc+0xa7>
movl   $0x0,-0x4(%rbp)
jmp    11a7 <op_left_assoc+0xa7>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_left_assoc>:
add    $0xffffffdb,%edi
cmp    $0x39,%edi
ja     1122 <op_left_assoc+0x22>
mov    $0x1,%eax
movabs $0x200000008000561,%rcx
bt     %rdi,%rcx
jae    111e <op_left_assoc+0x1e>
ret
cmp    $0x18,%rdi
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @op_left_assoc(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %8 [
i32 42, label %6
i32 47, label %6
i32 37, label %6
i32 43, label %6
i32 45, label %6
i32 94, label %6
i32 64, label %6
i32 61, label %7
]
6: ; preds = %1, %1, %1, %1, %1, %1, %1
store i32 1, i32* %2
br label %9
7: ; preds = %1
store i32 0, i32* %2
br label %9
8: ; preds = %1
store i32 0, i32* %2
br label %9
9: ; preds = %8, %7, %6
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @op_left_assoc(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %4 [
i32 42, label %5
i32 47, label %5
i32 37, label %5
i32 43, label %5
i32 45, label %5
i32 94, label %5
i32 64, label %5
i32 61, label %3
]
3: ; preds = %1
br label %5
4: ; preds = %1
br label %5
5: ; preds = %1, %1, %1, %1, %1, %1, %1, %4, %3
%6 = phi i32 [ 0, %4 ], [ 0, %3 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ gc();
void primitive_gc(void) { gc(); }


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

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

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

LLVM IR (-O2):
define void @primitive_gc() {
%1 = tail call i32 (...) @gc()
ret void
}
void initialize_cold(int height[]) {
  int ix;
  for (ix = 0; ix < 100; ix++) {
    height[ix] = 0;
  }
}


x86 assembly (clang, -O0):
<initialize_cold>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x64,-0xc(%rbp)
jge    1136 <initialize_cold+0x36>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <initialize_cold+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<initialize_cold>:
push   %rax
mov    $0x190,%edx
xor    %esi,%esi
call   1030 <memset@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @initialize_cold(i32* nocapture writeonly %0) {
%2 = bitcast i32* %0 to i8*
ret void
}
void g_main_context_query() {}


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

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

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

LLVM IR (-O2):
define void @g_main_context_query() {
ret void
}
int dlugosc(char tab1[]) {
  int i = 0;
  while (*tab1++ != '\0')
    i++;
  i--;
  return i;
}


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

x86 assembly (clang, -O2):
<dlugosc>:
cmpb   $0x0,(%rdi)
je     111d <dlugosc+0x1d>
add    $0x1,%rdi
mov    $0xffffffff,%eax
xchg   %ax,%ax
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <dlugosc+0x10>
ret
mov    $0xffffffff,%eax
ret

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

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

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *a, int *b) {
  assert(0);
}


x86 assembly (clang, -O0):
<pthread_mutexattr_getprotocol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
xor    %edi,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @pthread_mutexattr_getprotocol(i32* nocapture readnone %0, i32* nocapture readnone %1) {
%3 = tail call i32 @assert(i32 0)
ret i32 undef
}
/* Variables and functions */
int skill_get_sp(int, int);
int guild_skill_get_sp(int id, int lv) { return skill_get_sp(id, lv); }


x86 assembly (clang, -O0):
<guild_skill_get_sp>:
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 <skill_get_sp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<guild_skill_get_sp>:
jmp    1030 <skill_get_sp@plt>

LLVM IR (-O0):
define i32 @guild_skill_get_sp(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 @skill_get_sp(i32 %5, i32 %6)
ret i32 %7
}

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

/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int
sd_pid_notify(pid_t pid, int unset_environment, const char *state) {
  return -EINVAL;
}


x86 assembly (clang, -O0):
<sd_pid_notify>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
xor    %eax,%eax
mov    0x2ec9(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sd_pid_notify>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sd_pid_notify(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* @EINVAL
%8 = sub nsw i32 0, %7
ret i32 %8
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_pid_notify(i32 %0, i32 %1, i8* nocapture readnone %2) {
%4 = load i32, i32* @EINVAL
%5 = sub nsw i32 0, %4
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ flag;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
void print_flag() {
  FILE *f = fopen("flag.txt", "r");
  char flag[50];
  fgets(flag, sizeof(flag), f);
  fclose(f);
  printf("YAY, FLAG: %s\n", flag);
  return;
}


x86 assembly (clang, -O0):
<print_flag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    0xeb1(%rip),%rdi
lea    0xeb3(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x8(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x32,%esi
call   1050 <fgets@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
lea    -0x40(%rbp),%rsi
lea    0xe86(%rip),%rdi
call   1040 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_flag>:
push   %r14
push   %rbx
sub    $0x38,%rsp
lea    0xeb2(%rip),%rdi
lea    0xeb4(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x32,%esi
mov    %rax,%rdx
call   1050 <fgets@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
lea    0xe8c(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [9 x i8] c"flag.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [15 x i8] c"YAY, FLAG: %s\0A\00"
define void @print_flag() {
%1 = alloca i32*
%2 = alloca [50 x i8]
%3 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 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** %1
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%5 = load i32*, i32** %1
%6 = call i32 @fgets(i8* %4, i32 50, i32* %5)
%7 = load i32*, i32** %1
%8 = call i32 @fclose(i32* %7)
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"flag.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [15 x i8] c"YAY, FLAG: %s\0A\00"
define void @print_flag() {
%1 = alloca [50 x i8]
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%4 = call i32 @fgets(i8* %3, i32 50, i32* %2)
%5 = call i32 @fclose(i32* %2)
%6 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %3)
ret void
}
double exponentialMovingAverage(const double value, const double previousEMA,
                                const double alpha) {
  double EMA = previousEMA;
  EMA += alpha * (value - previousEMA);
  return EMA;
}


x86 assembly (clang, -O0):
<exponentialMovingAverage>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
subsd  -0x10(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<exponentialMovingAverage>:
subsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @exponentialMovingAverage(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%8 = load double, double* %5
store double %8, double* %7
%9 = load double, double* %6
%10 = load double, double* %4
%11 = load double, double* %5
%12 = fsub double %10, %11
%13 = load double, double* %7
%14 = call double @llvm.fmuladd.f64(double %9, double %12, double %13)
store double %14, double* %7
%15 = load double, double* %7
ret double %15
}

LLVM IR (-O2):
define double @exponentialMovingAverage(double %0, double %1, double %2) {
%4 = fsub double %0, %1
%5 = tail call double @llvm.fmuladd.f64(double %2, double %4, double %1)
ret double %5
}
/* Type definitions */
struct terminal {
  int dummy;
};
struct parm_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ move_cursor(struct terminal *, int, int /*<<< orphan*/);
int sum(struct parm_t *);
void curs_up(struct terminal *term, struct parm_t *parm) {
  int num = sum(parm);
  if (num <= 0)
    num = 1;
  move_cursor(term, -num, 0);
}


x86 assembly (clang, -O0):
<curs_up>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <sum@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jg     114d <curs_up+0x2d>
movl   $0x1,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
sub    -0x14(%rbp),%esi
xor    %edx,%edx
call   1040 <move_cursor@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<curs_up>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <sum@plt>
test   %eax,%eax
mov    $0x1,%esi
cmovg  %eax,%esi
neg    %esi
mov    %rbx,%rdi
xor    %edx,%edx
pop    %rbx
jmp    1040 <move_cursor@plt>

LLVM IR (-O0):
%struct.terminal = type { i32 }
%struct.parm_t = type { i32 }
define void @curs_up(%struct.terminal* %0, %struct.parm_t* %1) {
%3 = alloca %struct.terminal*
%4 = alloca %struct.parm_t*
%5 = alloca i32
store %struct.terminal* %0, %struct.terminal** %3
store %struct.parm_t* %1, %struct.parm_t** %4
%6 = load %struct.parm_t*, %struct.parm_t** %4
%7 = call i32 @sum(%struct.parm_t* %6)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = icmp sle i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 1, i32* %5
br label %11
11: ; preds = %10, %2
%12 = load %struct.terminal*, %struct.terminal** %3
%13 = load i32, i32* %5
%14 = sub nsw i32 0, %13
%15 = call i32 @move_cursor(%struct.terminal* %12, i32 %14, i32 0)
ret void
}

LLVM IR (-O2):
%struct.terminal = type { i32 }
%struct.parm_t = type { i32 }
define void @curs_up(%struct.terminal* %0, %struct.parm_t* %1) {
%3 = tail call i32 @sum(%struct.parm_t* %1)
%4 = icmp sgt i32 %3, 1
%5 = select i1 %4, i32 %3, i32 1
%6 = sub nsw i32 0, %5
%7 = tail call i32 @move_cursor(%struct.terminal* %0, i32 %6, i32 0)
ret void
}
/* Type definitions */
struct rw_semaphore {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ __down_write(struct rw_semaphore *);
void down_write(struct rw_semaphore *sem) { __down_write(sem); }


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

x86 assembly (clang, -O2):
<down_write>:
jmp    1030 <__down_write@plt>

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

LLVM IR (-O2):
%struct.rw_semaphore = type { i32 }
define void @down_write(%struct.rw_semaphore* %0) {
%2 = tail call i32 @__down_write(%struct.rw_semaphore* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ err_exit(char *, int /*<<< orphan*/);
char *strrchr(char const *, int);
char *Strrchr(const char *s, int c) {
  if (!s)
    err_exit("Strrchr(NULL)\n", 0);
  return strrchr(s, c);
}


x86 assembly (clang, -O0):
<Strrchr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1148 <Strrchr+0x28>
lea    0xebf(%rip),%rdi
xor    %esi,%esi
call   1040 <err_exit@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <strrchr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Strrchr>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
test   %rdi,%rdi
jne    113b <Strrchr+0x1b>
lea    0xecc(%rip),%rdi
xor    %esi,%esi
call   1040 <err_exit@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <strrchr@plt>

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

LLVM IR (-O2):
@.str = [15 x i8] c"Strrchr(NULL)\0A\00"
define i8* @Strrchr(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @err_exit(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 0)
br label %6
6: ; preds = %4, %2
%7 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i32 %1)
ret i8* %7
}
/* Type definitions */
typedef int /*<<< orphan*/ __m64;

/* Variables and functions */
scalar_t__ _mm_packs_pi16(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ abort();
void __attribute__((no))
check_packs_pi16(unsigned long long int src1, unsigned long long int src2,
                 unsigned long long int res_ref) {
  unsigned long long int res;
  res = (unsigned long long int)_mm_packs_pi16((__m64)src1, (__m64)src2);
  if (res != res_ref)
    abort();
}


x86 assembly (clang, -O0):
<check_packs_pi16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%edi
mov    -0x10(%rbp),%rax
mov    %eax,%esi
call   1040 <_mm_packs_pi16@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     115e <check_packs_pi16+0x3e>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_packs_pi16>:
push   %rbx
mov    %rdx,%rbx
call   1040 <_mm_packs_pi16@plt>
cmp    %rbx,%rax
jne    1130 <check_packs_pi16+0x10>
pop    %rbx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @check_packs_pi16(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%8 = load i64, i64* %4
%9 = trunc i64 %8 to i32
%10 = load i64, i64* %5
%11 = trunc i64 %10 to i32
%12 = call i64 @_mm_packs_pi16(i32 %9, i32 %11)
store i64 %12, i64* %7
%13 = load i64, i64* %7
%14 = load i64, i64* %6
%15 = icmp ne i64 %13, %14
br i1 %15, label %16, label %18
16: ; preds = %3
%17 = call i32 (...) @abort()
unreachable
18: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @check_packs_pi16(i64 %0, i64 %1, i64 %2) {
%4 = trunc i64 %0 to i32
%5 = trunc i64 %1 to i32
%6 = tail call i64 @_mm_packs_pi16(i32 %4, i32 %5)
%7 = icmp eq i64 %6, %2
br i1 %7, label %10, label %8
8: ; preds = %3
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %3
ret void
}
/* Variables and functions */
int convertBinaryToDecimal(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  char *s = "\u00d1";
  printf("%d\n", convertBinaryToDecimal(10000000 & 10000000));
  return 1;
}


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    $0x989680,%edi
call   1040 <convertBinaryToDecimal@plt>
mov    %eax,%esi
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x989680,%edi
call   1040 <convertBinaryToDecimal@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @convertBinaryToDecimal(i32 10000000)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %1)
ret i32 1
}
/* Type definitions */
struct discrete_world_2D {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ discrete_world_2D_destroy(struct discrete_world_2D *);
int /*<<< orphan*/ free(struct discrete_world_2D *);
void discrete_world_2D_free(struct discrete_world_2D *world) {
  discrete_world_2D_destroy(world);
  free(world);
}


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

x86 assembly (clang, -O2):
<discrete_world_2D_free>:
push   %rbx
mov    %rdi,%rbx
call   1040 <discrete_world_2D_destroy@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.discrete_world_2D = type { i32 }
define void @discrete_world_2D_free(%struct.discrete_world_2D* %0) {
%2 = alloca %struct.discrete_world_2D*
store %struct.discrete_world_2D* %0, %struct.discrete_world_2D** %2
%3 = load %struct.discrete_world_2D*, %struct.discrete_world_2D** %2
%4 = call i32 @discrete_world_2D_destroy(%struct.discrete_world_2D* %3)
%5 = load %struct.discrete_world_2D*, %struct.discrete_world_2D** %2
%6 = call i32 @free(%struct.discrete_world_2D* %5)
ret void
}

LLVM IR (-O2):
%struct.discrete_world_2D = type { i32 }
define void @discrete_world_2D_free(%struct.discrete_world_2D* %0) {
%2 = tail call i32 @discrete_world_2D_destroy(%struct.discrete_world_2D* %0)
%3 = tail call i32 @free(%struct.discrete_world_2D* %0)
ret void
}
/* Variables and functions */
void *malloc(size_t);
void *clad_malloc(size_t size) { return malloc(size); }


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

x86 assembly (clang, -O2):
<clad_malloc>:
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @clad_malloc(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i8* @malloc(i64 %3)
ret i8* %4
}

LLVM IR (-O2):
define noalias i8* @clad_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
ret i8* %2
}