xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ lua_error(char *);
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *newstring(char *s) {
  char *ns = (char *)malloc(strlen(s) + 1);
  if (ns == 0)
    lua_error("not enough memory for new string");
  strcpy(ns, s);
  return ns;
}


x86 assembly (clang, -O0):
<newstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    117c <newstring+0x3c>
lea    0xe89(%rip),%rdi
call   1060 <lua_error@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<newstring>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1169 <newstring+0x29>
lea    0xe9c(%rip),%rdi
call   1060 <lua_error@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [33 x i8] c"not enough memory for new string\00"
define i8* @newstring(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i64 @malloc(i64 %6)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = call i32 @lua_error(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %1
%14 = load i8*, i8** %3
%15 = load i8*, i8** %2
%16 = call i32 @strcpy(i8* %14, i8* %15)
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
@.str = [33 x i8] c"not enough memory for new string\00"
define i8* @newstring(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i64 @malloc(i64 %3)
%5 = inttoptr i64 %4 to i8*
%6 = icmp eq i64 %4, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = tail call i32 @lua_error(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = tail call i32 @strcpy(i8* %5, i8* %0)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
scalar_t__ malloc(int);
int /*<<< orphan*/ stdin;
char *leer_entrada() {
  char *entrada_teclado = (char *)malloc(sizeof(char) * 1024);
  fgets(entrada_teclado, 1024, stdin);
  return entrada_teclado;
}


x86 assembly (clang, -O0):
<leer_entrada>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x400,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea7(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1030 <fgets@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<leer_entrada>:
push   %rbx
mov    $0x400,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    0x2eb3(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1030 <fgets@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
define i8* @leer_entrada() {
%1 = alloca i8*
%2 = call i64 @malloc(i32 1024)
%3 = inttoptr i64 %2 to i8*
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %4, i32 1024, i32 %5)
%7 = load i8*, i8** %1
ret i8* %7
}

LLVM IR (-O2):
@stdin = global i32 0
define i8* @leer_entrada() {
%1 = tail call i64 @malloc(i32 1024)
%2 = inttoptr i64 %1 to i8*
%3 = load i32, i32* @stdin
%4 = tail call i32 @fgets(i8* %2, i32 1024, i32 %3)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ m_free(int);
void ring_free(int r) { m_free(r); }


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

x86 assembly (clang, -O2):
<ring_free>:
jmp    1030 <m_free@plt>

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

LLVM IR (-O2):
define void @ring_free(i32 %0) {
%2 = tail call i32 @m_free(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print(int n) { printf("%d\n", n); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @print(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
double density(struct ent_medium *medium, struct ent_state *state,
               double *density) {
  *density = 2.65E+03;
  return 0.;
}


x86 assembly (clang, -O0):
<density>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsd  0xee4(%rip),%xmm0
movsd  %xmm0,(%rax)
xorps  %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<density>:
movabs $0x40a4b40000000000,%rax
b4 a4 40
mov    %rax,(%rdx)
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
%struct.ent_medium = type opaque
%struct.ent_state = type opaque
define double @density(%struct.ent_medium* %0, %struct.ent_state* %1, double* %2) {
%4 = alloca %struct.ent_medium*
%5 = alloca %struct.ent_state*
%6 = alloca double*
store %struct.ent_medium* %0, %struct.ent_medium** %4
store %struct.ent_state* %1, %struct.ent_state** %5
store double* %2, double** %6
%7 = load double*, double** %6
store double 2.650000e+03, double* %7
ret double 0.000000e+00
}

LLVM IR (-O2):
%struct.ent_medium = type opaque
%struct.ent_state = type opaque
define double @density(%struct.ent_medium* nocapture readnone %0, %struct.ent_state* nocapture readnone %1, double* nocapture writeonly %2) {
store double 2.650000e+03, double* %2
ret double 0.000000e+00
}
/* Variables and functions */
int /*<<< orphan*/ terminate();
unsigned __eh_find_caller(unsigned regbp, unsigned *pretaddr) {
  unsigned bp = *(unsigned *)regbp;
  if (bp) {
    if (bp <= regbp)
      terminate();
    *pretaddr = *(unsigned *)(regbp + sizeof(int));
  }
  return bp;
}


x86 assembly (clang, -O0):
<__eh_find_caller>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1150 <__eh_find_caller+0x40>
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
ja     1144 <__eh_find_caller+0x34>
mov    $0x0,%al
call   1030 <terminate@plt>
mov    -0x4(%rbp),%eax
mov    0x4(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__eh_find_caller>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
mov    (%rbx),%ebp
test   %ebp,%ebp
je     1130 <__eh_find_caller+0x20>
mov    %rsi,%r14
cmp    %edi,%ebp
ja     112a <__eh_find_caller+0x1a>
xor    %eax,%eax
call   1030 <terminate@plt>
mov    0x4(%rbx),%eax
mov    %eax,(%r14)
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @__eh_find_caller(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
%6 = load i32, i32* %3
%7 = zext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = load i32, i32* %8
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %25
12: ; preds = %2
%13 = load i32, i32* %5
%14 = load i32, i32* %3
%15 = icmp ule i32 %13, %14
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 (...) @terminate()
br label %18
18: ; preds = %16, %12
%19 = load i32, i32* %3
%20 = zext i32 %19 to i64
%21 = add i64 %20, 4
%22 = inttoptr i64 %21 to i32*
%23 = load i32, i32* %22
%24 = load i32*, i32** %4
store i32 %23, i32* %24
br label %25
25: ; preds = %18, %2
%26 = load i32, i32* %5
ret i32 %26
}

LLVM IR (-O2):
define i32 @__eh_find_caller(i32 %0, i32* nocapture writeonly %1) {
%3 = zext i32 %0 to i64
%4 = inttoptr i64 %3 to i32*
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 0
br i1 %6, label %15, label %7
7: ; preds = %2
%8 = icmp ugt i32 %5, %0
br i1 %8, label %11, label %9
9: ; preds = %7
%10 = tail call i32 (...) @terminate()
br label %11
11: ; preds = %9, %7
%12 = add nuw nsw i64 %3, 4
%13 = inttoptr i64 %12 to i32*
%14 = load i32, i32* %13
store i32 %14, i32* %1
br label %15
15: ; preds = %11, %2
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void db_free_k_v(void *key, void **value) {
  free(key);
  free(*value);
}


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

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

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

LLVM IR (-O2):
define void @db_free_k_v(i8* nocapture %0, i8** nocapture %1) {
%3 = tail call i32 @free(i8* %0)
%4 = load i8*, i8** %1
%5 = tail call i32 @free(i8* %4)
ret void
}
void initPaths(void) {}


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

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

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

LLVM IR (-O2):
define void @initPaths() {
ret void
}
int translate(char ch) {
  if (ch == '\n') {
    return 95;
  }
  return ((int)ch - (int)' ');
}


x86 assembly (clang, -O0):
<translate>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    1123 <translate+0x23>
movl   $0x5f,-0x4(%rbp)
jmp    112d <translate+0x2d>
movsbl -0x5(%rbp),%eax
sub    $0x20,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<translate>:
lea    -0x20(%rdi),%ecx
cmp    $0xa,%dil
mov    $0x5f,%eax
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @translate(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 eq i32 %5, 10
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 95, i32* %2
br label %12
8: ; preds = %1
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = sub nsw i32 %10, 32
store i32 %11, i32* %2
br label %12
12: ; preds = %8, %7
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @translate(i8 signext %0) {
%2 = icmp eq i8 %0, 10
%3 = sext i8 %0 to i32
%4 = add nsw i32 %3, -32
%5 = select i1 %2, i32 95, i32 %4
ret i32 %5
}
OP(dd, c6) { op_c6(); }


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_c6@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OP>:
xor    %eax,%eax
jmp    1030 <op_c6@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_c6()
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @op_c6()
ret i32 undef
}
/* Variables and functions */
int MakeServer(int);
int /*<<< orphan*/ accept(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int main() {
  int fd = MakeServer(100);
  accept(fd, NULL, NULL);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x64,%edi
call   1040 <MakeServer@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1030 <accept@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x64,%edi
call   1040 <MakeServer@plt>
mov    %eax,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <accept@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = call i32 @MakeServer(i32 100)
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @accept(i32 %3, i32* null, i32* null)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @MakeServer(i32 100)
%2 = tail call i32 @accept(i32 %1, i32* null, i32* null)
ret i32 0
}
struct A {
  int x[5];
  short n;
} f() {
  return (struct A){{1, 2, 3, 4, 5}, 5};
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,%rax
mov    0x2f12(%rip),%rcx
mov    %rcx,(%rdi)
mov    0x2f10(%rip),%rcx
mov    %rcx,0x8(%rdi)
mov    0x2f0e(%rip),%ecx
mov    %ecx,0x10(%rdi)
movw   $0x5,0x14(%rdi)
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
mov    %rdi,%rax
mov    0xf07(%rip),%ecx
mov    %ecx,0x10(%rdi)
movups 0xeed(%rip),%xmm0
movups %xmm0,(%rdi)
movw   $0x5,0x14(%rdi)
ret

LLVM IR (-O0):
%struct.A = type { [5 x i32], i16 }
@constinit = private global [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
define void @f(%struct.A* noalias sret(%struct.A) align 4 %0) {
%2 = getelementptr inbounds %struct.A, %struct.A* %0, i32 0, i32 0
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%4 = bitcast [5 x i32]* %2 to i8*
%5 = getelementptr inbounds %struct.A, %struct.A* %0, i32 0, i32 1
store i16 5, i16* %5
ret void
}

LLVM IR (-O2):
%struct.A = type { [5 x i32], i16 }
@constinit = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
define void @f(%struct.A* noalias nocapture writeonly sret(%struct.A) align 4 %0) {
%2 = bitcast %struct.A* %0 to i8*
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 dereferenceable(20) %2, i8* align 4 dereferenceable(20) bitcast ([5 x i32]* @constinit to i8*), i64 20, i1 false)
%3 = getelementptr inbounds %struct.A, %struct.A* %0, i64 0, i32 1
store i16 5, i16* %3
ret void
}
double max(double x, double y) { return (((x > y) ? x : y)); }


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    112d <max+0x2d>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1137 <max+0x37>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
maxsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @max(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp ogt double %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load double, double* %3
br label %12
10: ; preds = %2
%11 = load double, double* %4
br label %12
12: ; preds = %10, %8
%13 = phi double [ %9, %8 ], [ %11, %10 ]
ret double %13
}

LLVM IR (-O2):
define double @max(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
void d_putub(unsigned char *ptr, unsigned char data) { *ptr = data; }


x86 assembly (clang, -O0):
<d_putub>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_putub>:
mov    %sil,(%rdi)
ret

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

LLVM IR (-O2):
define void @d_putub(i8* nocapture writeonly %0, i8 zeroext %1) {
store i8 %1, i8* %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void _replace_uint32(void *a, void *b) {
  uint32_t *va;
  uint32_t *vb;
  va = (uint32_t *)a;
  vb = (uint32_t *)b;
  *va ^= *vb;
  *vb ^= *va;
  *va ^= *vb;
}


x86 assembly (clang, -O0):
<_replace_uint32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<_replace_uint32>:
mov    (%rdi),%eax
xor    (%rsi),%eax
mov    %eax,(%rdi)
xor    (%rsi),%eax
mov    %eax,(%rsi)
xor    %eax,(%rdi)
ret

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

LLVM IR (-O2):
define void @_replace_uint32(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = xor i32 %6, %5
store i32 %7, i32* %3
%8 = load i32, i32* %4
%9 = xor i32 %8, %7
store i32 %9, i32* %4
%10 = load i32, i32* %3
%11 = xor i32 %10, %9
store i32 %11, i32* %3
ret void
}
/* Variables and functions */
char *strim(char *);
__attribute__((always_)) char *strstrip(char *str) { return strim(str); }


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

x86 assembly (clang, -O2):
<strstrip>:
jmp    1030 <strim@plt>

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

LLVM IR (-O2):
define i8* @strstrip(i8* %0) {
%2 = tail call i8* @strim(i8* %0)
ret i8* %2
}
unsigned long __ffs(unsigned long word) {
  __asm__("bsfq %1,%0" : "=r"(word) : "rm"(word));
  return word;
}


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

x86 assembly (clang, -O2):
<__ffs>:
mov    %rdi,-0x8(%rsp)
bsf    -0x8(%rsp),%rax
ret

LLVM IR (-O0):
define i64 @__ffs(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 asm "bsfq $1,$0", "=r,rm,~{dirflag},~{fpsr},~{flags}"(i64 %3)
store i64 %4, i64* %2
%5 = load i64, i64* %2
ret i64 %5
}

LLVM IR (-O2):
define i64 @__ffs(i64 %0) {
%2 = tail call i64 asm "bsfq $1,$0", "=r,rm,~{dirflag},~{fpsr},~{flags}"(i64 %0)
ret i64 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t cblByteOrderSwap32LittleToHost(uint32_t swap) { return swap; }


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

x86 assembly (clang, -O2):
<cblByteOrderSwap32LittleToHost>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @cblByteOrderSwap32LittleToHost(i32 returned %0) {
ret i32 %0
}
int deco_vp_write(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @deco_vp_write() {
ret i32 0
}

LLVM IR (-O2):
define i32 @deco_vp_write() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ print_one();
int /*<<< orphan*/ print_two();
int main(void) {
  print_one();
  print_two();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @print_one()
%2 = tail call i32 (...) @print_two()
ret i32 0
}
signed int getSignedInt(char *ptr) {
  unsigned int sign = ptr[1] & 0x80;
  unsigned int val =
      (unsigned char)ptr[0] + (((unsigned int)(unsigned char)ptr[1]) << 8);
  return (sign) ? -(val ^ 0x8000) : val;
}


x86 assembly (clang, -O0):
<getSignedInt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
and    $0x80,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     114e <getSignedInt+0x4e>
mov    -0x10(%rbp),%ecx
xor    $0x8000,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x14(%rbp)
jmp    1154 <getSignedInt+0x54>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getSignedInt>:
movzbl 0x1(%rdi),%ecx
movzbl (%rdi),%eax
mov    %ecx,%edx
shl    $0x8,%edx
or     %eax,%edx
mov    %edx,%eax
xor    $0xffff7fff,%eax
add    $0x1,%eax
test   %cl,%cl
cmovns %edx,%eax
ret

LLVM IR (-O0):
define i32 @getSignedInt(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = and i32 %8, 128
store i32 %9, i32* %3
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 8
%19 = add i32 %13, %18
store i32 %19, i32* %4
%20 = load i32, i32* %3
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %1
%23 = load i32, i32* %4
%24 = xor i32 %23, 32768
%25 = sub i32 0, %24
br label %28
26: ; preds = %1
%27 = load i32, i32* %4
br label %28
28: ; preds = %26, %22
%29 = phi i32 [ %25, %22 ], [ %27, %26 ]
ret i32 %29
}

LLVM IR (-O2):
define i32 @getSignedInt(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = load i8, i8* %2
%4 = load i8, i8* %0
%5 = zext i8 %4 to i32
%6 = zext i8 %3 to i32
%7 = shl nuw nsw i32 %6, 8
%8 = or i32 %7, %5
%9 = icmp sgt i8 %3, -1
%10 = xor i32 %8, -32769
%11 = add nsw i32 %10, 1
%12 = select i1 %9, i32 %8, i32 %11
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ wczytaj(int *, int);
int /*<<< orphan*/ wypisz_odbiegajace(int *, int);
int /*<<< orphan*/ wypisz_srednia(int *, int);
int /*<<< orphan*/ wypisz_tab(int *, int);
int main(void) {
  int tab[10];
  wczytaj(tab, 10);
  wypisz_tab(tab, 10);
  wypisz_srednia(tab, 10);
  wypisz_odbiegajace(tab, 10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1040 <wczytaj@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1050 <wypisz_tab@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1030 <wypisz_srednia@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1060 <wypisz_odbiegajace@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <wczytaj@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <wypisz_tab@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <wypisz_srednia@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1060 <wypisz_odbiegajace@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
store i32 0, i32* %1
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%4 = call i32 @wczytaj(i32* %3, i32 10)
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%6 = call i32 @wypisz_tab(i32* %5, i32 10)
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%8 = call i32 @wypisz_srednia(i32* %7, i32 10)
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%10 = call i32 @wypisz_odbiegajace(i32* %9, i32 10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @wczytaj(i32* %3, i32 10)
%5 = call i32 @wypisz_tab(i32* %3, i32 10)
%6 = call i32 @wypisz_srednia(i32* %3, i32 10)
%7 = call i32 @wypisz_odbiegajace(i32* %3, i32 10)
ret i32 0
}
char foo1(char parameter_1) { return parameter_1; }


x86 assembly (clang, -O0):
<foo1>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo1>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define signext i8 @foo1(i8 returned signext %0) {
ret i8 %0
}
int Vec_StrSortCompare2(char *pp1, char *pp2) {
  if (*pp1 > *pp2)
    return -1;
  if (*pp1 < *pp2)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<Vec_StrSortCompare2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jle    112e <Vec_StrSortCompare2+0x2e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1157 <Vec_StrSortCompare2+0x57>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jge    1150 <Vec_StrSortCompare2+0x50>
movl   $0x1,-0x4(%rbp)
jmp    1157 <Vec_StrSortCompare2+0x57>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Vec_StrSortCompare2>:
mov    (%rdi),%al
xor    %ecx,%ecx
cmp    (%rsi),%al
setl   %cl
mov    $0xffffffff,%eax
cmovle %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @Vec_StrSortCompare2(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = icmp sgt i8 %3, %4
%6 = icmp slt i8 %3, %4
%7 = zext i1 %6 to i32
%8 = select i1 %5, i32 -1, i32 %7
ret i32 %8
}
/* Type definitions */
typedef int uint8_t;
typedef int const uint16_t;

/* Variables and functions */
uint16_t h264avcc_spsh_get_length(const uint8_t *p) {
  return (p[0] << 8) | p[1];
}


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

x86 assembly (clang, -O2):
<h264avcc_spsh_get_length>:
mov    (%rdi),%eax
shl    $0x8,%eax
or     0x4(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @h264avcc_spsh_get_length(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = shl i32 %5, 8
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 1
%9 = load i32, i32* %8
%10 = or i32 %6, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @h264avcc_spsh_get_length(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = shl i32 %2, 8
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = or i32 %3, %5
ret i32 %6
}
/* Variables and functions */
int read(int, char *, int);
int ReadPort(int fd, char *buf) {
  int res, i;
  ("---enter ReadPort---\n");
  i = 0;
  res = 0;
  res = read(fd, buf, 255);
  if (res < 0)
    return -1;
  if (res == 0)
    return -2;
  buf[res] = 0;
  return res;
}


x86 assembly (clang, -O0):
<ReadPort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0xff,%edx
call   1030 <read@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1157 <ReadPort+0x47>
movl   $0xffffffff,-0x4(%rbp)
jmp    117f <ReadPort+0x6f>
cmpl   $0x0,-0x14(%rbp)
jne    116d <ReadPort+0x5d>
movl   $0xfffffffe,-0x4(%rbp)
jmp    117f <ReadPort+0x6f>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadPort>:
push   %rbx
mov    %rsi,%rbx
mov    $0xff,%edx
call   1030 <read@plt>
test   %eax,%eax
js     112c <ReadPort+0x1c>
je     1133 <ReadPort+0x23>
mov    %eax,%ecx
movb   $0x0,(%rbx,%rcx,1)
pop    %rbx
ret
mov    $0xffffffff,%eax
pop    %rbx
ret
mov    $0xfffffffe,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"---enter ReadPort---\0A\00"
define i32 @ReadPort(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 0, i32* %7
store i32 0, i32* %6
%8 = load i32, i32* %4
%9 = load i8*, i8** %5
%10 = call i32 @read(i32 %8, i8* %9, i32 255)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 -1, i32* %3
br label %24
14: ; preds = %2
%15 = load i32, i32* %6
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %14
store i32 -2, i32* %3
br label %24
18: ; preds = %14
%19 = load i8*, i8** %5
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
store i8 0, i8* %22
%23 = load i32, i32* %6
store i32 %23, i32* %3
br label %24
24: ; preds = %18, %17, %13
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @ReadPort(i32 %0, i8* nocapture %1) {
%3 = tail call i32 @read(i32 %0, i8* %1, i32 255)
%4 = icmp slt i32 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = icmp eq i32 %3, 0
br i1 %6, label %10, label %7
7: ; preds = %5
%8 = zext i32 %3 to i64
%9 = getelementptr inbounds i8, i8* %1, i64 %8
store i8 0, i8* %9
br label %10
10: ; preds = %5, %2, %7
%11 = phi i32 [ %3, %7 ], [ -1, %2 ], [ -2, %5 ]
ret i32 %11
}
/* Variables and functions */
int digitsBaseTen(int);
int maxDigits(int x, int y) {
  int xDigits = digitsBaseTen(x);
  int yDigits = digitsBaseTen(y);
  return (xDigits > yDigits ? xDigits : yDigits);
}


x86 assembly (clang, -O0):
<maxDigits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <digitsBaseTen@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <digitsBaseTen@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    114b <maxDigits+0x3b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1151 <maxDigits+0x41>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<maxDigits>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
call   1030 <digitsBaseTen@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1030 <digitsBaseTen@plt>
cmp    %eax,%ebp
cmovg  %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @maxDigits(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = call i32 @digitsBaseTen(i32 %7)
store i32 %8, i32* %5
%9 = load i32, i32* %4
%10 = call i32 @digitsBaseTen(i32 %9)
store i32 %10, i32* %6
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = icmp sgt i32 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = load i32, i32* %5
br label %18
16: ; preds = %2
%17 = load i32, i32* %6
br label %18
18: ; preds = %16, %14
%19 = phi i32 [ %15, %14 ], [ %17, %16 ]
ret i32 %19
}

LLVM IR (-O2):
define i32 @maxDigits(i32 %0, i32 %1) {
%3 = tail call i32 @digitsBaseTen(i32 %0)
%4 = tail call i32 @digitsBaseTen(i32 %1)
%5 = icmp sgt i32 %3, %4
%6 = select i1 %5, i32 %3, i32 %4
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void usage() {
  printf("Greedy %s%s", "Version: 0.2.0", "\n");
  printf("Usage: greedy -[ht]\n");
  printf("  -h: Print help and exit\n");
  printf("  -t: Transparent background color\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xeea(%rip),%rsi
lea    0xf05(%rip),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [12 x i8] c"Greedy %s%s\00"
@.str.1 = [15 x i8] c"Version: 0.2.0\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [21 x i8] c"Usage: greedy -[ht]\0A\00"
@.str.4 = [27 x i8] c" -h: Print help and exit\0A\00"
@.str.5 = [36 x i8] c" -t: Transparent background color\0A\00"
define void @usage() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"Greedy %s%s\00"
@.str.1 = [15 x i8] c"Version: 0.2.0\00"
@.str.2 = [2 x i8] c"\0A\00"
@str = [20 x i8] c"Usage: greedy -[ht]\00"
@str.6 = [26 x i8] c" -h: Print help and exit\00"
@str.7 = [35 x i8] c" -t: Transparent background color\00"
define void @usage() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.6, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.7, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void deallocate(void *mem) {
  if (mem != 0)
    free(mem);
}


x86 assembly (clang, -O0):
<deallocate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <deallocate+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @deallocate(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
int isconsonent(char verify) {
  if (verify == 'a' || verify == 'e' || verify == 'i' || verify == 'o' ||
      verify == 'u')
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<isconsonent>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
je     114b <isconsonent+0x4b>
movsbl -0x5(%rbp),%eax
cmp    $0x65,%eax
je     114b <isconsonent+0x4b>
movsbl -0x5(%rbp),%eax
cmp    $0x69,%eax
je     114b <isconsonent+0x4b>
movsbl -0x5(%rbp),%eax
cmp    $0x6f,%eax
je     114b <isconsonent+0x4b>
movsbl -0x5(%rbp),%eax
cmp    $0x75,%eax
jne    1157 <isconsonent+0x57>
movl   $0x0,-0x4(%rbp)
jmp    115e <isconsonent+0x5e>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isconsonent>:
add    $0x9f,%dil
ror    %dil
mov    $0x1,%eax
cmp    $0xa,%dil
ja     1120 <isconsonent+0x20>
movsbq %dil,%rax
lea    0xee3(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @isconsonent(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 eq i32 %5, 97
br i1 %6, label %23, label %7
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 101
br i1 %10, label %23, label %11
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 105
br i1 %14, label %23, label %15
15: ; preds = %11
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 111
br i1 %18, label %23, label %19
19: ; preds = %15
%20 = load i8, i8* %3
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 117
br i1 %22, label %23, label %24
23: ; preds = %19, %15, %11, %7, %1
store i32 0, i32* %2
br label %25
24: ; preds = %19
store i32 1, i32* %2
br label %25
25: ; preds = %24, %23
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
@switch.table.isconsonent = [11 x i32] [i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 1, i32 1, i32 0]
define i32 @isconsonent(i8 signext %0) {
%2 = add i8 %0, -97
%3 = tail call i8 @llvm.fshl.i8(i8 %2, i8 %2, i8 7)
%4 = icmp ult i8 %3, 11
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = sext i8 %3 to i64
%7 = getelementptr inbounds [11 x i32], [11 x i32]* @switch.table.isconsonent, i64 0, i64 %6
%8 = load i32, i32* %7
br label %9
9: ; preds = %1, %5
%10 = phi i32 [ %8, %5 ], [ 1, %1 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ system(char *);
int x33_setup() {
  char cmd[256];
  sprintf(cmd,
          "iptables -A INPUT -p tcp -m multiport --sport 53,80 --tcp-flags "
          "SYN,ACK SYN,ACK -j NFQUEUE --queue-num %d",
          1);
  system(cmd);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [106 x i8] c"iptables -A INPUT -p tcp -m multiport --sport 53,80 --tcp-flags SYN,ACK SYN,ACK -j NFQUEUE --queue-num %d\00"
define i32 @x33_setup() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* getelementptr inbounds ([106 x i8], [106 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%5 = call i32 @system(i8* %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [106 x i8] c"iptables -A INPUT -p tcp -m multiport --sport 53,80 --tcp-flags SYN,ACK SYN,ACK -j NFQUEUE --queue-num %d\00"
define i32 @x33_setup() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([106 x i8], [106 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = call i32 @system(i8* %2)
ret i32 0
}
void use_cpu_supports_builtins(unsigned int *p) { p[0] = 0; }


x86 assembly (clang, -O0):
<use_cpu_supports_builtins>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<use_cpu_supports_builtins>:
movl   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define void @use_cpu_supports_builtins(i32* nocapture writeonly %0) {
store i32 0, i32* %0
ret void
}
void tr_del(void *addr) {}


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

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

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

LLVM IR (-O2):
define void @tr_del(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
scalar_t__ strncmp(char *, char const *, int /*<<< orphan*/);
signed char compareAndSkip(char **ptr, const char *str) {
  if (strncmp(*ptr, str, strlen(str)) == 0) {
    *ptr += strlen(str);
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<compareAndSkip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1189 <compareAndSkip+0x69>
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
movslq %edx,%rdx
add    %rdx,%rcx
mov    %rcx,(%rax)
movb   $0xff,-0x1(%rbp)
jmp    118d <compareAndSkip+0x6d>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compareAndSkip>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rdi),%r15
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     114c <compareAndSkip+0x2c>
xor    %eax,%eax
jmp    115b <compareAndSkip+0x3b>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
add    %rax,(%r14)
mov    $0xff,%al
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define signext i8 @compareAndSkip(i8** nocapture %0, i8* %1) {
%3 = load i8*, i8** %0
%4 = tail call i32 @strlen(i8* %1)
%5 = tail call i64 @strncmp(i8* %3, i8* %1, i32 %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = tail call i32 @strlen(i8* %1)
%9 = load i8*, i8** %0
%10 = sext i32 %8 to i64
%11 = getelementptr inbounds i8, i8* %9, i64 %10
store i8* %11, i8** %0
br label %12
12: ; preds = %2, %7
%13 = phi i8 [ -1, %7 ], [ 0, %2 ]
ret i8 %13
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char const *, size_t);
size_t unserialize_bytes(unsigned char const *in, size_t in_size,
                         unsigned char *out, size_t size) {
  if (in_size < size)
    return 0;
  if (out != NULL) {
    memcpy(out, in, size);
  }
  return size;
}


x86 assembly (clang, -O0):
<unserialize_bytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    1143 <unserialize_bytes+0x33>
movq   $0x0,-0x8(%rbp)
jmp    1167 <unserialize_bytes+0x57>
cmpq   $0x0,-0x20(%rbp)
je     115f <unserialize_bytes+0x4f>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unserialize_bytes>:
push   %rbx
cmp    %rcx,%rsi
jae    111a <unserialize_bytes+0xa>
xor    %ebx,%ebx
jmp    1133 <unserialize_bytes+0x23>
mov    %rcx,%rbx
test   %rdx,%rdx
je     1133 <unserialize_bytes+0x23>
mov    %rdi,%rax
mov    %rdx,%rdi
mov    %rax,%rsi
mov    %rbx,%rdx
call   1030 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i64 @unserialize_bytes(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = icmp ult i64 %1, %3
br i1 %5, label %10, label %6
6: ; preds = %4
%7 = icmp eq i8* %2, null
br i1 %7, label %10, label %8
8: ; preds = %6
%9 = tail call i32 @memcpy(i8* %2, i8* %0, i64 %3)
br label %10
10: ; preds = %6, %8, %4
%11 = phi i64 [ 0, %4 ], [ %3, %8 ], [ %3, %6 ]
ret i64 %11
}