xunge/DecIR huggingface dataset:
double constrained_subtract(double t, double dt) {
  double t1 = t - dt;
  if (t1 < 0)
    return t / 2;
  if (t1 > 1)
    return (t + 1) / 2;
  return t1;
}


x86 assembly (clang, -O0):
<constrained_subtract>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1146 <constrained_subtract+0x46>
movsd  -0x10(%rbp),%xmm0
movsd  0xed0(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    118a <constrained_subtract+0x8a>
movsd  -0x20(%rbp),%xmm0
movsd  0xead(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1180 <constrained_subtract+0x80>
movsd  0xe9b(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  0xe96(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    118a <constrained_subtract+0x8a>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<constrained_subtract>:
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
xorpd  %xmm1,%xmm1
ucomisd %xmm2,%xmm1
ja     1124 <constrained_subtract+0x24>
ucomisd 0xee6(%rip),%xmm2
jbe    1130 <constrained_subtract+0x30>
addsd  0xedc(%rip),%xmm0
mulsd  0xedc(%rip),%xmm0
movapd %xmm0,%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @constrained_subtract(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
%7 = load double, double* %4
%8 = load double, double* %5
%9 = fsub double %7, %8
store double %9, double* %6
%10 = load double, double* %6
%11 = fcmp olt double %10, 0.000000e+00
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load double, double* %4
%14 = fdiv double %13, 2.000000e+00
store double %14, double* %3
br label %24
15: ; preds = %2
%16 = load double, double* %6
%17 = fcmp ogt double %16, 1.000000e+00
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load double, double* %4
%20 = fadd double %19, 1.000000e+00
%21 = fdiv double %20, 2.000000e+00
store double %21, double* %3
br label %24
22: ; preds = %15
%23 = load double, double* %6
store double %23, double* %3
br label %24
24: ; preds = %22, %18, %12
%25 = load double, double* %3
ret double %25
}

LLVM IR (-O2):
define double @constrained_subtract(double %0, double %1) {
%3 = fsub double %0, %1
%4 = fcmp olt double %3, 0.000000e+00
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = fmul double %0, 5.000000e-01
br label %12
7: ; preds = %2
%8 = fcmp ogt double %3, 1.000000e+00
br i1 %8, label %9, label %12
9: ; preds = %7
%10 = fadd double %0, 1.000000e+00
%11 = fmul double %10, 5.000000e-01
br label %12
12: ; preds = %7, %9, %5
%13 = phi double [ %6, %5 ], [ %11, %9 ], [ %3, %7 ]
ret double %13
}
/* Variables and functions */
int rand();
int RANDOM_Integer() { return rand(); }


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

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

LLVM IR (-O0):
define i32 @RANDOM_Integer() {
%1 = call i32 (...) @rand()
ret i32 %1
}

LLVM IR (-O2):
define i32 @RANDOM_Integer() {
%1 = tail call i32 (...) @rand()
ret i32 %1
}
/* Variables and functions */
char *malloc(size_t);
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char const *);
char *strdup(const char *str) {
  size_t n = strlen(str) + 1;
  char *dup = malloc(n * sizeof *dup);
  if (dup != NULL) {
    strcpy(dup, str);
  }
  return dup;
}


x86 assembly (clang, -O0):
<strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
shl    $0x0,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1177 <strdup+0x47>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
add    $0x1,%eax
movslq %eax,%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     115a <strdup+0x2a>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, 1
%8 = sext i32 %7 to i64
store i64 %8, i64* %3
%9 = load i64, i64* %3
%10 = mul i64 %9, 1
%11 = call i8* @malloc(i64 %10)
store i8* %11, i8** %4
%12 = load i8*, i8** %4
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %18
14: ; preds = %1
%15 = load i8*, i8** %4
%16 = load i8*, i8** %2
%17 = call i32 @strcpy(i8* %15, i8* %16)
br label %18
18: ; preds = %14, %1
%19 = load i8*, i8** %4
ret i8* %19
}

LLVM IR (-O2):
define i8* @strdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = sext i32 %3 to i64
%5 = tail call i8* @malloc(i64 %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32 @strcpy(i8* %5, i8* %0)
br label %9
9: ; preds = %7, %1
ret i8* %5
}
int f0(unsigned x) {
  switch (x) {
  default:
    x += 1;
  case 10 ... 0xFFFFFFFF:
    return 0;
  }
}


x86 assembly (clang, -O0):
<f0>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    111f <f0+0x1f>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret
mov    -0x8(%rbp),%eax
sub    $0xa,%eax
cmp    $0xfffffff5,%eax
jbe    111b <f0+0x1b>
jmp    1112 <f0+0x12>

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

LLVM IR (-O0):
define i32 @f0(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %8 [
]
4: ; preds = %8
%5 = load i32, i32* %2
%6 = add i32 %5, 1
store i32 %6, i32* %2
br label %7
7: ; preds = %8, %4
ret i32 0
8: ; preds = %1
%9 = sub i32 %3, 10
%10 = icmp ule i32 %9, -11
br i1 %10, label %7, label %4
}

LLVM IR (-O2):
define i32 @f0(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
double ubaci(int, int);
int main() {
  int n;
  int a;
  printf("Unesite n i a: ");
  scanf("%lf %d", &n, &a);
  printf("%f", ubaci(n, a));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <ubaci@plt>
lea    0xea4(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1040 <ubaci@plt>
lea    0xeb1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Unesite n i a: \00"
@.str.1 = [7 x i8] c"%lf %d\00"
@.str.2 = [3 x i8] c"%f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = call double @ubaci(i32 %6, i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), double %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"Unesite n i a: \00"
@.str.1 = [7 x i8] c"%lf %d\00"
@.str.2 = [3 x i8] c"%f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = call double @ubaci(i32 %7, i32 %8)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), double %9)
ret i32 0
}
void convert_document(void) {}


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

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

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

LLVM IR (-O2):
define void @convert_document() {
ret void
}
char *cpApgDescription() { return "APG - an ABNF Parser Generator"; }


x86 assembly (clang, -O0):
<cpApgDescription>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpApgDescription>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [31 x i8] c"APG - an ABNF Parser Generator\00"
define i8* @cpApgDescription() {
ret i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [31 x i8] c"APG - an ABNF Parser Generator\00"
define i8* @cpApgDescription() {
ret i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0)
}
int descending(int a, int b) { return a < b; }


x86 assembly (clang, -O0):
<descending>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<descending>:
xor    %eax,%eax
cmp    %esi,%edi
setl   %al
ret

LLVM IR (-O0):
define i32 @descending(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp slt i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @descending(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ get_random_bytes_arch(void *, int);
void get_random_bytes(void *buf, int nbytes) {
  get_random_bytes_arch(buf, nbytes);
}


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

x86 assembly (clang, -O2):
<get_random_bytes>:
jmp    1030 <get_random_bytes_arch@plt>

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

LLVM IR (-O2):
define void @get_random_bytes(i8* %0, i32 %1) {
%3 = tail call i32 @get_random_bytes_arch(i8* %0, i32 %1)
ret void
}
void gtk_drag_source_add_uri_targets() {}


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

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

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

LLVM IR (-O2):
define void @gtk_drag_source_add_uri_targets() {
ret void
}
void pokech(int row, int column, int ch, int color) {
  ((short *)0xb8000)[80 * (6 + row) + column] = (color << 8) | ch;
}


x86 assembly (clang, -O0):
<pokech>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
shl    $0x8,%eax
or     -0xc(%rbp),%eax
mov    %ax,%dx
mov    -0x4(%rbp),%eax
add    $0x6,%eax
imul   $0x50,%eax,%eax
add    -0x8(%rbp),%eax
movslq %eax,%rcx
mov    $0xb8000,%eax
mov    %dx,(%rax,%rcx,2)
pop    %rbp
ret

x86 assembly (clang, -O2):
<pokech>:
shl    $0x8,%ecx
or     %edx,%ecx
lea    (%rdi,%rdi,4),%eax
shl    $0x4,%eax
add    %esi,%eax
add    $0x1e0,%eax
cltq
mov    %cx,0xb8000(%rax,%rax,1)
ret

LLVM IR (-O0):
define void @pokech(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %8
%10 = shl i32 %9, 8
%11 = load i32, i32* %7
%12 = or i32 %10, %11
%13 = trunc i32 %12 to i16
%14 = load i32, i32* %5
%15 = add nsw i32 6, %14
%16 = mul nsw i32 80, %15
%17 = load i32, i32* %6
%18 = add nsw i32 %16, %17
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i16, i16* inttoptr (i64 753664 to i16*), i64 %19
store i16 %13, i16* %20
ret void
}

LLVM IR (-O2):
define void @pokech(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = shl i32 %3, 8
%6 = or i32 %5, %2
%7 = trunc i32 %6 to i16
%8 = mul i32 %0, 80
%9 = add i32 %8, 480
%10 = add nsw i32 %9, %1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i16, i16* inttoptr (i64 753664 to i16*), i64 %11
store i16 %7, i16* %12
ret void
}
void parse_http_content(struct TCPRECORD *sess, struct NetFrame *frame,
                        const unsigned char *px, unsigned length) {
  sess = (sess);
  frame = (frame);
  px = (px);
  length = (length);
}


x86 assembly (clang, -O0):
<parse_http_content>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.TCPRECORD = type opaque
%struct.NetFrame = type opaque
define void @parse_http_content(%struct.TCPRECORD* %0, %struct.NetFrame* %1, i8* %2, i32 %3) {
%5 = alloca %struct.TCPRECORD*
%6 = alloca %struct.NetFrame*
%7 = alloca i8*
%8 = alloca i32
store %struct.TCPRECORD* %0, %struct.TCPRECORD** %5
store %struct.NetFrame* %1, %struct.NetFrame** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load %struct.TCPRECORD*, %struct.TCPRECORD** %5
store %struct.TCPRECORD* %9, %struct.TCPRECORD** %5
%10 = load %struct.NetFrame*, %struct.NetFrame** %6
store %struct.NetFrame* %10, %struct.NetFrame** %6
%11 = load i8*, i8** %7
store i8* %11, i8** %7
%12 = load i32, i32* %8
store i32 %12, i32* %8
ret void
}

LLVM IR (-O2):
%struct.TCPRECORD = type opaque
%struct.NetFrame = type opaque
define void @parse_http_content(%struct.TCPRECORD* nocapture %0, %struct.NetFrame* nocapture %1, i8* nocapture %2, i32 %3) {
ret void
}
/* Variables and functions */
char *strcat(char *, char const *);
char *c_strcat(char *arg0, const char *arg1) { return strcat(arg0, arg1); }


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

x86 assembly (clang, -O2):
<c_strcat>:
jmp    1030 <strcat@plt>

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

LLVM IR (-O2):
define i8* @c_strcat(i8* returned %0, i8* nocapture %1) {
%3 = tail call i8* @strcat(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i8* %0
}
void EVP_DecodeBlock(void) {}


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

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

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

LLVM IR (-O2):
define void @EVP_DecodeBlock() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void comment(const char *what) { printf("%.80s", what); }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"%.80s\00"
define void @comment(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int pft_inode_unlink(struct inode *dir, struct dentry *dentry) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.inode = type opaque
%struct.dentry = type opaque
define i32 @pft_inode_unlink(%struct.inode* nocapture readnone %0, %struct.dentry* nocapture readnone %1) {
ret i32 0
}
void Swap(int *a, int *b) {
  int t;
  t = *a;
  *a = *b;
  *b = t;
}


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

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

LLVM IR (-O0):
define void @Swap(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 = load i32, i32* %6
store i32 %7, i32* %5
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = load i32*, i32** %3
store i32 %9, i32* %10
%11 = load i32, i32* %5
%12 = load i32*, i32** %4
store i32 %11, i32* %12
ret void
}

LLVM IR (-O2):
define void @Swap(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
store i32 %4, i32* %0
store i32 %3, i32* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ESRCH;
int /*<<< orphan*/ _exit(int);
int /*<<< orphan*/ errno;
int kill(int pid, int sig) {
  if (pid == 1) {
    _exit(sig);
  }
  errno = ESRCH;
  return -1;
}


x86 assembly (clang, -O0):
<kill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1130 <kill+0x20>
mov    -0x8(%rbp),%edi
call   1030 <_exit@plt>
mov    0x2e99(%rip),%rax
mov    (%rax),%ecx
mov    0x2ea0(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kill>:
push   %rax
cmp    $0x1,%edi
je     112f <kill+0x1f>
mov    0x2eb3(%rip),%rax
mov    (%rax),%eax
mov    0x2eba(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
pop    %rcx
ret
mov    %esi,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@ESRCH = global i32 0
@errno = global i32 0
define i32 @kill(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %4
%9 = call i32 @_exit(i32 %8)
unreachable
10: ; preds = %2
%11 = load i32, i32* @ESRCH
store i32 %11, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ESRCH = global i32 0
@errno = global i32 0
define i32 @kill(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @_exit(i32 %1)
unreachable
6: ; preds = %2
%7 = load i32, i32* @ESRCH
store i32 %7, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isspace(int);
void t_isspace_0x73() {
  Assert_real((isspace(115) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isspace.c",
              580, ("isspace should be 0 for s"));
}


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

x86 assembly (clang, -O2):
<t_isspace_0x73>:
push   %rax
mov    $0x73,%edi
call   1030 <isspace@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x244,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isspace.c\00"
@.str.1 = [26 x i8] c"isspace should be 0 for s\00"
define void @t_isspace_0x73() {
%1 = call i64 @isspace(i32 115)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 580, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isspace.c\00"
@.str.1 = [26 x i8] c"isspace should be 0 for s\00"
define void @t_isspace_0x73() {
%1 = tail call i64 @isspace(i32 115)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 580, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int f93(int *);
int f94(int *p) { return f93(p); }


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

x86 assembly (clang, -O2):
<f94>:
jmp    1030 <f93@plt>

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

LLVM IR (-O2):
define i32 @f94(i32* %0) {
%2 = tail call i32 @f93(i32* %0)
ret i32 %2
}
/* Variables and functions */
scalar_t__ ft_atoll(char const *);
long ft_atol(const char *str) { return ((long)(ft_atoll(str))); }


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

x86 assembly (clang, -O2):
<ft_atol>:
jmp    1030 <ft_atoll@plt>

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

LLVM IR (-O2):
define i64 @ft_atol(i8* %0) {
%2 = tail call i64 @ft_atoll(i8* %0)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ writebyte(unsigned short const);
void writeword(const unsigned short w) {
  writebyte(w >> 8);
  writebyte(w);
}


x86 assembly (clang, -O0):
<writeword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
sar    $0x8,%eax
movzwl %ax,%edi
call   1030 <writebyte@plt>
movzwl -0x2(%rbp),%edi
call   1030 <writebyte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeword>:
push   %rbx
mov    %edi,%ebx
shr    $0x8,%edi
call   1030 <writebyte@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <writebyte@plt>

LLVM IR (-O0):
define void @writeword(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = ashr i32 %4, 8
%6 = trunc i32 %5 to i16
%7 = call i32 @writebyte(i16 zeroext %6)
%8 = load i16, i16* %2
%9 = call i32 @writebyte(i16 zeroext %8)
ret void
}

LLVM IR (-O2):
define void @writeword(i16 zeroext %0) {
%2 = lshr i16 %0, 8
%3 = tail call i32 @writebyte(i16 zeroext %2)
%4 = tail call i32 @writebyte(i16 zeroext %0)
ret void
}
/* Variables and functions */
int largest(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int nums[10] = {5, 7, 80, 12, 30, 9, 4, 1, 10, 3};
  int larg = largest(nums, 10);
  printf("Largest: %d\n", larg);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1040 <largest@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%esi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0xef5(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebd(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xa,%esi
call   1040 <largest@plt>
lea    0xecd(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.nums = [10 x i32] [i32 5, i32 7, i32 80, i32 12, i32 30, i32 9, i32 4, i32 1, i32 10, i32 3]
@.str = [13 x i8] c"Largest: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [10 x i32]* %2 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%6 = call i32 @largest(i32* %5, i32 10)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@__const.main.nums = [10 x i32] [i32 5, i32 7, i32 80, i32 12, i32 30, i32 9, i32 4, i32 1, i32 10, i32 3]
@.str = [13 x i8] c"Largest: %d\0A\00"
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 @largest(i32* %3, i32 10)
%5 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char const *);
void pr(const char *s) { printf(s); }


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

x86 assembly (clang, -O2):
<pr>:
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
define void @pr(i8* nocapture %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) %0)
ret void
}
void validateint(int *p) {
  int res;
  asm("mov %%esp, %%ebx\n\t"
      "mov %3, %%esp\n\t"
      "int %2\n\t"
      "mov %%ebx, %%esp"
      : "=a"(res)
      : "a"(13), "n"(64), "c"(p)
      : "ebx");
}


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

LLVM IR (-O0):
LLVM IR (-O2):
define void @validateint(i32* nocapture %0) {
%2 = tail call i32 asm "mov %esp, %ebx\0A\09mov $3, %esp\0A\09int $2\0A\09mov %ebx, %esp", "={ax},{ax},n,{cx},~{ebx},~{dirflag},~{fpsr},~{flags}"(i32 13, i32 64, i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcatp(char *, char *);
int main(void) {
  char foo[80] = "This is amazing!";
  char *bar = " Pointers for everyone!";
  strcatp(foo, bar);
  printf("%s\n", foo);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x50,%edx
call   1050 <memcpy@plt>
lea    0xef5(%rip),%rax
mov    %rax,-0x68(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%rsi
call   1040 <strcatp@plt>
lea    -0x60(%rbp),%rsi
lea    0xef1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
movaps 0xf14(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xef8(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xedc(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xec0(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xea4(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xee9(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <strcatp@plt>
lea    0xeef(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.foo = [80 x i8] c"This is amazing!\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [24 x i8] c" Pointers for everyone!\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = alloca i8*
store i32 0, i32* %1
%4 = bitcast [80 x i8]* %2 to i8*
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8** %3
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%6 = load i8*, i8** %3
%7 = call i32 @strcatp(i8* %5, i8* %6)
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %8)
ret i32 0
}

LLVM IR (-O2):
@__const.main.foo = [80 x i8] c"This is amazing!\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [24 x i8] c" Pointers for everyone!\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcatp(i8* %2, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printData(int *cell, int counter) {
  int i;
  for (i = 0; i < counter; i++) {
    printf("%c", cell[i]);
  }
  printf("\n***END***\n");
}


x86 assembly (clang, -O0):
<printData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <printData+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printData+0x16>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printData>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1152 <printData+0x32>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,4),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1140 <printData+0x20>
lea    0xea7(%rip),%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <puts@plt>

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

LLVM IR (-O2):
@str = [11 x i8] c"\0A***END***\00"
define void @printData(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 @putchar(i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ buble_sort(int *, int);
int /*<<< orphan*/ print_array(int *, int, int, int);
int main(void) {
  int array[10] = {6, 3, 15, 5, 8, 2, 4, 9, 123, 1};
  print_array(array, 10, 5, -1);
  buble_sort(array, 10);
  print_array(array, 10, -1, -1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
mov    $0x5,%edx
mov    $0xffffffff,%ecx
call   1040 <print_array@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1030 <buble_sort@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
mov    $0xffffffff,%ecx
mov    %ecx,%edx
call   1040 <print_array@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    0xef4(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebc(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x5,%edx
mov    $0xffffffff,%ecx
call   1040 <print_array@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <buble_sort@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0xffffffff,%edx
mov    $0xffffffff,%ecx
call   1040 <print_array@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.array = [10 x i32] [i32 6, i32 3, i32 15, i32 5, i32 8, i32 2, i32 4, i32 9, i32 123, i32 1]
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
store i32 0, i32* %1
%3 = bitcast [10 x i32]* %2 to i8*
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%5 = call i32 @print_array(i32* %4, i32 10, i32 5, i32 -1)
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%7 = call i32 @buble_sort(i32* %6, i32 10)
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%9 = call i32 @print_array(i32* %8, i32 10, i32 -1, i32 -1)
ret i32 0
}

LLVM IR (-O2):
@__const.main.array = [10 x i32] [i32 6, i32 3, i32 15, i32 5, i32 8, i32 2, i32 4, i32 9, i32 123, i32 1]
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 @print_array(i32* %3, i32 10, i32 5, i32 -1)
%5 = call i32 @buble_sort(i32* %3, i32 10)
%6 = call i32 @print_array(i32* %3, i32 10, i32 -1, i32 -1)
ret i32 0
}
float tofloat(double d) { return (d); }


x86 assembly (clang, -O0):
<tofloat>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<tofloat>:
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @tofloat(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptrunc double %3 to float
ret float %4
}

LLVM IR (-O2):
define float @tofloat(double %0) {
%2 = fptrunc double %0 to float
ret float %2
}
/* Type definitions */
struct ms {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct ms *);
void ms_delete(struct ms *self) { free(self); }


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

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

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

LLVM IR (-O2):
%struct.ms = type { i32 }
define void @ms_delete(%struct.ms* nocapture %0) {
%2 = tail call i32 @free(%struct.ms* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ word;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  char *word = "google";
  printf("%d\n", sizeof(word));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 8)
ret i32 0
}
double fsub64(double x, double y) { return x - y; }


x86 assembly (clang, -O0):
<fsub64>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fsub64>:
subsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @fsub64(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 = fsub double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @fsub64(double %0, double %1) {
%3 = fsub double %0, %1
ret double %3
}
int ubx_sys(int ind) {
  switch (ind) {
  case 0:
    return 0x01;
  case 1:
    return 0x02;
  case 2:
    return 0x08;
  case 3:
    return 0x20;
  case 5:
    return 0x10;
  case 6:
    return 0x04;
  }
  return 0;
}


x86 assembly (clang, -O0):
<ubx_sys>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x6,%rax
ja     1174 <ubx_sys+0x74>
mov    -0x10(%rbp),%rax
lea    0xedd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x4(%rbp)
jmp    117b <ubx_sys+0x7b>
movl   $0x2,-0x4(%rbp)
jmp    117b <ubx_sys+0x7b>
movl   $0x8,-0x4(%rbp)
jmp    117b <ubx_sys+0x7b>
movl   $0x20,-0x4(%rbp)
jmp    117b <ubx_sys+0x7b>
movl   $0x10,-0x4(%rbp)
jmp    117b <ubx_sys+0x7b>
movl   $0x4,-0x4(%rbp)
jmp    117b <ubx_sys+0x7b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ubx_sys>:
xor    %eax,%eax
cmp    $0x6,%edi
ja     1114 <ubx_sys+0x14>
movslq %edi,%rax
lea    0xeef(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @ubx_sys(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %11 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
i32 3, label %8
i32 5, label %9
i32 6, label %10
]
5: ; preds = %1
store i32 1, i32* %2
br label %12
6: ; preds = %1
store i32 2, i32* %2
br label %12
7: ; preds = %1
store i32 8, i32* %2
br label %12
8: ; preds = %1
store i32 32, i32* %2
br label %12
9: ; preds = %1
store i32 16, i32* %2
br label %12
10: ; preds = %1
store i32 4, i32* %2
br label %12
11: ; preds = %1
store i32 0, i32* %2
br label %12
12: ; preds = %11, %10, %9, %8, %7, %6, %5
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@switch.table.ubx_sys = [7 x i32] [i32 1, i32 2, i32 8, i32 32, i32 0, i32 16, i32 4]
define i32 @ubx_sys(i32 %0) {
%2 = icmp ult i32 %0, 7
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = sext i32 %0 to i64
%5 = getelementptr inbounds [7 x i32], [7 x i32]* @switch.table.ubx_sys, i64 0, i64 %4
%6 = load i32, i32* %5
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ 0, %1 ]
ret i32 %8
}
float foo(float r1, float r2, float r3, float r4, float r5, float r6, float r7,
          float r8, float stack1, float stack2, float stack3) {
  return r1 + r2 + r3 + r4 + r5 + r6 + r7 + r8 + stack1 + stack2 + stack3;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
movss  0x20(%rbp),%xmm8
movss  0x18(%rbp),%xmm8
movss  0x10(%rbp),%xmm8
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  %xmm5,-0x18(%rbp)
movss  %xmm6,-0x1c(%rbp)
movss  %xmm7,-0x20(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
addss  0x10(%rbp),%xmm0
addss  0x18(%rbp),%xmm0
addss  0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
addss  %xmm1,%xmm0
addss  %xmm2,%xmm0
addss  %xmm3,%xmm0
addss  %xmm4,%xmm0
addss  %xmm5,%xmm0
addss  %xmm6,%xmm0
addss  %xmm7,%xmm0
addss  0x8(%rsp),%xmm0
addss  0x10(%rsp),%xmm0
addss  0x18(%rsp),%xmm0
ret

LLVM IR (-O0):
define float @foo(float %0, float %1, float %2, float %3, float %4, float %5, float %6, float %7, float %8, float %9, float %10) {
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca float
%19 = alloca float
%20 = alloca float
%21 = alloca float
%22 = alloca float
store float %0, float* %12
store float %1, float* %13
store float %2, float* %14
store float %3, float* %15
store float %4, float* %16
store float %5, float* %17
store float %6, float* %18
store float %7, float* %19
store float %8, float* %20
store float %9, float* %21
store float %10, float* %22
%23 = load float, float* %12
%24 = load float, float* %13
%25 = fadd float %23, %24
%26 = load float, float* %14
%27 = fadd float %25, %26
%28 = load float, float* %15
%29 = fadd float %27, %28
%30 = load float, float* %16
%31 = fadd float %29, %30
%32 = load float, float* %17
%33 = fadd float %31, %32
%34 = load float, float* %18
%35 = fadd float %33, %34
%36 = load float, float* %19
%37 = fadd float %35, %36
%38 = load float, float* %20
%39 = fadd float %37, %38
%40 = load float, float* %21
%41 = fadd float %39, %40
%42 = load float, float* %22
%43 = fadd float %41, %42
ret float %43
}

LLVM IR (-O2):
define float @foo(float %0, float %1, float %2, float %3, float %4, float %5, float %6, float %7, float %8, float %9, float %10) {
%12 = fadd float %0, %1
%13 = fadd float %12, %2
%14 = fadd float %13, %3
%15 = fadd float %14, %4
%16 = fadd float %15, %5
%17 = fadd float %16, %6
%18 = fadd float %17, %7
%19 = fadd float %18, %8
%20 = fadd float %19, %9
%21 = fadd float %20, %10
ret float %21
}
/* Type definitions */
struct netpbm_image {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ erode_1d_h(struct netpbm_image *, struct netpbm_image *);
int /*<<< orphan*/ erode_1d_v(struct netpbm_image *, struct netpbm_image *);
void erode(struct netpbm_image *img_in, struct netpbm_image *img_scratch,
           struct netpbm_image *img_out) {
  erode_1d_h(img_in, img_scratch);
  erode_1d_v(img_scratch, img_out);
}


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

x86 assembly (clang, -O2):
<erode>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
call   1040 <erode_1d_h@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <erode_1d_v@plt>

LLVM IR (-O0):
%struct.netpbm_image = type { i32 }
define void @erode(%struct.netpbm_image* %0, %struct.netpbm_image* %1, %struct.netpbm_image* %2) {
%4 = alloca %struct.netpbm_image*
%5 = alloca %struct.netpbm_image*
%6 = alloca %struct.netpbm_image*
store %struct.netpbm_image* %0, %struct.netpbm_image** %4
store %struct.netpbm_image* %1, %struct.netpbm_image** %5
store %struct.netpbm_image* %2, %struct.netpbm_image** %6
%7 = load %struct.netpbm_image*, %struct.netpbm_image** %4
%8 = load %struct.netpbm_image*, %struct.netpbm_image** %5
%9 = call i32 @erode_1d_h(%struct.netpbm_image* %7, %struct.netpbm_image* %8)
%10 = load %struct.netpbm_image*, %struct.netpbm_image** %5
%11 = load %struct.netpbm_image*, %struct.netpbm_image** %6
%12 = call i32 @erode_1d_v(%struct.netpbm_image* %10, %struct.netpbm_image* %11)
ret void
}

LLVM IR (-O2):
%struct.netpbm_image = type { i32 }
define void @erode(%struct.netpbm_image* %0, %struct.netpbm_image* %1, %struct.netpbm_image* %2) {
%4 = tail call i32 @erode_1d_h(%struct.netpbm_image* %0, %struct.netpbm_image* %1)
%5 = tail call i32 @erode_1d_v(%struct.netpbm_image* %1, %struct.netpbm_image* %2)
ret void
}
unsigned int roundUpSquaredHalf(unsigned int i) {
  return ((float)i / 2.0f + 0.5f);
}


x86 assembly (clang, -O0):
<roundUpSquaredHalf>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cvtsi2ss %rax,%xmm0
movss  0xee9(%rip),%xmm1
divss  %xmm1,%xmm0
movss  0xee1(%rip),%xmm1
addss  %xmm1,%xmm0
cvttss2si %xmm0,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<roundUpSquaredHalf>:
mov    %edi,%eax
cvtsi2ss %rax,%xmm0
movss  0xef1(%rip),%xmm1
mulss  %xmm1,%xmm0
addss  %xmm1,%xmm0
cvttss2si %xmm0,%rax
ret

LLVM IR (-O0):
define i32 @roundUpSquaredHalf(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = uitofp i32 %3 to float
%5 = fdiv float %4, 2.000000e+00
%6 = fadd float %5, 5.000000e-01
%7 = fptoui float %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @roundUpSquaredHalf(i32 %0) {
%2 = uitofp i32 %0 to float
%3 = fmul float %2, 5.000000e-01
%4 = fadd float %3, 5.000000e-01
%5 = fptoui float %4 to i32
ret i32 %5
}
/* Type definitions */
typedef int int16_t;

/* Variables and functions */
int cint100(int16_t d) { return (d + 50) / 100; }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x32,%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
add    $0x32,%edi
movslq %edi,%rax
imul   $0x51eb851f,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @cint100(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 50
%5 = sdiv i32 %4, 100
ret i32 %5
}

LLVM IR (-O2):
define i32 @cint100(i32 %0) {
%2 = add nsw i32 %0, 50
%3 = sdiv i32 %2, 100
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void free_disarm_function(void *ptr) {
  ({
    free(*(void **)ptr);
    *(void **)ptr = NULL;
  });
}


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

x86 assembly (clang, -O2):
<free_disarm_function>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <free@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @free_disarm_function(i8* nocapture %0) {
%2 = bitcast i8* %0 to i8**
%3 = load i8*, i8** %2
%4 = tail call i32 @free(i8* %3)
store i8* null, i8** %2
ret void
}