xunge/DecIR huggingface dataset:
int length(line)
register char *line;
{
  register int i = 1;
  while (*line++ != '\n')
    i++;
  return i;
}


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

x86 assembly (clang, -O2):
<length>:
mov    $0x1,%eax
cmpb   $0xa,(%rdi)
je     111a <length+0x1a>
mov    $0x1,%eax
nop
cmpb   $0xa,(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <length+0x10>
ret

LLVM IR (-O0):
define i32 @length(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 1, 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, 10
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
ret i32 %14
}

LLVM IR (-O2):
define i32 @length(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 10
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 1, %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, 10
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 1, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Variables and functions */
char *malloc(int);
int rand();
char *realloc(char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
char *fn32() {
  char *result;
  result = malloc(20 + rand() % 20);
  result = realloc(result, 30 + rand() % 20);
  strcpy((char *)result, "fn32");
  return result;
}


x86 assembly (clang, -O0):
<fn32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    -0x10(%rbp),%rdi
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x1e,%esi
call   1050 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn32>:
push   %rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1e,%esi
mov    %rbx,%rdi
call   1050 <realloc@plt>
mov    %rax,%rbx
lea    0xe4f(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"fn32\00"
define i8* @fn32() {
%1 = alloca i8*
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 20
%4 = add nsw i32 20, %3
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 (...) @rand()
%8 = srem i32 %7, 20
%9 = add nsw i32 30, %8
%10 = call i8* @realloc(i8* %6, i32 %9)
store i8* %10, i8** %1
%11 = load i8*, i8** %1
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = load i8*, i8** %1
ret i8* %13
}

LLVM IR (-O2):
@.str = [5 x i8] c"fn32\00"
define i8* @fn32() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 20
%3 = add nsw i32 %2, 20
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 20
%7 = add nsw i32 %6, 30
%8 = tail call i8* @realloc(i8* %4, i32 %7)
%9 = tail call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i8* %8
}
void f(int nargs, ...) {
  __builtin_va_list l;
  __builtin_va_start(l, f);
  f1(nargs, l);
  __builtin_va_end(l);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
test   %al,%al
je     1149 <f+0x39>
movaps %xmm0,-0xa0(%rbp)
movaps %xmm1,-0x90(%rbp)
movaps %xmm2,-0x80(%rbp)
movaps %xmm3,-0x70(%rbp)
movaps %xmm4,-0x60(%rbp)
movaps %xmm5,-0x50(%rbp)
movaps %xmm6,-0x40(%rbp)
movaps %xmm7,-0x30(%rbp)
mov    %r9,-0xa8(%rbp)
mov    %r8,-0xb0(%rbp)
mov    %rcx,-0xb8(%rbp)
mov    %rdx,-0xc0(%rbp)
mov    %rsi,-0xc8(%rbp)
mov    %edi,-0x4(%rbp)
lea    -0xd0(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x30,-0x1c(%rbp)
movl   $0x8,-0x20(%rbp)
mov    -0x4(%rbp),%edi
xor    %eax,%eax
lea    -0x20(%rbp),%rsi
call   1030 <f1@plt>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
sub    $0xd8,%rsp
mov    %rsi,0x28(%rsp)
mov    %rdx,0x30(%rsp)
mov    %rcx,0x38(%rsp)
mov    %r8,0x40(%rsp)
mov    %r9,0x48(%rsp)
test   %al,%al
je     116b <f+0x5b>
movaps %xmm0,0x50(%rsp)
movaps %xmm1,0x60(%rsp)
movaps %xmm2,0x70(%rsp)
movaps %xmm3,0x80(%rsp)
movaps %xmm4,0x90(%rsp)
movaps %xmm5,0xa0(%rsp)
movaps %xmm6,0xb0(%rsp)
movaps %xmm7,0xc0(%rsp)
lea    0x20(%rsp),%rax
mov    %rax,0x10(%rsp)
lea    0xe0(%rsp),%rax
mov    %rax,0x8(%rsp)
movabs $0x3000000008,%rax
mov    %rax,(%rsp)
mov    %rsp,%rsi
xor    %eax,%eax
call   1030 <f1@plt>
add    $0xd8,%rsp
ret

LLVM IR (-O0):
%struct.__va_list_tag = type { i32, i32, i8*, i8* }
define void @f(i32 %0, ...) {
%2 = alloca i32
%3 = alloca [1 x %struct.__va_list_tag]
store i32 %0, i32* %2
%4 = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %3, i64 0, i64 0
%5 = bitcast %struct.__va_list_tag* %4 to i8*
%6 = load i32, i32* %2
%7 = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %3, i64 0, i64 0
%8 = call i32 (i32, %struct.__va_list_tag*, ...) bitcast (i32 (...)* @f1 to i32 (i32, %struct.__va_list_tag*, ...)*)(i32 %6, %struct.__va_list_tag* %7)
%9 = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %3, i64 0, i64 0
%10 = bitcast %struct.__va_list_tag* %9 to i8*
ret void
}

LLVM IR (-O2):
%struct.__va_list_tag = type { i32, i32, i8*, i8* }
define void @f(i32 %0, ...) {
%2 = alloca [1 x %struct.__va_list_tag]
%3 = bitcast [1 x %struct.__va_list_tag]* %2 to i8*
%4 = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %2, i64 0, i64 0
%5 = call i32 (i32, %struct.__va_list_tag*, ...) bitcast (i32 (...)* @f1 to i32 (i32, %struct.__va_list_tag*, ...)*)(i32 %0, %struct.__va_list_tag* %4)
ret void
}
/* Variables and functions */
double sqrt(int);
double JHKeyframeAnimationFunctionEaseOutCirc(double t, double b, double c,
                                              double d) {
  return c * sqrt(1 - (t = t / d - 1) * t) + b;
}


x86 assembly (clang, -O0):
<JHKeyframeAnimationFunctionEaseOutCirc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  0xeb8(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe87(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sqrt@plt>
movaps %xmm0,%xmm2
movsd  -0x28(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<JHKeyframeAnimationFunctionEaseOutCirc>:
sub    $0x18,%rsp
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x10(%rsp)
divsd  %xmm3,%xmm0
addsd  0xed4(%rip),%xmm0
mulsd  %xmm0,%xmm0
movsd  0xed0(%rip),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1030 <sqrt@plt>
mulsd  0x8(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @JHKeyframeAnimationFunctionEaseOutCirc(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = load double, double* %7
%10 = load double, double* %5
%11 = load double, double* %8
%12 = fdiv double %10, %11
%13 = fsub double %12, 1.000000e+00
store double %13, double* %5
%14 = load double, double* %5
%15 = fneg double %13
%16 = call double @llvm.fmuladd.f64(double %15, double %14, double 1.000000e+00)
%17 = fptosi double %16 to i32
%18 = call double @sqrt(i32 %17)
%19 = load double, double* %6
%20 = call double @llvm.fmuladd.f64(double %9, double %18, double %19)
ret double %20
}

LLVM IR (-O2):
define double @JHKeyframeAnimationFunctionEaseOutCirc(double %0, double %1, double %2, double %3) {
%5 = fdiv double %0, %3
%6 = fadd double %5, -1.000000e+00
%7 = fneg double %6
%8 = tail call double @llvm.fmuladd.f64(double %7, double %6, double 1.000000e+00)
%9 = fptosi double %8 to i32
%10 = tail call double @sqrt(i32 %9)
%11 = tail call double @llvm.fmuladd.f64(double %2, double %10, double %1)
ret double %11
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ __uportlibc_add_stream(int /*<<< orphan*/ *);
int /*<<< orphan*/ set_stdio_exit_fun();
void set_stdio_exit_fun_and_add_stream(FILE *stream) {
  set_stdio_exit_fun();
  __uportlibc_add_stream(stream);
}


x86 assembly (clang, -O0):
<set_stdio_exit_fun_and_add_stream>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <set_stdio_exit_fun@plt>
mov    -0x8(%rbp),%rdi
call   1030 <__uportlibc_add_stream@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_stdio_exit_fun_and_add_stream>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <set_stdio_exit_fun@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <__uportlibc_add_stream@plt>

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

LLVM IR (-O2):
define void @set_stdio_exit_fun_and_add_stream(i32* %0) {
%2 = tail call i32 (...) @set_stdio_exit_fun()
%3 = tail call i32 @__uportlibc_add_stream(i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ execv(char *, char **);
int /*<<< orphan*/ setresuid(int, int, int);
int main(int argc, char **argv) {
  setresuid(2003, 2003, 2003);
  execv("/wargame/bin/tmpserver2.sh", argv);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x7d3,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1030 <setresuid@plt>
mov    -0x10(%rbp),%rsi
lea    0xeb8(%rip),%rdi
call   1040 <execv@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
mov    $0x7d3,%edi
mov    $0x7d3,%esi
mov    $0x7d3,%edx
call   1030 <setresuid@plt>
lea    0xec1(%rip),%rdi
mov    %rbx,%rsi
call   1040 <execv@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"/wargame/bin/tmpserver2.sh\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @setresuid(i32 2003, i32 2003, i32 2003)
%6 = load i8**, i8*** %4
%7 = call i32 @execv(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8** %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"/wargame/bin/tmpserver2.sh\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @setresuid(i32 2003, i32 2003, i32 2003)
%4 = tail call i32 @execv(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8** %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int /*<<< orphan*/);
int /*<<< orphan*/ UARTBaseValid(unsigned long);
void UARTDisableSIR(unsigned long ulBase) {
  DEBUG_ASSERT(UARTBaseValid(ulBase));
  (*((volatile unsigned long *)(ulBase + 0x00000030))) &=
      ~(0x00000002 | 0x00000004);
}


x86 assembly (clang, -O0):
<UARTDisableSIR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <UARTBaseValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x8(%rbp),%rax
mov    0x30(%rax),%rcx
and    $0xfffffffffffffff9,%rcx
mov    %rcx,0x30(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTDisableSIR>:
push   %rbx
mov    %rdi,%rbx
call   1040 <UARTBaseValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
andq   $0xfffffffffffffff9,0x30(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @UARTDisableSIR(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @UARTBaseValid(i64 %3)
%5 = call i32 @DEBUG_ASSERT(i32 %4)
%6 = load i64, i64* %2
%7 = add i64 %6, 48
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = and i64 %9, -7
store volatile i64 %10, i64* %8
ret void
}

LLVM IR (-O2):
define void @UARTDisableSIR(i64 %0) {
%2 = tail call i32 @UARTBaseValid(i64 %0)
%3 = tail call i32 @DEBUG_ASSERT(i32 %2)
%4 = add i64 %0, 48
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
%7 = and i64 %6, -7
store volatile i64 %7, i64* %5
ret void
}
/* Variables and functions */
int foo(int, float ***);
int main(void) {
  float p[][2][7] = {3.14, 3.1, 5.1, 7.24, 6.12, 8.12, 9.13};
  return foo(6, p) + foo(7, p);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x38,%edx
call   1030 <memcpy@plt>
lea    -0x40(%rbp),%rsi
mov    $0x6,%edi
call   1040 <foo@plt>
mov    %eax,-0x44(%rbp)
lea    -0x40(%rbp),%rsi
mov    $0x7,%edi
call   1040 <foo@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
add    %ecx,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x38,%rsp
mov    0xf13(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0xef7(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xedb(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebf(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    $0x6,%edi
mov    %rbx,%rsi
call   1030 <foo@plt>
mov    %eax,%ebp
mov    $0x7,%edi
mov    %rbx,%rsi
call   1030 <foo@plt>
add    %ebp,%eax
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.p = [1 x [2 x [7 x float]]] [[2 x [7 x float]] [[7 x float] [float 0x40091EB860000000, float 0x4008CCCCC0000000, float 0x4014666660000000, float 0x401CF5C280000000, float 0x40187AE140000000, float 0x40203D70A0000000, float 0x4022428F60000000], [7 x float] zeroinitializer]]
define i32 @main() {
%1 = alloca i32
%2 = alloca [1 x [2 x [7 x float]]]
store i32 0, i32* %1
%3 = bitcast [1 x [2 x [7 x float]]]* %2 to i8*
%4 = getelementptr inbounds [1 x [2 x [7 x float]]], [1 x [2 x [7 x float]]]* %2, i64 0, i64 0
%5 = bitcast [2 x [7 x float]]* %4 to float***
%6 = call i32 @foo(i32 6, float*** %5)
%7 = getelementptr inbounds [1 x [2 x [7 x float]]], [1 x [2 x [7 x float]]]* %2, i64 0, i64 0
%8 = bitcast [2 x [7 x float]]* %7 to float***
%9 = call i32 @foo(i32 7, float*** %8)
%10 = add nsw i32 %6, %9
ret i32 %10
}

LLVM IR (-O2):
@__const.main.p = [1 x [2 x [7 x float]]] [[2 x [7 x float]] [[7 x float] [float 0x40091EB860000000, float 0x4008CCCCC0000000, float 0x4014666660000000, float 0x401CF5C280000000, float 0x40187AE140000000, float 0x40203D70A0000000, float 0x4022428F60000000], [7 x float] zeroinitializer]]
define i32 @main() {
%1 = alloca [1 x [2 x [7 x float]]]
%2 = bitcast [1 x [2 x [7 x float]]]* %1 to i8*
%3 = bitcast [1 x [2 x [7 x float]]]* %1 to float***
%4 = call i32 @foo(i32 6, float*** %3)
%5 = call i32 @foo(i32 7, float*** %3)
%6 = add nsw i32 %5, %4
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ closesocket(int);
void end_connection(int sock) { closesocket(sock); }


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

x86 assembly (clang, -O2):
<end_connection>:
jmp    1030 <closesocket@plt>

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

LLVM IR (-O2):
define void @end_connection(i32 %0) {
%2 = tail call i32 @closesocket(i32 %0)
ret void
}
int room_assign(char li) {
  if ((li >= 'a' && li <= 'm') || (li >= 'A' && li <= 'M'))
    return 1045;
  else
    return 1055;
}


x86 assembly (clang, -O0):
<room_assign>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     1124 <room_assign+0x24>
movsbl -0x5(%rbp),%eax
cmp    $0x6d,%eax
jle    113e <room_assign+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     114a <room_assign+0x4a>
movsbl -0x5(%rbp),%eax
cmp    $0x4d,%eax
jg     114a <room_assign+0x4a>
movl   $0x415,-0x4(%rbp)
jmp    1151 <room_assign+0x51>
movl   $0x41f,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<room_assign>:
and    $0xdf,%dil
add    $0xbf,%dil
cmp    $0xd,%dil
mov    $0x415,%ecx
mov    $0x41f,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @room_assign(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
%6 = icmp sge i32 %5, 97
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 109
br i1 %10, label %19, label %11
11: ; preds = %7, %1
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = icmp sge i32 %13, 65
br i1 %14, label %15, label %20
15: ; preds = %11
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = icmp sle i32 %17, 77
br i1 %18, label %19, label %20
19: ; preds = %15, %7
store i32 1045, i32* %2
br label %21
20: ; preds = %15, %11
store i32 1055, i32* %2
br label %21
21: ; preds = %20, %19
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
define i32 @room_assign(i8 signext %0) {
%2 = and i8 %0, -33
%3 = add i8 %2, -65
%4 = icmp ult i8 %3, 13
%5 = select i1 %4, i32 1045, i32 1055
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ __internal_syscall(int, long, long, long, long);
void _exit(int exit_status) {
  __internal_syscall(93, (long)(exit_status), (long)(0), (long)(0), (long)(0));
  while (1)
    ;
}


x86 assembly (clang, -O0):
<_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rsi
mov    $0x5d,%edi
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rdx
mov    %r8,%rcx
call   1030 <__internal_syscall@plt>
jmp    1134 <_exit+0x24>

x86 assembly (clang, -O2):
<_exit>:
push   %rax
movslq %edi,%rsi
mov    $0x5d,%edi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <__internal_syscall@plt>
cs nopw 0x0(%rax,%rax,1)
nop
jmp    1130 <_exit+0x20>

LLVM IR (-O0):
define void @_exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = call i32 @__internal_syscall(i32 93, i64 %4, i64 0, i64 0, i64 0)
br label %6
6: ; preds = %1, %6
br label %6
}

LLVM IR (-O2):
define void @_exit(i32 %0) {
%2 = sext i32 %0 to i64
%3 = tail call i32 @__internal_syscall(i32 93, i64 %2, i64 0, i64 0, i64 0)
br label %4
4: ; preds = %1, %4
br label %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ struct_by_value_16a_x();
int main() {
  struct_by_value_16a_x();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <struct_by_value_16a_x@plt>
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <struct_by_value_16a_x@plt>
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @struct_by_value_16a_x()
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @struct_by_value_16a_x()
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
bool ts_get_transporterror(const uint8_t *p_ts) { return !!(p_ts[1] & 0x80); }


x86 assembly (clang, -O0):
<ts_get_transporterror>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
and    $0x80,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ts_get_transporterror>:
mov    0x4(%rdi),%eax
shr    $0x7,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @ts_get_transporterror(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 1
%5 = load i32, i32* %4
%6 = and i32 %5, 128
%7 = icmp ne i32 %6, 0
%8 = xor i1 %7, true
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @ts_get_transporterror(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
%3 = load i32, i32* %2
%4 = lshr i32 %3, 7
%5 = and i32 %4, 1
ret i32 %5
}
int tuxonice_calc_checksum(struct page *page, char *checksum_locn) { return 0; }


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

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

LLVM IR (-O0):
%struct.page = type opaque
define i32 @tuxonice_calc_checksum(%struct.page* %0, i8* %1) {
%3 = alloca %struct.page*
%4 = alloca i8*
store %struct.page* %0, %struct.page** %3
store i8* %1, i8** %4
ret i32 0
}

LLVM IR (-O2):
%struct.page = type opaque
define i32 @tuxonice_calc_checksum(%struct.page* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
int main() {
  int i = 0;
  if (i != 0) {
  ERROR:
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112d <main+0x2d>
jmp    1121 <main+0x21>
movl   $0xffffffff,-0x4(%rbp)
jmp    1134 <main+0x34>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
scalar_t__ isspace(char);
int str_length(char *);
void rstrip(char *s) {
  int i = str_length(s) - 1;
  while (isspace(s[i])) {
    s[i] = '\0';
    i--;
  }
}


x86 assembly (clang, -O0):
<rstrip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <str_length@plt>
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
je     1170 <rstrip+0x50>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    113b <rstrip+0x1b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rstrip>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <str_length@plt>
movslq %eax,%r14
movsbl -0x1(%r14,%rbx,1),%edi
call   1040 <isspace@plt>
test   %rax,%rax
je     1165 <rstrip+0x45>
add    %r14,%rbx
add    $0xffffffffffffffff,%rbx
cs nopw 0x0(%rax,%rax,1)
movb   $0x0,(%rbx)
movsbl -0x1(%rbx),%edi
add    $0xffffffffffffffff,%rbx
call   1040 <isspace@plt>
test   %rax,%rax
jne    1150 <rstrip+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @rstrip(i8* %0) {
%2 = tail call i32 @str_length(i8* %0)
%3 = add nsw i32 %2, -1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = tail call i64 @isspace(i8 signext %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %17, label %9
9: ; preds = %1, %9
%10 = phi i64 [ %12, %9 ], [ %4, %1 ]
%11 = phi i8* [ %13, %9 ], [ %5, %1 ]
store i8 0, i8* %11
%12 = add i64 %10, -1
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = tail call i64 @isspace(i8 signext %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %9
17: ; preds = %9, %1
ret void
}
/* Type definitions */
struct device {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ BUG();
void plat_extra_sync_for_device(struct device *dev) { BUG(); }


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

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

LLVM IR (-O0):
%struct.device = type { i32 }
define void @plat_extra_sync_for_device(%struct.device* %0) {
%2 = alloca %struct.device*
store %struct.device* %0, %struct.device** %2
%3 = call i32 (...) @BUG()
ret void
}

LLVM IR (-O2):
%struct.device = type { i32 }
define void @plat_extra_sync_for_device(%struct.device* nocapture readnone %0) {
%2 = tail call i32 (...) @BUG()
ret void
}
/* Variables and functions */
uintptr_t SEXP_rawptr_bitmask(void *ptr, uintptr_t mask) {
  return ((uintptr_t)(ptr)) & mask;
}


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

x86 assembly (clang, -O2):
<SEXP_rawptr_bitmask>:
mov    %rdi,%rax
and    %rsi,%rax
ret

LLVM IR (-O0):
define i64 @SEXP_rawptr_bitmask(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = ptrtoint i8* %5 to i64
%7 = load i64, i64* %4
%8 = and i64 %6, %7
ret i64 %8
}

LLVM IR (-O2):
define i64 @SEXP_rawptr_bitmask(i8* %0, i64 %1) {
%3 = ptrtoint i8* %0 to i64
%4 = and i64 %3, %1
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i;
  for (i = 0; i < 5; i++) {
    printf("%d ", i);
    continue;
    printf("%d ", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    114d <main+0x3d>
mov    -0x8(%rbp),%esi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %9, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 5
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %6
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
store i32 %11, i32* %2
br label %3
12: ; preds = %3
ret i32 0
}

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

/* Variables and functions */
uint64_t str_hash(const char *string, char seed) {
  uint64_t h = 1125899906842597L;
  h = 31 * h + seed * h;
  const char *sp = string;
  while (*sp)
    h = 31 * h + *sp++;
  return h;
}


x86 assembly (clang, -O0):
<str_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movl   $0xffffffe5,-0x10(%rbp)
imul   $0x1f,-0x10(%rbp),%eax
movsbl -0x9(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     115b <str_hash+0x5b>
imul   $0x1f,-0x10(%rbp),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
jmp    112e <str_hash+0x2e>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_hash>:
imul   $0xffffffe5,%esi,%eax
add    $0xfffffcbb,%eax
mov    (%rdi),%cl
test   %cl,%cl
je     1137 <str_hash+0x37>
add    $0x1,%rdi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,%edx
shl    $0x5,%edx
sub    %eax,%edx
movsbl %cl,%eax
add    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1120 <str_hash+0x20>
ret

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

LLVM IR (-O2):
define i32 @str_hash(i8* nocapture %0, i8 signext %1) {
%3 = sext i8 %1 to i32
%4 = mul nsw i32 %3, -27
%5 = add nsw i32 %4, -837
%6 = load i8, i8* %0
%7 = icmp eq i8 %6, 0
br i1 %7, label %18, label %8
8: ; preds = %2, %8
%9 = phi i8 [ %16, %8 ], [ %6, %2 ]
%10 = phi i8* [ %13, %8 ], [ %0, %2 ]
%11 = phi i32 [ %15, %8 ], [ %5, %2 ]
%12 = mul nsw i32 %11, 31
%13 = getelementptr inbounds i8, i8* %10, i64 1
%14 = sext i8 %9 to i32
%15 = add nsw i32 %12, %14
%16 = load i8, i8* %13
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %8
18: ; preds = %8, %2
%19 = phi i32 [ %5, %2 ], [ %15, %8 ]
ret i32 %19
}
/* Type definitions */
struct passwd {
  int /*<<< orphan*/ pw_uid;
};

/* Variables and functions */
int /*<<< orphan*/ error(int, char *, char const *);
struct passwd *getpwnam(char const *);
int /*<<< orphan*/ setuid(int /*<<< orphan*/);
void change_uid(const char *username) {
  struct passwd *passwd;
  passwd = getpwnam(username);
  if (!passwd)
    error(2, "Couldn't get the UID for %s", username);
  setuid(passwd->pw_uid);
}


x86 assembly (clang, -O0):
<change_uid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getpwnam@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1169 <change_uid+0x39>
mov    -0x8(%rbp),%rdx
mov    $0x2,%edi
lea    0xe9c(%rip),%rsi
call   1040 <error@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1050 <setuid@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<change_uid>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <getpwnam@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1158 <change_uid+0x28>
lea    0xeb5(%rip),%rsi
mov    $0x2,%edi
mov    %r14,%rdx
call   1040 <error@plt>
mov    (%rbx),%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <setuid@plt>

LLVM IR (-O0):
%struct.passwd = type { i32 }
@.str = [28 x i8] c"Couldn't get the UID for %s\00"
define void @change_uid(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.passwd*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call %struct.passwd* @getpwnam(i8* %4)
store %struct.passwd* %5, %struct.passwd** %3
%6 = load %struct.passwd*, %struct.passwd** %3
%7 = icmp ne %struct.passwd* %6, null
br i1 %7, label %11, label %8
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i32 @error(i32 2, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %11
11: ; preds = %8, %1
%12 = load %struct.passwd*, %struct.passwd** %3
%13 = getelementptr inbounds %struct.passwd, %struct.passwd* %12, i32 0, i32 0
%14 = load i32, i32* %13
%15 = call i32 @setuid(i32 %14)
ret void
}

LLVM IR (-O2):
%struct.passwd = type { i32 }
@.str = [28 x i8] c"Couldn't get the UID for %s\00"
define void @change_uid(i8* %0) {
%2 = tail call %struct.passwd* @getpwnam(i8* %0)
%3 = icmp eq %struct.passwd* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @error(i32 2, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %6
6: ; preds = %4, %1
%7 = getelementptr inbounds %struct.passwd, %struct.passwd* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = tail call i32 @setuid(i32 %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ emitln(char *);
void popCompare() {
  emitln("pop\t%%ebx");
  emitln("cmp\t%%eax,%%ebx");
}


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

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

LLVM IR (-O0):
@.str = [10 x i8] c"pop\09%%ebx\00"
@.str.1 = [16 x i8] c"cmp\09%%eax,%%ebx\00"
define void @popCompare() {
%1 = call i32 @emitln(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @emitln(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"pop\09%%ebx\00"
@.str.1 = [16 x i8] c"cmp\09%%eax,%%ebx\00"
define void @popCompare() {
%1 = tail call i32 @emitln(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @emitln(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret void
}
unsigned __int128 foo(void) {
  unsigned __int128 a = 0xfffffffffffffffeULL;
  unsigned __int128 b = 0xffffffffffffffffULL;
  return a % b;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movq   $0x0,-0x18(%rbp)
movq   $0xfffffffffffffffe,-0x20(%rbp)
ff
movq   $0x0,-0x28(%rbp)
movq   $0xffffffffffffffff,-0x30(%rbp)
ff
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1160 <__umodti3>
mov    %rdx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x30,%rsp
pop    %rbp
ret
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)

x86 assembly (clang, -O2):
<foo>:
mov    $0xfffffffffffffffe,%rax
xor    %edx,%edx
ret

LLVM IR (-O0):
define { i64, i64 } @foo() {
%1 = alloca i128
%2 = alloca i128
%3 = alloca i128
store i128 18446744073709551614, i128* %2
store i128 18446744073709551615, i128* %3
%4 = load i128, i128* %2
%5 = load i128, i128* %3
%6 = urem i128 %4, %5
store i128 %6, i128* %1
%7 = bitcast i128* %1 to { i64, i64 }*
%8 = load { i64, i64 }, { i64, i64 }* %7
ret { i64, i64 } %8
}

LLVM IR (-O2):
define { i64, i64 } @foo() {
ret { i64, i64 } { i64 -2, i64 0 }
}
void XrmStringToQuark() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ switch_stack_asm3(struct task_info *, struct task_info *);
void switch_stack(struct task_info *task, struct task_info *prev_task) {
  switch_stack_asm3(task, prev_task);
}


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

x86 assembly (clang, -O2):
<switch_stack>:
jmp    1030 <switch_stack_asm3@plt>

LLVM IR (-O0):
%struct.task_info = type { i32 }
define void @switch_stack(%struct.task_info* %0, %struct.task_info* %1) {
%3 = alloca %struct.task_info*
%4 = alloca %struct.task_info*
store %struct.task_info* %0, %struct.task_info** %3
store %struct.task_info* %1, %struct.task_info** %4
%5 = load %struct.task_info*, %struct.task_info** %3
%6 = load %struct.task_info*, %struct.task_info** %4
%7 = call i32 @switch_stack_asm3(%struct.task_info* %5, %struct.task_info* %6)
ret void
}

LLVM IR (-O2):
%struct.task_info = type { i32 }
define void @switch_stack(%struct.task_info* %0, %struct.task_info* %1) {
%3 = tail call i32 @switch_stack_asm3(%struct.task_info* %0, %struct.task_info* %1)
ret void
}
OP(dd, cc) { op_cc(); }


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

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

LLVM IR (-O0):
define i32 @OP(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 (...) @op_cc()
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @op_cc()
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ console_print(char *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void show_prompt(void) {
  console_print("# ");
  fflush(stdout);
}


x86 assembly (clang, -O0):
<show_prompt>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <console_print@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_prompt>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <console_print@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"# \00"
@stdout = global i32 0
define void @show_prompt() {
%1 = call i32 @console_print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = call i32 @fflush(i32 %2)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"# \00"
@stdout = global i32 0
define void @show_prompt() {
%1 = tail call i32 @console_print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = tail call i32 @fflush(i32 %2)
ret void
}
void tests_delete_file(const char *file_name) {
  tests_test((unlink(file_name) != -1), __func__,
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/impedimentToProgress/UCI-BlueChip/refs/"
             "heads/master/snapgear_linux/user/mtd-utils/mtd-utils-1.2.0/tests/"
             "fs-tests/lib/tests.c",
             550);
  tests_sync_directory(file_name);
}


x86 assembly (clang, -O0):
<tests_delete_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <unlink@plt>
cmp    $0xffffffff,%eax
setne  %al
and    $0x1,%al
movzbl %al,%edi
lea    0xea7(%rip),%rsi
lea    0xeb2(%rip),%rdx
mov    $0x226,%ecx
mov    $0x0,%al
call   1050 <tests_test@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <tests_sync_directory@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tests_delete_file>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <unlink@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
setne  %dil
lea    0xeb5(%rip),%rsi
lea    0xec0(%rip),%rdx
mov    $0x226,%ecx
xor    %eax,%eax
call   1050 <tests_test@plt>
mov    %rbx,%rdi
xor    %eax,%eax
pop    %rbx
jmp    1040 <tests_sync_directory@plt>

LLVM IR (-O0):
@__func__.tests_delete_file = [18 x i8] c"tests_delete_file\00"
@.str = [215 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/impedimentToProgress/UCI-BlueChip/refs/heads/master/snapgear_linux/user/mtd-utils/mtd-utils-1.2.0/tests/fs-tests/lib/tests.c\00"
define void @tests_delete_file(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @unlink to i32 (i8*, ...)*)(i8* %3)
%5 = icmp ne i32 %4, -1
%6 = zext i1 %5 to i32
%7 = call i32 (i32, i8*, i8*, i32, ...) bitcast (i32 (...)* @tests_test to i32 (i32, i8*, i8*, i32, ...)*)(i32 %6, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__func__.tests_delete_file, i64 0, i64 0), i8* getelementptr inbounds ([215 x i8], [215 x i8]* @.str, i64 0, i64 0), i32 550)
%8 = load i8*, i8** %2
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @tests_sync_directory to i32 (i8*, ...)*)(i8* %8)
ret void
}

LLVM IR (-O2):
@__func__.tests_delete_file = [18 x i8] c"tests_delete_file\00"
@.str = [215 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/impedimentToProgress/UCI-BlueChip/refs/heads/master/snapgear_linux/user/mtd-utils/mtd-utils-1.2.0/tests/fs-tests/lib/tests.c\00"
define void @tests_delete_file(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @unlink to i32 (i8*, ...)*)(i8* %0)
%3 = icmp ne i32 %2, -1
%4 = zext i1 %3 to i32
%5 = tail call i32 (i32, i8*, i8*, i32, ...) bitcast (i32 (...)* @tests_test to i32 (i32, i8*, i8*, i32, ...)*)(i32 %4, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__func__.tests_delete_file, i64 0, i64 0), i8* getelementptr inbounds ([215 x i8], [215 x i8]* @.str, i64 0, i64 0), i32 550)
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @tests_sync_directory to i32 (i8*, ...)*)(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ errx(int /*<<< orphan*/, char *);
void handle_writev() { errx(EXIT_FAILURE, "sys_writev unimplemented"); }


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

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

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [25 x i8] c"sys_writev unimplemented\00"
define void @handle_writev() {
%1 = load i32, i32* @EXIT_FAILURE
%2 = call i32 @errx(i32 %1, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [25 x i8] c"sys_writev unimplemented\00"
define void @handle_writev() {
%1 = load i32, i32* @EXIT_FAILURE
%2 = tail call i32 @errx(i32 %1, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
float rastrigin(float, float);
float objective_function(float *p, void **extras) {
  float r;
  r = rastrigin(p[0], p[1]);
  return r;
}


x86 assembly (clang, -O0):
<objective_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm1
call   1030 <rastrigin@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<objective_function>:
movss  (%rdi),%xmm0
movss  0x4(%rdi),%xmm1
jmp    1030 <rastrigin@plt>

LLVM IR (-O0):
define float @objective_function(float* %0, i8** %1) {
%3 = alloca float*
%4 = alloca i8**
%5 = alloca float
store float* %0, float** %3
store i8** %1, i8*** %4
%6 = load float*, float** %3
%7 = getelementptr inbounds float, float* %6, i64 0
%8 = load float, float* %7
%9 = load float*, float** %3
%10 = getelementptr inbounds float, float* %9, i64 1
%11 = load float, float* %10
%12 = call float @rastrigin(float %8, float %11)
store float %12, float* %5
%13 = load float, float* %5
ret float %13
}

LLVM IR (-O2):
define float @objective_function(float* nocapture %0, i8** nocapture readnone %1) {
%3 = load float, float* %0
%4 = getelementptr inbounds float, float* %0, i64 1
%5 = load float, float* %4
%6 = tail call float @rastrigin(float %3, float %5)
ret float %6
}
/* Variables and functions */
int strlen(char *);
int verify_passwd(char *passwd) {
  return passwd == NULL || strlen(passwd) < 8 || strlen(passwd) > 63;
}


x86 assembly (clang, -O0):
<verify_passwd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%al
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     1157 <verify_passwd+0x47>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x8,%ecx
mov    %al,-0x9(%rbp)
jl     1157 <verify_passwd+0x47>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x3f,%eax
setg   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verify_passwd>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebp
test   %rdi,%rdi
je     113b <verify_passwd+0x2b>
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    $0x8,%eax
jl     113b <verify_passwd+0x2b>
mov    %rbx,%rdi
call   1030 <strlen@plt>
xor    %ebp,%ebp
cmp    $0x40,%eax
setge  %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @verify_passwd(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %13, label %5
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @strlen(i8* %6)
%8 = icmp slt i32 %7, 8
br i1 %8, label %13, label %9
9: ; preds = %5
%10 = load i8*, i8** %2
%11 = call i32 @strlen(i8* %10)
%12 = icmp sgt i32 %11, 63
br label %13
13: ; preds = %9, %5, %1
%14 = phi i1 [ true, %5 ], [ true, %1 ], [ %12, %9 ]
%15 = zext i1 %14 to i32
ret i32 %15
}

LLVM IR (-O2):
define i32 @verify_passwd(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = icmp slt i32 %4, 8
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = tail call i32 @strlen(i8* %0)
%8 = icmp sgt i32 %7, 63
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %3, %1
%11 = phi i32 [ 1, %3 ], [ 1, %1 ], [ %9, %6 ]
ret i32 %11
}