xunge/DecIR huggingface dataset:
/* Variables and functions */
__attribute__((always_)) size_t _id(size_t x) { return x; }


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

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

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

LLVM IR (-O2):
define i64 @_id(i64 returned %0) {
ret i64 %0
}
int first_one012(unsigned int u0, unsigned int u1, unsigned int u2) {
  if (u0) {
    return __builtin_clz(u0) - 5;
  }
  if (u1) {
    return __builtin_clz(u1) + 22;
  }
  return __builtin_clz(u2) + 49;
}


x86 assembly (clang, -O0):
<first_one012>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112b <first_one012+0x2b>
mov    -0x8(%rbp),%eax
bsr    %eax,%eax
xor    $0x1f,%eax
sub    $0x5,%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <first_one012+0x58>
cmpl   $0x0,-0xc(%rbp)
je     1149 <first_one012+0x49>
mov    -0xc(%rbp),%eax
bsr    %eax,%eax
xor    $0x1f,%eax
add    $0x16,%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <first_one012+0x58>
mov    -0x10(%rbp),%eax
bsr    %eax,%eax
xor    $0x1f,%eax
add    $0x31,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<first_one012>:
test   %esi,%esi
cmovne %esi,%edx
mov    $0x31,%eax
mov    $0x16,%ecx
cmove  %eax,%ecx
test   %edi,%edi
cmovne %edi,%edx
mov    $0xfffffffb,%esi
cmove  %ecx,%esi
bsr    %edx,%eax
xor    $0x1f,%eax
add    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @first_one012(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 0
%5 = icmp eq i32 %1, 0
%6 = select i1 %5, i32 %2, i32 %1
%7 = select i1 %5, i32 49, i32 22
%8 = select i1 %4, i32 %6, i32 %0
%9 = select i1 %4, i32 %7, i32 -5
%10 = tail call i32 @llvm.ctlz.i32(i32 %8, i1 true)
%11 = add nsw i32 %10, %9
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ maxheapify(int *, int, int);
void build_maxheap(int a[], int n) {
  int i;
  for (i = n / 2; i > 0; i--) {
    maxheapify(a, i, n);
  }
  return;
}


x86 assembly (clang, -O0):
<build_maxheap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    1154 <build_maxheap+0x44>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <maxheapify@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <build_maxheap+0x1d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_maxheap>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x2,%esi
jl     1146 <build_maxheap+0x36>
mov    %esi,%ebp
mov    %rdi,%r14
mov    %esi,%ebx
shr    %ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1030 <maxheapify@plt>
lea    -0x1(%rbx),%eax
cmp    $0x1,%ebx
mov    %eax,%ebx
ja     1130 <build_maxheap+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @build_maxheap(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* %4
%7 = sdiv i32 %6, 2
store i32 %7, i32* %5
br label %8
8: ; preds = %16, %2
%9 = load i32, i32* %5
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %19
11: ; preds = %8
%12 = load i32*, i32** %3
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = call i32 @maxheapify(i32* %12, i32 %13, i32 %14)
br label %16
16: ; preds = %11
%17 = load i32, i32* %5
%18 = add nsw i32 %17, -1
store i32 %18, i32* %5
br label %8
19: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @build_maxheap(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = lshr i32 %1, 1
br label %6
6: ; preds = %4, %6
%7 = phi i32 [ %9, %6 ], [ %5, %4 ]
%8 = tail call i32 @maxheapify(i32* %0, i32 %7, i32 %1)
%9 = add nsw i32 %7, -1
%10 = icmp ugt i32 %7, 1
br i1 %10, label %6, label %11
11: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int open(char *, int /*<<< orphan*/);
int openfile(char *fn) { return open(fn, O_RDONLY); }


x86 assembly (clang, -O0):
<openfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<openfile>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
jmp    1030 <open@plt>

LLVM IR (-O0):
@O_RDONLY = global i32 0
define i32 @openfile(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @O_RDONLY
%5 = call i32 @open(i8* %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
define i32 @openfile(i8* nocapture %0) {
%2 = load i32, i32* @O_RDONLY
%3 = tail call i32 @open(i8* %0, i32 %2)
ret i32 %3
}
void SobelToPlaneRow_SSE2() {}


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

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

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

LLVM IR (-O2):
define void @SobelToPlaneRow_SSE2() {
ret void
}
int ti_stderr_start(double const *options) { return (int)options[0] - 1; }


x86 assembly (clang, -O0):
<ti_stderr_start>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cvttsd2si (%rax),%eax
sub    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ti_stderr_start>:
cvttsd2si (%rdi),%eax
add    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @ti_stderr_start(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = getelementptr inbounds double, double* %3, i64 0
%5 = load double, double* %4
%6 = fptosi double %5 to i32
%7 = sub nsw i32 %6, 1
ret i32 %7
}

LLVM IR (-O2):
define i32 @ti_stderr_start(double* nocapture %0) {
%2 = load double, double* %0
%3 = fptosi double %2 to i32
%4 = add nsw i32 %3, -1
ret i32 %4
}
double eq(double a, double b, double eps) {
  double diff = a - b;
  diff = diff > 0 ? diff : -diff;
  return diff < eps;
}


x86 assembly (clang, -O0):
<eq>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1143 <eq+0x43>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1164 <eq+0x64>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
cvtsi2sd %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<eq>:
subsd  %xmm1,%xmm0
movapd 0xef4(%rip),%xmm1
xorpd  %xmm0,%xmm1
xorpd  %xmm3,%xmm3
cmpltsd %xmm0,%xmm3
andpd  %xmm3,%xmm0
andnpd %xmm1,%xmm3
orpd   %xmm3,%xmm0
cmpltsd %xmm2,%xmm0
movsd  0xede(%rip),%xmm1
andpd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @eq(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%8 = load double, double* %4
%9 = load double, double* %5
%10 = fsub double %8, %9
store double %10, double* %7
%11 = load double, double* %7
%12 = fcmp ogt double %11, 0.000000e+00
br i1 %12, label %13, label %15
13: ; preds = %3
%14 = load double, double* %7
br label %18
15: ; preds = %3
%16 = load double, double* %7
%17 = fneg double %16
br label %18
18: ; preds = %15, %13
%19 = phi double [ %14, %13 ], [ %17, %15 ]
store double %19, double* %7
%20 = load double, double* %7
%21 = load double, double* %6
%22 = fcmp olt double %20, %21
%23 = zext i1 %22 to i32
%24 = sitofp i32 %23 to double
ret double %24
}

LLVM IR (-O2):
define double @eq(double %0, double %1, double %2) {
%4 = fsub double %0, %1
%5 = fcmp ogt double %4, 0.000000e+00
%6 = fneg double %4
%7 = select i1 %5, double %4, double %6
%8 = fcmp olt double %7, %2
%9 = uitofp i1 %8 to double
ret double %9
}
/* Variables and functions */
int get_shnodep_value();
__attribute__((visibility("default"))) int get_shshdep_value(void) {
  return get_shnodep_value();
}


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

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

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

LLVM IR (-O2):
define i32 @get_shshdep_value() {
%1 = tail call i32 (...) @get_shnodep_value()
ret i32 %1
}
int is_alpha(c)
char c;
{
  return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c == '_') ||
          (c >= '0' && c <= '9'));
}


x86 assembly (clang, -O0):
<is_alpha>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     1129 <is_alpha+0x29>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x5a,%ecx
mov    %al,-0x2(%rbp)
jle    117f <is_alpha+0x7f>
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jl     1148 <is_alpha+0x48>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x7a,%ecx
mov    %al,-0x2(%rbp)
jle    117f <is_alpha+0x7f>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x5f,%ecx
mov    %al,-0x2(%rbp)
je     117f <is_alpha+0x7f>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x3(%rbp)
jl     1179 <is_alpha+0x79>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_alpha>:
shl    $0x18,%edi
lea    -0x40000001(%rdi),%ecx
mov    $0x1,%eax
cmp    $0x1affffff,%ecx
jb     113d <is_alpha+0x3d>
cmp    $0x5f000000,%edi
je     113d <is_alpha+0x3d>
lea    -0x60000001(%rdi),%ecx
cmp    $0x1affffff,%ecx
jb     113d <is_alpha+0x3d>
add    $0xd0ffffff,%edi
xor    %eax,%eax
cmp    $0xaffffff,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @is_alpha(i32 %0) {
%2 = alloca i8
%3 = trunc i32 %0 to i8
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 65
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 90
br i1 %10, label %33, label %11
11: ; preds = %7, %1
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
%14 = icmp sge i32 %13, 97
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = load i8, i8* %2
%17 = sext i8 %16 to i32
%18 = icmp sle i32 %17, 122
br i1 %18, label %33, label %19
19: ; preds = %15, %11
%20 = load i8, i8* %2
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 95
br i1 %22, label %33, label %23
23: ; preds = %19
%24 = load i8, i8* %2
%25 = sext i8 %24 to i32
%26 = icmp sge i32 %25, 48
br i1 %26, label %27, label %31
27: ; preds = %23
%28 = load i8, i8* %2
%29 = sext i8 %28 to i32
%30 = icmp sle i32 %29, 57
br label %31
31: ; preds = %27, %23
%32 = phi i1 [ false, %23 ], [ %30, %27 ]
br label %33
33: ; preds = %31, %19, %15, %7
%34 = phi i1 [ true, %19 ], [ true, %15 ], [ true, %7 ], [ %32, %31 ]
%35 = zext i1 %34 to i32
ret i32 %35
}

LLVM IR (-O2):
define i32 @is_alpha(i32 %0) {
%2 = shl i32 %0, 24
%3 = add i32 %2, -1073741825
%4 = icmp ult i32 %3, 452984831
br i1 %4, label %14, label %5
5: ; preds = %1
%6 = add i32 %2, -1610612737
%7 = icmp ult i32 %6, 452984831
%8 = icmp eq i32 %2, 1593835520
%9 = or i1 %8, %7
br i1 %9, label %14, label %10
10: ; preds = %5
%11 = add i32 %2, -788529153
%12 = icmp ult i32 %11, 184549375
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %5, %1, %10
%15 = phi i32 [ %13, %10 ], [ 1, %1 ], [ 1, %5 ]
ret i32 %15
}
int test_leading_extension() {
  __extension__(*(char *)0) = 1;
  return 0;
}


x86 assembly (clang, -O0):
<test_leading_extension>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
movb   $0x1,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define i32 @test_leading_extension() {
store i8 1, i8* null
ret i32 0
}

LLVM IR (-O2):
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void usage(int rc) {
  printf("usage: tikitank [-hvd][-p PORT][-l LOGPATH]\n");
  exit(rc);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [45 x i8] c"usage: tikitank [-hvd][-p PORT][-l LOGPATH]\0A\00"
define void @usage(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = call i32 @exit(i32 %4)
unreachable
}

LLVM IR (-O2):
@str = [44 x i8] c"usage: tikitank [-hvd][-p PORT][-l LOGPATH]\00"
define void @usage(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 %0)
unreachable
}
int write(int fd, char *ptr, unsigned len) { return len; }


x86 assembly (clang, -O0):
<write>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<write>:
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @write(i32 %0, i8* nocapture readnone %1, i32 returned %2) {
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ core4_print(char *, char const *);
void U_EMRELLIPSE_print(const char *contents) {
  core4_print("U_EMRELLIPSE", contents);
}


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

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

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

LLVM IR (-O2):
@.str = [13 x i8] c"U_EMRELLIPSE\00"
define void @U_EMRELLIPSE_print(i8* %0) {
%2 = tail call i32 @core4_print(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
char *strsignal(int);
void catch (int sig) { printf("Dostałem sygnał >>%s<<\n", strsignal(sig)); }


x86 assembly (clang, -O0):
<catch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <strsignal@plt>
mov    %rax,%rsi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<catch>:
push   %rax
call   1040 <strsignal@plt>
lea    0xed3(%rip),%rdi
mov    %rax,%rsi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"Dosta\C5\82em sygna\C5\82 >>%s<<\0A\00"
define void @catch(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i8* @strsignal(i32 %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"Dosta\C5\82em sygna\C5\82 >>%s<<\0A\00"
define void @catch(i32 %0) {
%2 = tail call i8* @strsignal(i32 %0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void aprint(char **in) {
  int i;
  for (i = 0; in[i]; i++) {
    printf("%s\n", in[i]);
  }
}


x86 assembly (clang, -O0):
<aprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     115c <aprint+0x4c>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <aprint+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aprint>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%rsi
test   %rsi,%rsi
je     1144 <aprint+0x34>
mov    %rdi,%rbx
add    $0x8,%rbx
lea    0xed6(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1130 <aprint+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @aprint(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %10, %4 ], [ %2, %1 ]
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = add nuw i64 %5, 1
%9 = getelementptr inbounds i8*, i8** %0, i64 %8
%10 = load i8*, i8** %9
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void cfree(void *mem) { free(mem); }


x86 assembly (clang, -O0):
<cfree>:
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):
<cfree>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @cfree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
scalar_t__ is_ws(char const);
const char *skip_ws(const char *p) {
  if (p) {
    while (is_ws(*p))
      p++;
  }
  return p;
}


x86 assembly (clang, -O0):
<skip_ws>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1158 <skip_ws+0x48>
jmp    112c <skip_ws+0x1c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <is_ws@plt>
cmp    $0x0,%rax
je     1153 <skip_ws+0x43>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    112c <skip_ws+0x1c>
jmp    1158 <skip_ws+0x48>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_ws>:
push   %rbx
test   %rdi,%rdi
je     1134 <skip_ws+0x24>
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rbx
nopl   (%rax)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <is_ws@plt>
test   %rax,%rax
jne    1120 <skip_ws+0x10>
jmp    1136 <skip_ws+0x26>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @skip_ws(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 %15
5: ; preds = %1
br label %6
6: ; preds = %11, %5
%7 = load i8*, i8** %2
%8 = load i8, i8* %7
%9 = call i64 @is_ws(i8 signext %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %6
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %2
br label %6
14: ; preds = %6
br label %15
15: ; preds = %14, %1
%16 = load i8*, i8** %2
ret i8* %16
}

LLVM IR (-O2):
define i8* @skip_ws(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i8* [ %8, %3 ], [ %0, %1 ]
%5 = load i8, i8* %4
%6 = tail call i64 @is_ws(i8 signext %5)
%7 = icmp eq i64 %6, 0
%8 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %7, label %9, label %3
9: ; preds = %3, %1
%10 = phi i8* [ null, %1 ], [ %4, %3 ]
ret i8* %10
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ my_putstr2(char *);
void error_read(int rid) {
  if (rid <= 0) {
    my_putstr2("\nError : Your read  didn't work and return 0 ");
    my_putstr2("This is why the program have stopped of himself\n\n");
    exit(-1);
  }
}


x86 assembly (clang, -O0):
<error_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     1157 <error_read+0x37>
lea    0xec4(%rip),%rdi
call   1030 <my_putstr2@plt>
lea    0xee6(%rip),%rdi
call   1030 <my_putstr2@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error_read>:
test   %edi,%edi
jle    1125 <error_read+0x5>
ret
push   %rax
lea    0xed3(%rip),%rdi
call   1030 <my_putstr2@plt>
lea    0xef5(%rip),%rdi
call   1030 <my_putstr2@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [46 x i8] c"\0AError : Your read didn't work and return 0 \00"
@.str.1 = [50 x i8] c"This is why the program have stopped of himself\0A\0A\00"
define void @error_read(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sle i32 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = call i32 @my_putstr2(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @my_putstr2(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @exit(i32 -1)
unreachable
9: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [46 x i8] c"\0AError : Your read didn't work and return 0 \00"
@.str.1 = [50 x i8] c"This is why the program have stopped of himself\0A\0A\00"
define void @error_read(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = tail call i32 @my_putstr2(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @my_putstr2(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @exit(i32 -1)
unreachable
7: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ C67_asm(char *, int, int /*<<< orphan*/, int /*<<< orphan*/);
void C67_POP(int r) { C67_asm("LDW.D SP PRE INC", r, 0, 0); }


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

x86 assembly (clang, -O2):
<C67_POP>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <C67_asm@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"LDW.D SP PRE INC\00"
define void @C67_POP(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @C67_asm(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %3, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"LDW.D SP PRE INC\00"
define void @C67_POP(i32 %0) {
%2 = tail call i32 @C67_asm(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %0, i32 0, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ japi_drawscaledimage(int, int, int, int, int, int, int, int,
                                        int, int);
void j_drawscaledimage(int arg0, int arg1, int arg2, int arg3, int arg4,
                       int arg5, int arg6, int arg7, int arg8, int arg9) {
  japi_drawscaledimage(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8,
                       arg9);
}


x86 assembly (clang, -O0):
<j_drawscaledimage>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x38,%rsp
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x20(%rbp),%r9d
mov    0x10(%rbp),%ebx
mov    0x18(%rbp),%r11d
mov    0x20(%rbp),%r10d
mov    0x28(%rbp),%eax
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1030 <japi_drawscaledimage@plt>
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<j_drawscaledimage>:
jmp    1030 <japi_drawscaledimage@plt>

LLVM IR (-O0):
define void @j_drawscaledimage(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9) {
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
store i32 %0, i32* %11
store i32 %1, i32* %12
store i32 %2, i32* %13
store i32 %3, i32* %14
store i32 %4, i32* %15
store i32 %5, i32* %16
store i32 %6, i32* %17
store i32 %7, i32* %18
store i32 %8, i32* %19
store i32 %9, i32* %20
%21 = load i32, i32* %11
%22 = load i32, i32* %12
%23 = load i32, i32* %13
%24 = load i32, i32* %14
%25 = load i32, i32* %15
%26 = load i32, i32* %16
%27 = load i32, i32* %17
%28 = load i32, i32* %18
%29 = load i32, i32* %19
%30 = load i32, i32* %20
%31 = call i32 @japi_drawscaledimage(i32 %21, i32 %22, i32 %23, i32 %24, i32 %25, i32 %26, i32 %27, i32 %28, i32 %29, i32 %30)
ret void
}

LLVM IR (-O2):
define void @j_drawscaledimage(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9) {
%11 = tail call i32 @japi_drawscaledimage(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9)
ret void
}
int sys_lseek(int file, int off, int dir) { return 0; }


x86 assembly (clang, -O0):
<sys_lseek>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @sys_lseek(i32 %0, i32 %1, i32 %2) {
ret i32 0
}
/* Variables and functions */
int RAND_MAX;
int rand();
int roll(void) {
  int c;
  while ((c = rand()) > RAND_MAX - (RAND_MAX % 6) - 1)
    ;
  c /= (RAND_MAX - (RAND_MAX % 6)) / 6;
  return (++c);
}


x86 assembly (clang, -O0):
<roll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,-0x8(%rbp)
mov    %eax,-0x4(%rbp)
mov    0x2ebc(%rip),%rax
mov    (%rax),%ecx
mov    0x2eb3(%rip),%rax
mov    (%rax),%eax
mov    $0x6,%esi
cltd
idiv   %esi
mov    -0x8(%rbp),%eax
sub    %edx,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jle    1154 <roll+0x44>
jmp    1118 <roll+0x8>
mov    0x2e8d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    0x2e81(%rip),%rax
mov    (%rax),%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
mov    -0xc(%rbp),%eax
sub    %edx,%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<roll>:
push   %rbx
mov    0x2ed0(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <rand@plt>
movslq (%rbx),%rcx
imul   $0x2aaaaaab,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,1),%edx
lea    (%rdx,%rdx,2),%edx
cmp    %edx,%eax
jge    1120 <roll+0x10>
cltd
idiv   %ecx
add    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@RAND_MAX = global i32 0
define i32 @roll() {
%1 = alloca i32
br label %2
2: ; preds = %10, %0
%3 = call i32 (...) @rand()
store i32 %3, i32* %1
%4 = load i32, i32* @RAND_MAX
%5 = load i32, i32* @RAND_MAX
%6 = srem i32 %5, 6
%7 = sub nsw i32 %4, %6
%8 = sub nsw i32 %7, 1
%9 = icmp sgt i32 %3, %8
br i1 %9, label %10, label %11
10: ; preds = %2
br label %2
11: ; preds = %2
%12 = load i32, i32* @RAND_MAX
%13 = load i32, i32* @RAND_MAX
%14 = srem i32 %13, 6
%15 = sub nsw i32 %12, %14
%16 = sdiv i32 %15, 6
%17 = load i32, i32* %1
%18 = sdiv i32 %17, %16
store i32 %18, i32* %1
%19 = load i32, i32* %1
%20 = add nsw i32 %19, 1
store i32 %20, i32* %1
ret i32 %20
}

LLVM IR (-O2):
@RAND_MAX = global i32 0
define i32 @roll() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (...) @rand()
%3 = load i32, i32* @RAND_MAX
%4 = srem i32 %3, 6
%5 = sdiv i32 %3, 6
%6 = sub nsw i32 %3, %4
%7 = icmp slt i32 %2, %6
br i1 %7, label %8, label %1
8: ; preds = %1
%9 = sdiv i32 %2, %5
%10 = add nsw i32 %9, 1
ret i32 %10
}
int sum_digits(int num) {
  int result;
  result = 0;
  while (num > 0) {
    result += num % 10;
    num /= 10;
  }
  return result;
}


x86 assembly (clang, -O0):
<sum_digits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    113c <sum_digits+0x3c>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    -0x8(%rbp),%edx
mov    %edx,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    110e <sum_digits+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum_digits>:
xor    %eax,%eax
test   %edi,%edi
jle    112d <sum_digits+0x2d>
mov    $0xcccccccd,%r8d
nopl   0x0(%rax)
mov    %edi,%edx
imul   %r8,%rdx
shr    $0x23,%rdx
lea    (%rdx,%rdx,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edi,%ecx
sub    %esi,%ecx
add    %ecx,%eax
cmp    $0x9,%edi
mov    %edx,%edi
ja     1110 <sum_digits+0x10>
ret

LLVM IR (-O0):
define i32 @sum_digits(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %7, %1
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32, i32* %2
%9 = srem i32 %8, 10
%10 = load i32, i32* %3
%11 = add nsw i32 %10, %9
store i32 %11, i32* %3
%12 = load i32, i32* %2
%13 = sdiv i32 %12, 10
store i32 %13, i32* %2
br label %4
14: ; preds = %4
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @sum_digits(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %10
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %8, %3 ], [ %0, %1 ]
%6 = urem i32 %5, 10
%7 = add nuw nsw i32 %4, %6
%8 = udiv i32 %5, 10
%9 = icmp ult i32 %5, 10
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %11
}
unsigned int SYS_SwapInt(unsigned int x) { return x; }


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

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

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

LLVM IR (-O2):
define i32 @SYS_SwapInt(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
char sqchat_rfc1459_tolower(char);
void sqchat_trie_rfc1459_strtolower(char *s) {
  for (int i = 0; s[i] != '\0'; i++)
    s[i] = sqchat_rfc1459_tolower(s[i]);
}


x86 assembly (clang, -O0):
<sqchat_trie_rfc1459_strtolower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1164 <sqchat_trie_rfc1459_strtolower+0x54>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <sqchat_rfc1459_tolower@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <sqchat_trie_rfc1459_strtolower+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqchat_trie_rfc1459_strtolower>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1136 <sqchat_trie_rfc1459_strtolower+0x26>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <sqchat_rfc1459_tolower@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <sqchat_trie_rfc1459_strtolower+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @sqchat_trie_rfc1459_strtolower(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %5, %1
ret void
5: ; preds = %1, %5
%6 = phi i64 [ %10, %5 ], [ 0, %1 ]
%7 = phi i8 [ %12, %5 ], [ %2, %1 ]
%8 = phi i8* [ %11, %5 ], [ %0, %1 ]
%9 = tail call signext i8 @sqchat_rfc1459_tolower(i8 signext %7)
store i8 %9, i8* %8
%10 = add nuw i64 %6, 1
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %4, label %5
}
double linearInterpolation1D(double f1, double f2, double x1, double x2,
                             double x) {
  double b;
  b = (x - x1) / (x2 - x1);
  return (1 - b) * f1 + b * f2;
}


x86 assembly (clang, -O0):
<linearInterpolation1D>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xebe(%rip),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<linearInterpolation1D>:
subsd  %xmm2,%xmm4
subsd  %xmm2,%xmm3
divsd  %xmm3,%xmm4
movsd  0xeec(%rip),%xmm2
subsd  %xmm4,%xmm2
mulsd  %xmm1,%xmm4
mulsd  %xmm2,%xmm0
addsd  %xmm4,%xmm0
ret

LLVM IR (-O0):
define double @linearInterpolation1D(double %0, double %1, double %2, double %3, double %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store double %4, double* %10
%12 = load double, double* %10
%13 = load double, double* %8
%14 = fsub double %12, %13
%15 = load double, double* %9
%16 = load double, double* %8
%17 = fsub double %15, %16
%18 = fdiv double %14, %17
store double %18, double* %11
%19 = load double, double* %11
%20 = fsub double 1.000000e+00, %19
%21 = load double, double* %6
%22 = load double, double* %11
%23 = load double, double* %7
%24 = fmul double %22, %23
%25 = call double @llvm.fmuladd.f64(double %20, double %21, double %24)
ret double %25
}

LLVM IR (-O2):
define double @linearInterpolation1D(double %0, double %1, double %2, double %3, double %4) {
%6 = fsub double %4, %2
%7 = fsub double %3, %2
%8 = fdiv double %6, %7
%9 = fsub double 1.000000e+00, %8
%10 = fmul double %8, %1
%11 = tail call double @llvm.fmuladd.f64(double %9, double %0, double %10)
ret double %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void main() { printf("(ok??)\n"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"(ok??)\0A\00"
define void @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [7 x i8] c"(ok??)\00"
define void @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret void
}
long vmin(long a, long b) { return (a < b) ? a : b; }


x86 assembly (clang, -O0):
<vmin>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1127 <vmin+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <vmin+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vmin>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovl  %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @vmin(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
/* Variables and functions */
int string_to_number_ll(char const *, unsigned long, unsigned long,
                        unsigned long long *);
int string_to_number_l(const char *s, unsigned long min, unsigned long max,
                       unsigned long *ret) {
  int result;
  unsigned long long number;
  result = string_to_number_ll(s, min, max, &number);
  *ret = (unsigned long)number;
  return result;
}


x86 assembly (clang, -O0):
<string_to_number_l>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    -0x30(%rbp),%rcx
call   1030 <string_to_number_ll@plt>
mov    %eax,-0x24(%rbp)
mov    -0x30(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_to_number_l>:
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%rbx
lea    0x8(%rsp),%rcx
call   1030 <string_to_number_ll@plt>
mov    0x8(%rsp),%rcx
mov    %rcx,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @string_to_number_l(i8* %0, i64 %1, i64 %2, i64* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64*
%9 = alloca i32
%10 = alloca i64
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64* %3, i64** %8
%11 = load i8*, i8** %5
%12 = load i64, i64* %6
%13 = load i64, i64* %7
%14 = call i32 @string_to_number_ll(i8* %11, i64 %12, i64 %13, i64* %10)
store i32 %14, i32* %9
%15 = load i64, i64* %10
%16 = load i64*, i64** %8
store i64 %15, i64* %16
%17 = load i32, i32* %9
ret i32 %17
}

LLVM IR (-O2):
define i32 @string_to_number_l(i8* %0, i64 %1, i64 %2, i64* nocapture writeonly %3) {
%5 = alloca i64
%6 = bitcast i64* %5 to i8*
%7 = call i32 @string_to_number_ll(i8* %0, i64 %1, i64 %2, i64* %5)
%8 = load i64, i64* %5
store i64 %8, i64* %3
ret i32 %7
}
/* Variables and functions */
char *strchr(char *, char);
char *stab_string_parm(char *str) { return strchr(str, ':'); }


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

x86 assembly (clang, -O2):
<stab_string_parm>:
mov    $0x3a,%esi
jmp    1030 <strchr@plt>

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

LLVM IR (-O2):
define i8* @stab_string_parm(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 58)
ret i8* %2
}
/* Variables and functions */
scalar_t__ strncmp(char *, char const *, int);
bool is_negated(const char *s) { return strncmp("--no-", s, 5) == 0; }


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

x86 assembly (clang, -O2):
<is_negated>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
mov    $0x5,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"--no-\00"
define i32 @is_negated(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strncmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %3, i32 5)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
@.str = [6 x i8] c"--no-\00"
define i32 @is_negated(i8* %0) {
%2 = tail call i64 @strncmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i32 5)
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ default_handler();
__attribute__((weak)) void USART1_IRQHandler() { default_handler(); }


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

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

LLVM IR (-O0):
define weak void @USART1_IRQHandler() {
%1 = call i32 (...) @default_handler()
ret void
}

LLVM IR (-O2):
define weak void @USART1_IRQHandler() {
%1 = tail call i32 (...) @default_handler()
ret void
}
/* Variables and functions */
scalar_t__ Xalloc(unsigned int);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *XttXstrdup(char const *str) {
  char *result;
  result = (char *)Xalloc((unsigned)strlen(str) + 1);
  if (result)
    strcpy(result, str);
  return result;
}


x86 assembly (clang, -O0):
<XttXstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%edi
add    $0x1,%edi
call   1050 <Xalloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116b <XttXstrdup+0x3b>
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):
<XttXstrdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
call   1050 <Xalloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1157 <XttXstrdup+0x27>
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* @XttXstrdup(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 = trunc i64 %5 to i32
%7 = add i32 %6, 1
%8 = call i64 @Xalloc(i32 %7)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %16
12: ; preds = %1
%13 = load i8*, i8** %3
%14 = load i8*, i8** %2
%15 = call i32 @strcpy(i8* %13, i8* %14)
br label %16
16: ; preds = %12, %1
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
define i8* @XttXstrdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = trunc i64 %2 to i32
%4 = add i32 %3, 1
%5 = tail call i64 @Xalloc(i32 %4)
%6 = inttoptr i64 %5 to i8*
%7 = icmp eq i64 %5, 0
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = tail call i32 @strcpy(i8* %6, i8* %0)
br label %10
10: ; preds = %8, %1
ret i8* %6
}
float clampf(float val, float min, float max) {
  return (val < min) ? min : (val > max) ? max : val;
}


x86 assembly (clang, -O0):
<clampf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1135 <clampf+0x35>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1167 <clampf+0x67>
movss  -0x4(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1153 <clampf+0x53>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    115d <clampf+0x5d>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<clampf>:
minss  %xmm0,%xmm2
cmpltss %xmm1,%xmm0
movaps %xmm0,%xmm3
andnps %xmm2,%xmm3
andps  %xmm1,%xmm0
orps   %xmm3,%xmm0
ret

LLVM IR (-O0):
define float @clampf(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = fcmp olt float %7, %8
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = load float, float* %5
br label %22
12: ; preds = %3
%13 = load float, float* %4
%14 = load float, float* %6
%15 = fcmp ogt float %13, %14
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = load float, float* %6
br label %20
18: ; preds = %12
%19 = load float, float* %4
br label %20
20: ; preds = %18, %16
%21 = phi float [ %17, %16 ], [ %19, %18 ]
br label %22
22: ; preds = %20, %10
%23 = phi float [ %11, %10 ], [ %21, %20 ]
ret float %23
}

LLVM IR (-O2):
define float @clampf(float %0, float %1, float %2) {
%4 = fcmp olt float %0, %1
%5 = fcmp ogt float %0, %2
%6 = select i1 %5, float %2, float %0
%7 = select i1 %4, float %1, float %6
ret float %7
}
unsigned short GetMaxUnsignedShort(void) { return ((unsigned short)-1); }


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

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

LLVM IR (-O0):
define zeroext i16 @GetMaxUnsignedShort() {
ret i16 -1
}

LLVM IR (-O2):
define zeroext i16 @GetMaxUnsignedShort() {
ret i16 -1
}
/* Variables and functions */
int errno;
void _reset_errno_(int *saved_errno) { errno = *saved_errno; }


x86 assembly (clang, -O0):
<_reset_errno_>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    0x2ecb(%rip),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<_reset_errno_>:
mov    (%rdi),%eax
mov    0x2ed7(%rip),%rcx
mov    %eax,(%rcx)
ret

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

LLVM IR (-O2):
@errno = global i32 0
define void @_reset_errno_(i32* nocapture %0) {
%2 = load i32, i32* %0
store i32 %2, i32* @errno
ret void
}