xunge/DecIR huggingface dataset:
double fclamp(double x, double minval, double maxval) {
  if (x < minval)
    return minval;
  if (x > maxval)
    return maxval;
  return x;
}


x86 assembly (clang, -O0):
<fclamp>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1136 <fclamp+0x36>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    115f <fclamp+0x5f>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1155 <fclamp+0x55>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    115f <fclamp+0x5f>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fclamp>:
minsd  %xmm0,%xmm2
cmpltsd %xmm1,%xmm0
movapd %xmm0,%xmm3
andnpd %xmm2,%xmm3
andpd  %xmm1,%xmm0
orpd   %xmm3,%xmm0
ret

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

LLVM IR (-O2):
define double @fclamp(double %0, double %1, double %2) {
%4 = fcmp olt double %0, %1
%5 = fcmp ogt double %0, %2
%6 = select i1 %5, double %2, double %0
%7 = select i1 %4, double %1, double %6
ret double %7
}
void _Z17JvNewStringLatin1PKc(void) {}


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

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

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

LLVM IR (-O2):
define void @_Z17JvNewStringLatin1PKc() {
ret void
}
int fibonacci(int n) {
  if (n <= 1)
    return n;
  return fibonacci(n - 1) + fibonacci(n - 2);
}


x86 assembly (clang, -O0):
<fibonacci>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jg     1130 <fibonacci+0x20>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1153 <fibonacci+0x43>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <fibonacci@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <fibonacci@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fibonacci>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %ebp,%ebp
cmp    $0x2,%edi
jge    1120 <fibonacci+0x10>
mov    %ebx,%ecx
jmp    1144 <fibonacci+0x34>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x1(%rbx),%edi
call   1030 <fibonacci@plt>
lea    -0x2(%rbx),%ecx
add    %eax,%ebp
cmp    $0x3,%ebx
mov    %ecx,%ebx
ja     1130 <fibonacci+0x20>
add    %ecx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fibonacci(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ %0, %1 ]
%5 = phi i32 [ %9, %3 ], [ 0, %1 ]
%6 = add nsw i32 %4, -1
%7 = tail call i32 @fibonacci(i32 %6)
%8 = add nsw i32 %4, -2
%9 = add nsw i32 %7, %5
%10 = icmp ult i32 %4, 4
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %9, %3 ]
%13 = phi i32 [ %0, %1 ], [ %8, %3 ]
%14 = add nsw i32 %13, %12
ret i32 %14
}
/* Variables and functions */
double exp(int /*<<< orphan*/);
int /*<<< orphan*/ lgamma(double);
double signgam;
double factorial(double arg) {
  double d;
  d = exp(lgamma(arg + 1.0)) * signgam;
  return d;
}


x86 assembly (clang, -O0):
<factorial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xecb(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
call   1040 <lgamma@plt>
mov    %eax,%edi
call   1030 <exp@plt>
mov    0x2e9b(%rip),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<factorial>:
push   %rax
addsd  0xed7(%rip),%xmm0
call   1040 <lgamma@plt>
mov    %eax,%edi
call   1030 <exp@plt>
mov    0x2eac(%rip),%rax
mulsd  (%rax),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@signgam = global double 0.000000e+00
define double @factorial(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fadd double %4, 1.000000e+00
%6 = call i32 @lgamma(double %5)
%7 = call double @exp(i32 %6)
%8 = load double, double* @signgam
%9 = fmul double %7, %8
store double %9, double* %3
%10 = load double, double* %3
ret double %10
}

LLVM IR (-O2):
@signgam = global double 0.000000e+00
define double @factorial(double %0) {
%2 = fadd double %0, 1.000000e+00
%3 = tail call i32 @lgamma(double %2)
%4 = tail call double @exp(i32 %3)
%5 = load double, double* @signgam
%6 = fmul double %4, %5
ret double %6
}
void gtk_events_pending() {}


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

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

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

LLVM IR (-O2):
define void @gtk_events_pending() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ panic(char *);
void *realloc(void *, size_t);
void *must_realloc(void *was, size_t size) {
  void *answer;
  answer = realloc(was, size);
  if (!answer)
    panic("bummer, realloc failed");
  return answer;
}


x86 assembly (clang, -O0):
<must_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1158 <must_realloc+0x38>
lea    0xead(%rip),%rdi
call   1030 <panic@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<must_realloc>:
push   %rbx
call   1040 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <must_realloc+0x1a>
lea    0xecb(%rip),%rdi
call   1030 <panic@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"bummer, realloc failed\00"
define i8* @must_realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %13, label %11
11: ; preds = %2
%12 = call i32 @panic(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %2
%14 = load i8*, i8** %5
ret i8* %14
}

LLVM IR (-O2):
@.str = [23 x i8] c"bummer, realloc failed\00"
define noalias i8* @must_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @panic(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret i8* %3
}
struct lv_segment *first_seg(const struct logical_volume *lv) {
  return ((struct lv_segment **)lv)[0];
}


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

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

LLVM IR (-O0):
%struct.lv_segment = type opaque
%struct.logical_volume = type opaque
define %struct.lv_segment* @first_seg(%struct.logical_volume* %0) {
%2 = alloca %struct.logical_volume*
store %struct.logical_volume* %0, %struct.logical_volume** %2
%3 = load %struct.logical_volume*, %struct.logical_volume** %2
%4 = bitcast %struct.logical_volume* %3 to %struct.lv_segment**
%5 = getelementptr inbounds %struct.lv_segment*, %struct.lv_segment** %4, i64 0
%6 = load %struct.lv_segment*, %struct.lv_segment** %5
ret %struct.lv_segment* %6
}

LLVM IR (-O2):
%struct.lv_segment = type opaque
%struct.logical_volume = type opaque
define %struct.lv_segment* @first_seg(%struct.logical_volume* nocapture %0) {
%2 = bitcast %struct.logical_volume* %0 to %struct.lv_segment**
%3 = load %struct.lv_segment*, %struct.lv_segment** %2
ret %struct.lv_segment* %3
}
void hard_fault_handler_c(unsigned int *hardfault_args) {}


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

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

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

LLVM IR (-O2):
define void @hard_fault_handler_c(i32* nocapture %0) {
ret void
}
/* Type definitions */
struct gui_window {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct gui_window *);
void kolibri_destroy_window(struct gui_window *gw) { free(gw); }


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

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

LLVM IR (-O2):
%struct.gui_window = type { i32 }
define void @kolibri_destroy_window(%struct.gui_window* nocapture %0) {
%2 = tail call i32 @free(%struct.gui_window* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void idn_free(void *ptr) { free(ptr); }


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

LLVM IR (-O0):
define void @idn_free(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 @idn_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
void set_bit(unsigned int bit, void *array) {
  unsigned char *a = array;
  a[bit / 8] |= (1 << (bit % 8));
}


x86 assembly (clang, -O0):
<set_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%ecx
and    $0x7,%ecx
mov    $0x1,%esi
shl    %cl,%esi
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%ecx
shr    $0x3,%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%edx
or     %esi,%edx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_bit>:
mov    %edi,%eax
mov    %edi,%ecx
and    $0x7,%cl
mov    $0x1,%edx
shl    %cl,%edx
shr    $0x3,%rax
or     %dl,(%rsi,%rax,1)
ret

LLVM IR (-O0):
define void @set_bit(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
store i8* %6, i8** %5
%7 = load i32, i32* %3
%8 = urem i32 %7, 8
%9 = shl i32 1, %8
%10 = load i8*, i8** %5
%11 = load i32, i32* %3
%12 = udiv i32 %11, 8
%13 = zext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %10, i64 %13
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = or i32 %16, %9
%18 = trunc i32 %17 to i8
store i8 %18, i8* %14
ret void
}

LLVM IR (-O2):
define void @set_bit(i32 %0, i8* nocapture %1) {
%3 = and i32 %0, 7
%4 = shl nuw nsw i32 1, %3
%5 = lshr i32 %0, 3
%6 = zext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %1, i64 %6
%8 = load i8, i8* %7
%9 = trunc i32 %4 to i8
%10 = or i8 %8, %9
store i8 %10, i8* %7
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int odd_ones(int);
int main(int argc, char *argv[]) {
  assert(odd_ones(0x10101011));
  assert(!odd_ones(0x01010101));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x10101011,%edi
call   1040 <odd_ones@plt>
mov    %eax,%edi
call   1030 <assert@plt>
mov    $0x1010101,%edi
call   1040 <odd_ones@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x10101011,%edi
call   1040 <odd_ones@plt>
mov    %eax,%edi
call   1030 <assert@plt>
mov    $0x1010101,%edi
call   1040 <odd_ones@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @odd_ones(i32 269488145)
%7 = call i32 @assert(i32 %6)
%8 = call i32 @odd_ones(i32 16843009)
%9 = icmp ne i32 %8, 0
%10 = xor i1 %9, true
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @odd_ones(i32 269488145)
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @odd_ones(i32 16843009)
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *xmalloc(size_t);
void *xmalloc0(size_t len) {
  void *p = xmalloc(len);
  memset(p, 0, len);
  return (p);
}


x86 assembly (clang, -O0):
<xmalloc0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <xmalloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc0>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <xmalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @xmalloc0(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @xmalloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = load i64, i64* %2
%8 = call i32 @memset(i8* %6, i32 0, i64 %7)
%9 = load i8*, i8** %3
ret i8* %9
}

LLVM IR (-O2):
define i8* @xmalloc0(i64 %0) {
%2 = tail call i8* @xmalloc(i64 %0)
%3 = tail call i32 @memset(i8* %2, i32 0, i64 %0)
ret i8* %2
}
/* Variables and functions */
int dwarf_get_END_name(unsigned int, char const **);
char const *ellipname(int, unsigned int, char const *, char *, int);
const char *get_END_name(unsigned int val_in, int printonerr) {
  const char *v = 0;
  int res = dwarf_get_END_name(val_in, &v);
  return ellipname(res, val_in, v, "END", printonerr);
}


x86 assembly (clang, -O0):
<get_END_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1040 <dwarf_get_END_name@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%r8d
lea    0xea6(%rip),%rcx
call   1030 <ellipname@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_END_name>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
movq   $0x0,(%rsp)
mov    %rsp,%rsi
call   1040 <dwarf_get_END_name@plt>
mov    (%rsp),%rdx
lea    0xebe(%rip),%rcx
mov    %eax,%edi
mov    %ebp,%esi
mov    %ebx,%r8d
call   1030 <ellipname@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"END\00"
define i8* @get_END_name(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i8* null, i8** %5
%7 = load i32, i32* %3
%8 = call i32 @dwarf_get_END_name(i32 %7, i8** %5)
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = load i32, i32* %3
%11 = load i8*, i8** %5
%12 = load i32, i32* %4
%13 = call i8* @ellipname(i32 %9, i32 %10, i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
ret i8* %13
}

LLVM IR (-O2):
@.str = [4 x i8] c"END\00"
define i8* @get_END_name(i32 %0, i32 %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%5 = call i32 @dwarf_get_END_name(i32 %0, i8** %3)
%6 = load i8*, i8** %3
%7 = call i8* @ellipname(i32 %5, i32 %0, i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i8* %7
}
/* Variables and functions */
int atoi(char *);
char *strchr(char *, char);
int Time2Num(char *s) {
  int h, m;
  char *p;
  p = strchr(s, ':');
  *p++ = '\0';
  h = atoi(s);
  m = atoi(p);
  return (h * 60 + m);
}


x86 assembly (clang, -O0):
<Time2Num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3a,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x10(%rbp)
imul   $0x3c,-0xc(%rbp),%eax
add    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Time2Num>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x3a,%esi
call   1030 <strchr@plt>
movb   $0x0,(%rax)
lea    0x1(%rax),%r14
mov    %rbx,%rdi
call   1040 <atoi@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1040 <atoi@plt>
imul   $0x3c,%ebx,%ecx
add    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @Time2Num(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i8* @strchr(i8* %6, i8 signext 58)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %5
store i8 0, i8* %8
%10 = load i8*, i8** %2
%11 = call i32 @atoi(i8* %10)
store i32 %11, i32* %3
%12 = load i8*, i8** %5
%13 = call i32 @atoi(i8* %12)
store i32 %13, i32* %4
%14 = load i32, i32* %3
%15 = mul nsw i32 %14, 60
%16 = load i32, i32* %4
%17 = add nsw i32 %15, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @Time2Num(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 58)
%3 = getelementptr inbounds i8, i8* %2, i64 1
store i8 0, i8* %2
%4 = tail call i32 @atoi(i8* %0)
%5 = tail call i32 @atoi(i8* %3)
%6 = mul nsw i32 %4, 60
%7 = add nsw i32 %6, %5
ret i32 %7
}
void swapNum(int *p, int *q) {
  int temp = *p;
  *p = *q;
  *q = temp;
}


x86 assembly (clang, -O0):
<swapNum>:
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):
<swapNum>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
mov    %ecx,(%rdi)
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
define void @swapNum(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 @swapNum(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*/ handle_PRIO(int /*<<< orphan*/);
int gen_PRIO(void) {
  handle_PRIO(0);
  return 0;
}


x86 assembly (clang, -O0):
<gen_PRIO>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <handle_PRIO@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @gen_PRIO() {
%1 = call i32 @handle_PRIO(i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @gen_PRIO() {
%1 = tail call i32 @handle_PRIO(i32 0)
ret i32 0
}
unsigned int mem_get_le32_as_int(const void *vmem) {
  unsigned int val;
  const unsigned char *mem = (const unsigned char *)vmem;
  val = mem[3] << 24;
  val |= mem[2] << 16;
  val |= mem[1] << 8;
  val |= mem[0];
  return val;
}


x86 assembly (clang, -O0):
<mem_get_le32_as_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movzbl 0x3(%rax),%eax
shl    $0x18,%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
movzbl 0x2(%rax),%eax
shl    $0x10,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
movzbl 0x1(%rax),%eax
shl    $0x8,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @mem_get_le32_as_int(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8* %5, i8** %4
%6 = load i8*, i8** %4
%7 = getelementptr inbounds i8, i8* %6, i64 3
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = shl i32 %9, 24
store i32 %10, i32* %3
%11 = load i8*, i8** %4
%12 = getelementptr inbounds i8, i8* %11, i64 2
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = shl i32 %14, 16
%16 = load i32, i32* %3
%17 = or i32 %16, %15
store i32 %17, i32* %3
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i64 1
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = shl i32 %21, 8
%23 = load i32, i32* %3
%24 = or i32 %23, %22
store i32 %24, i32* %3
%25 = load i8*, i8** %4
%26 = getelementptr inbounds i8, i8* %25, i64 0
%27 = load i8, i8* %26
%28 = zext i8 %27 to i32
%29 = load i32, i32* %3
%30 = or i32 %29, %28
store i32 %30, i32* %3
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
define i32 @mem_get_le32_as_int(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 3
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = shl nuw i32 %4, 24
%6 = getelementptr inbounds i8, i8* %0, i64 2
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = shl nuw nsw i32 %8, 16
%10 = or i32 %9, %5
%11 = getelementptr inbounds i8, i8* %0, i64 1
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = shl nuw nsw i32 %13, 8
%15 = or i32 %10, %14
%16 = load i8, i8* %0
%17 = zext i8 %16 to i32
%18 = or i32 %15, %17
ret i32 %18
}
/* Variables and functions */
int BIT(int);
int wpa_key_mgmt_suite_b(int akm) { return !!(akm & BIT(16)); }


x86 assembly (clang, -O0):
<wpa_key_mgmt_suite_b>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x10,%edi
call   1030 <BIT@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wpa_key_mgmt_suite_b>:
push   %rbx
mov    %edi,%ebx
mov    $0x10,%edi
call   1030 <BIT@plt>
xor    %ecx,%ecx
test   %ebx,%eax
setne  %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @wpa_key_mgmt_suite_b(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @BIT(i32 16)
%5 = and i32 %3, %4
%6 = icmp ne i32 %5, 0
%7 = xor i1 %6, true
%8 = xor i1 %7, true
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @wpa_key_mgmt_suite_b(i32 %0) {
%2 = tail call i32 @BIT(i32 16)
%3 = and i32 %2, %0
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
void inicializaTabuleiro(int tabuleiro[][5]) {
  int linha, coluna;
  for (linha = 0; linha < 5; linha++)
    for (coluna = 0; coluna < 5; coluna++)
      tabuleiro[linha][coluna] = -1;
}


x86 assembly (clang, -O0):
<inicializaTabuleiro>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    1165 <inicializaTabuleiro+0x65>
movl   $0x0,-0x10(%rbp)
cmpl   $0x5,-0x10(%rbp)
jge    1152 <inicializaTabuleiro+0x52>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1120 <inicializaTabuleiro+0x20>
jmp    1157 <inicializaTabuleiro+0x57>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <inicializaTabuleiro+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<inicializaTabuleiro>:
pcmpeqd %xmm0,%xmm0
movdqu %xmm0,0x50(%rdi)
movdqu %xmm0,0x40(%rdi)
movdqu %xmm0,0x30(%rdi)
movdqu %xmm0,0x20(%rdi)
movdqu %xmm0,0x10(%rdi)
movdqu %xmm0,(%rdi)
movl   $0xffffffff,0x60(%rdi)
ret

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

LLVM IR (-O2):
define void @inicializaTabuleiro([5 x i32]* nocapture writeonly %0) {
%2 = bitcast [5 x i32]* %0 to i8*
ret void
}
void swap_int(int *a, int *b) {
  int temp = *b;
  *b = *a;
  *a = temp;
}


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

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

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

LLVM IR (-O2):
define void @swap_int(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = load i32, i32* %0
store i32 %4, i32* %1
store i32 %3, i32* %0
ret void
}
/* Variables and functions */
int yyparse();
int read_command() { return yyparse(); }


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

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

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

LLVM IR (-O2):
define i32 @read_command() {
%1 = tail call i32 (...) @yyparse()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ _dbg_check_enable();
int /*<<< orphan*/ port_enable();
void chSysEnable(void) {
  _dbg_check_enable();
  port_enable();
}


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

x86 assembly (clang, -O2):
<chSysEnable>:
push   %rax
xor    %eax,%eax
call   1030 <_dbg_check_enable@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <port_enable@plt>

LLVM IR (-O0):
define void @chSysEnable() {
%1 = call i32 (...) @_dbg_check_enable()
%2 = call i32 (...) @port_enable()
ret void
}

LLVM IR (-O2):
define void @chSysEnable() {
%1 = tail call i32 (...) @_dbg_check_enable()
%2 = tail call i32 (...) @port_enable()
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t convert8_16(uint8_t lsb, uint8_t msb) {
  return lsb | ((uint16_t)msb) << 8;
}


x86 assembly (clang, -O0):
<convert8_16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert8_16>:
mov    %esi,%eax
shl    $0x8,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @convert8_16(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 = shl i32 %6, 8
%8 = or i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @convert8_16(i32 %0, i32 %1) {
%3 = shl i32 %1, 8
%4 = or i32 %3, %0
ret i32 %4
}
/* Type definitions */
struct strbuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ strbuf_append(struct strbuf *, int /*<<< orphan*/);
void strbuf_cat(struct strbuf *buf, char *s) {
  char *p = s;
  while (*p) {
    strbuf_append(buf, *p++);
  }
}


x86 assembly (clang, -O0):
<strbuf_cat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1155 <strbuf_cat+0x45>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%esi
call   1030 <strbuf_append@plt>
jmp    1128 <strbuf_cat+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strbuf_cat>:
push   %r14
push   %rbx
push   %rax
mov    (%rsi),%al
test   %al,%al
je     1146 <strbuf_cat+0x36>
mov    %rsi,%rbx
mov    %rdi,%r14
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %al,%esi
mov    %r14,%rdi
call   1030 <strbuf_append@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <strbuf_cat+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.strbuf = type { i32 }
define void @strbuf_cat(%struct.strbuf* %0, i8* %1) {
%3 = alloca %struct.strbuf*
%4 = alloca i8*
%5 = alloca i8*
store %struct.strbuf* %0, %struct.strbuf** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
store i8* %6, i8** %5
br label %7
7: ; preds = %11, %2
%8 = load i8*, i8** %5
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %18
11: ; preds = %7
%12 = load %struct.strbuf*, %struct.strbuf** %3
%13 = load i8*, i8** %5
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %5
%15 = load i8, i8* %13
%16 = sext i8 %15 to i32
%17 = call i32 @strbuf_append(%struct.strbuf* %12, i32 %16)
br label %7
18: ; preds = %7
ret void
}

LLVM IR (-O2):
%struct.strbuf = type { i32 }
define void @strbuf_cat(%struct.strbuf* %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %8, %5 ], [ %1, %2 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = sext i8 %6 to i32
%10 = tail call i32 @strbuf_append(%struct.strbuf* %0, i32 %9)
%11 = load i8, i8* %8
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ServerQuit(int);
void Shutdown(void) { ServerQuit(-1); }


x86 assembly (clang, -O0):
<Shutdown>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffff,%edi
call   1030 <ServerQuit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Shutdown>:
mov    $0xffffffff,%edi
jmp    1030 <ServerQuit@plt>

LLVM IR (-O0):
define void @Shutdown() {
%1 = call i32 @ServerQuit(i32 -1)
ret void
}

LLVM IR (-O2):
define void @Shutdown() {
%1 = tail call i32 @ServerQuit(i32 -1)
ret void
}
/* Variables and functions */
char *strchr(char *, char);
char *replace(char *str, char before, char after) {
  while (strchr(str, before))
    *strchr(str, before) = after;
  return str;
}


x86 assembly (clang, -O0):
<replace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rdi
movsbl -0x9(%rbp),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     115b <replace+0x4b>
mov    -0xa(%rbp),%al
mov    %al,-0xb(%rbp)
mov    -0x8(%rbp),%rdi
movsbl -0x9(%rbp),%esi
call   1030 <strchr@plt>
mov    -0xb(%rbp),%cl
mov    %cl,(%rax)
jmp    1127 <replace+0x17>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<replace>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <strchr@plt>
test   %rax,%rax
je     1142 <replace+0x32>
movsbl %bpl,%ebp
nopw   0x0(%rax,%rax,1)
mov    %r14b,(%rax)
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <strchr@plt>
test   %rax,%rax
jne    1130 <replace+0x20>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @replace(i8* %0, i8 signext %1, i8 signext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
br label %7
7: ; preds = %12, %3
%8 = load i8*, i8** %4
%9 = load i8, i8* %5
%10 = call i8* @strchr(i8* %8, i8 signext %9)
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %17
12: ; preds = %7
%13 = load i8, i8* %6
%14 = load i8*, i8** %4
%15 = load i8, i8* %5
%16 = call i8* @strchr(i8* %14, i8 signext %15)
store i8 %13, i8* %16
br label %7
17: ; preds = %7
%18 = load i8*, i8** %4
ret i8* %18
}

LLVM IR (-O2):
define i8* @replace(i8* returned %0, i8 signext %1, i8 signext %2) {
%4 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext %1)
%5 = icmp eq i8* %4, null
br i1 %5, label %10, label %6
6: ; preds = %3, %6
%7 = phi i8* [ %8, %6 ], [ %4, %3 ]
store i8 %2, i8* %7
%8 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext %1)
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %6
10: ; preds = %6, %3
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ srand(int);
scalar_t__ time(int /*<<< orphan*/ *);
void Randomize(void) { srand((int)time(NULL)); }


x86 assembly (clang, -O0):
<Randomize>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Randomize>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <srand@plt>

LLVM IR (-O0):
define void @Randomize() {
%1 = call i64 @time(i32* null)
%2 = trunc i64 %1 to i32
%3 = call i32 @srand(i32 %2)
ret void
}

LLVM IR (-O2):
define void @Randomize() {
%1 = tail call i64 @time(i32* null)
%2 = trunc i64 %1 to i32
%3 = tail call i32 @srand(i32 %2)
ret void
}
int kvm_para_available(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @kvm_para_available() {
ret i32 1
}

LLVM IR (-O2):
define i32 @kvm_para_available() {
ret i32 1
}
/* Type definitions */
typedef int socklen_t;

/* Variables and functions */
#define IPV6_RTHDR_TYPE_0 128
socklen_t inet6_rth_space(int type, int segments) {
  switch (type) {
  case IPV6_RTHDR_TYPE_0:
    if ((segments >= 0) && (segments <= 127))
      return (((segments * 2) + 1) << 3);
  default:
    return (0);
  }
}


x86 assembly (clang, -O0):
<inet6_rth_space>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x80,%eax
jne    114a <inet6_rth_space+0x4a>
jmp    111d <inet6_rth_space+0x1d>
cmpl   $0x0,-0xc(%rbp)
jl     1145 <inet6_rth_space+0x45>
cmpl   $0x7f,-0xc(%rbp)
jg     1145 <inet6_rth_space+0x45>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
shl    $0x3,%eax
mov    %eax,-0x4(%rbp)
jmp    1151 <inet6_rth_space+0x51>
jmp    114a <inet6_rth_space+0x4a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inet6_rth_space>:
mov    %esi,%eax
shl    $0x4,%eax
or     $0x8,%eax
xor    %ecx,%ecx
cmp    $0x80,%esi
cmovae %ecx,%eax
cmp    $0x80,%edi
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @inet6_rth_space(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
switch i32 %6, label %19 [
i32 128, label %7
]
7: ; preds = %2
%8 = load i32, i32* %5
%9 = icmp sge i32 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = load i32, i32* %5
%12 = icmp sle i32 %11, 127
br i1 %12, label %13, label %18
13: ; preds = %10
%14 = load i32, i32* %5
%15 = mul nsw i32 %14, 2
%16 = add nsw i32 %15, 1
%17 = shl i32 %16, 3
store i32 %17, i32* %3
br label %20
18: ; preds = %10, %7
br label %19
19: ; preds = %2, %18
store i32 0, i32* %3
br label %20
20: ; preds = %19, %13
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @inet6_rth_space(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 128
%4 = icmp ult i32 %1, 128
%5 = and i1 %3, %4
%6 = shl i32 %1, 4
%7 = or i32 %6, 8
%8 = select i1 %5, i32 %7, i32 0
ret i32 %8
}
short prog_q168add(int A, short B) {
  int C = A + (int)B;
  if (C > 32767) {
    C = 32767;
  } else if (C < -32768) {
    C = -32768;
  }
  return (short)C;
}


x86 assembly (clang, -O0):
<prog_q168add>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %edi,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
mov    -0x4(%rbp),%eax
movswl -0x6(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x7fff,-0xc(%rbp)
jle    1133 <prog_q168add+0x33>
movl   $0x7fff,-0xc(%rbp)
jmp    114c <prog_q168add+0x4c>
cmpl   $0xffff8000,-0xc(%rbp)
jge    1147 <prog_q168add+0x47>
movl   $0xffff8000,-0xc(%rbp)
jmp    114c <prog_q168add+0x4c>
mov    -0xc(%rbp),%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<prog_q168add>:
lea    (%rdi,%rsi,1),%eax
cmp    $0xffff8001,%eax
mov    $0xffff8000,%ecx
cmovge %eax,%ecx
cmp    $0x7fff,%ecx
mov    $0x7fff,%eax
cmovl  %ecx,%eax
ret

LLVM IR (-O0):
define signext i16 @prog_q168add(i32 %0, i16 signext %1) {
%3 = alloca i32
%4 = alloca i16
%5 = alloca i32
store i32 %0, i32* %3
store i16 %1, i16* %4
%6 = load i32, i32* %3
%7 = load i16, i16* %4
%8 = sext i16 %7 to i32
%9 = add nsw i32 %6, %8
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = icmp sgt i32 %10, 32767
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 32767, i32* %5
br label %18
13: ; preds = %2
%14 = load i32, i32* %5
%15 = icmp slt i32 %14, -32768
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 -32768, i32* %5
br label %17
17: ; preds = %16, %13
br label %18
18: ; preds = %17, %12
%19 = load i32, i32* %5
%20 = trunc i32 %19 to i16
ret i16 %20
}

LLVM IR (-O2):
define signext i16 @prog_q168add(i32 %0, i16 signext %1) {
%3 = sext i16 %1 to i32
%4 = add nsw i32 %3, %0
%5 = icmp sgt i32 %4, -32768
%6 = select i1 %5, i32 %4, i32 -32768
%7 = icmp slt i32 %6, 32767
%8 = select i1 %7, i32 %6, i32 32767
%9 = trunc i32 %8 to i16
ret i16 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ be32toh(int /*<<< orphan*/);
uint32_t _be32toh(uint32_t value) { return be32toh(value); }


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

x86 assembly (clang, -O2):
<_be32toh>:
jmp    1030 <be32toh@plt>

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

LLVM IR (-O2):
define i32 @_be32toh(i32 %0) {
%2 = tail call i32 @be32toh(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ SIGCONT;
int /*<<< orphan*/ SIGFPE;
int /*<<< orphan*/ SIGILL;
int /*<<< orphan*/ SIGSEGV;
int /*<<< orphan*/ SIGSTOP;
int /*<<< orphan*/ SIGTRAP;
int /*<<< orphan*/ raise(int /*<<< orphan*/);
int main(int argc, char **argv) {
  raise(SIGSTOP);
  raise(SIGFPE);
  raise(SIGTRAP);
  raise(SIGSEGV);
  raise(SIGILL);
  raise(SIGCONT);
  return 123;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>
mov    $0x7b,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>
mov    $0x7b,%eax
pop    %rcx
ret

LLVM IR (-O0):
@SIGSTOP = global i32 0
@SIGFPE = global i32 0
@SIGTRAP = global i32 0
@SIGSEGV = global i32 0
@SIGILL = global i32 0
@SIGCONT = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* @SIGSTOP
%7 = call i32 @raise(i32 %6)
%8 = load i32, i32* @SIGFPE
%9 = call i32 @raise(i32 %8)
%10 = load i32, i32* @SIGTRAP
%11 = call i32 @raise(i32 %10)
%12 = load i32, i32* @SIGSEGV
%13 = call i32 @raise(i32 %12)
%14 = load i32, i32* @SIGILL
%15 = call i32 @raise(i32 %14)
%16 = load i32, i32* @SIGCONT
%17 = call i32 @raise(i32 %16)
ret i32 123
}

LLVM IR (-O2):
@SIGSTOP = global i32 0
@SIGFPE = global i32 0
@SIGTRAP = global i32 0
@SIGSEGV = global i32 0
@SIGILL = global i32 0
@SIGCONT = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @SIGSTOP
%4 = tail call i32 @raise(i32 %3)
%5 = load i32, i32* @SIGFPE
%6 = tail call i32 @raise(i32 %5)
%7 = load i32, i32* @SIGTRAP
%8 = tail call i32 @raise(i32 %7)
%9 = load i32, i32* @SIGSEGV
%10 = tail call i32 @raise(i32 %9)
%11 = load i32, i32* @SIGILL
%12 = tail call i32 @raise(i32 %11)
%13 = load i32, i32* @SIGCONT
%14 = tail call i32 @raise(i32 %13)
ret i32 123
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int bar(int);
int baz(int, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int foo(int);
int main(void) {
  if (foo(6) != 726)
    abort();
  if (bar(7) != -5040)
    abort();
  if (baz(10, 5) != 50)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x6,%edi
call   1060 <foo@plt>
cmp    $0x2d6,%eax
je     117b <main+0x2b>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x7,%edi
call   1050 <bar@plt>
cmp    $0xffffec50,%eax
je     1197 <main+0x47>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0xa,%edi
mov    $0x5,%esi
call   1040 <baz@plt>
cmp    $0x32,%eax
je     11b6 <main+0x66>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x6,%edi
call   1060 <foo@plt>
cmp    $0x2d6,%eax
jne    118e <main+0x3e>
mov    $0x7,%edi
call   1050 <bar@plt>
cmp    $0xffffec50,%eax
jne    118e <main+0x3e>
mov    $0xa,%edi
mov    $0x5,%esi
call   1040 <baz@plt>
cmp    $0x32,%eax
jne    118e <main+0x3e>
xor    %edi,%edi
call   1070 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @foo(i32 6)
%3 = icmp ne i32 %2, 726
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
%7 = call i32 @bar(i32 7)
%8 = icmp ne i32 %7, -5040
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %6
%12 = call i32 @baz(i32 10, i32 5)
%13 = icmp ne i32 %12, 50
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (...) @abort()
unreachable
16: ; preds = %11
%17 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 6)
%2 = icmp eq i32 %1, 726
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i32 @bar(i32 7)
%7 = icmp eq i32 %6, -5040
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %5
%11 = tail call i32 @baz(i32 10, i32 5)
%12 = icmp eq i32 %11, 50
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 (...) @abort()
unreachable
15: ; preds = %10
%16 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ distancia(int **, int);
int main() {
  int cidade[6][6] = {0, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0,
                      0, 0, 2, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0};
  distancia(cidade, 3);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
lea    -0x90(%rbp),%rdi
lea    0xec7(%rip),%rsi
mov    $0x90,%edx
call   1040 <memcpy@plt>
lea    -0x90(%rbp),%rdi
mov    $0x3,%esi
call   1030 <distancia@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x90,%rsp
lea    0xed1(%rip),%rsi
mov    %rsp,%rbx
mov    $0x90,%edx
mov    %rbx,%rdi
call   1040 <memcpy@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <distancia@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.cidade = [6 x [6 x i32]] [[6 x i32] [i32 0, i32 2, i32 0, i32 0, i32 0, i32 0], [6 x i32] [i32 0, i32 0, i32 2, i32 0, i32 0, i32 0], [6 x i32] [i32 0, i32 0, i32 0, i32 0, i32 2, i32 0], [6 x i32] [i32 0, i32 0, i32 2, i32 0, i32 2, i32 0], [6 x i32] [i32 2, i32 0, i32 0, i32 0, i32 0, i32 0], [6 x i32] [i32 0, i32 2, i32 0, i32 0, i32 0, i32 0]]
define i32 @main() {
%1 = alloca [6 x [6 x i32]]
%2 = bitcast [6 x [6 x i32]]* %1 to i8*
%3 = getelementptr inbounds [6 x [6 x i32]], [6 x [6 x i32]]* %1, i64 0, i64 0
%4 = bitcast [6 x i32]* %3 to i32**
%5 = call i32 @distancia(i32** %4, i32 3)
ret i32 0
}

LLVM IR (-O2):
@__const.main.cidade = [6 x [6 x i32]] [[6 x i32] [i32 0, i32 2, i32 0, i32 0, i32 0, i32 0], [6 x i32] [i32 0, i32 0, i32 2, i32 0, i32 0, i32 0], [6 x i32] [i32 0, i32 0, i32 0, i32 0, i32 2, i32 0], [6 x i32] [i32 0, i32 0, i32 2, i32 0, i32 2, i32 0], [6 x i32] [i32 2, i32 0, i32 0, i32 0, i32 0, i32 0], [6 x i32] [i32 0, i32 2, i32 0, i32 0, i32 0, i32 0]]
define i32 @main() {
%1 = alloca [6 x [6 x i32]]
%2 = bitcast [6 x [6 x i32]]* %1 to i8*
%3 = bitcast [6 x [6 x i32]]* %1 to i32**
%4 = call i32 @distancia(i32** %3, i32 3)
ret i32 0
}