xunge/DecIR huggingface dataset:
int _my_getnbr_base_calc(int *nb, int *prevnb, int pow, int curval) {
  if (curval == -1)
    return (-1);
  *nb -= curval * pow;
  if (*prevnb < *nb)
    return (-1);
  *prevnb = *nb;
  return (0);
}


x86 assembly (clang, -O0):
<_my_getnbr_base_calc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
cmpl   $0xffffffff,-0x20(%rbp)
jne    1128 <_my_getnbr_base_calc+0x28>
movl   $0xffffffff,-0x4(%rbp)
jmp    116a <_my_getnbr_base_calc+0x6a>
mov    -0x20(%rbp),%edx
imul   -0x1c(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
sub    %edx,%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    1157 <_my_getnbr_base_calc+0x57>
movl   $0xffffffff,-0x4(%rbp)
jmp    116a <_my_getnbr_base_calc+0x6a>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_my_getnbr_base_calc>:
mov    $0xffffffff,%eax
cmp    $0xffffffff,%ecx
je     111b <_my_getnbr_base_calc+0x1b>
imul   %edx,%ecx
mov    (%rdi),%edx
sub    %ecx,%edx
mov    %edx,(%rdi)
cmp    %edx,(%rsi)
jl     111b <_my_getnbr_base_calc+0x1b>
mov    %edx,(%rsi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @_my_getnbr_base_calc(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %13
12: ; preds = %4
store i32 -1, i32* %5
br label %30
13: ; preds = %4
%14 = load i32, i32* %9
%15 = load i32, i32* %8
%16 = mul nsw i32 %14, %15
%17 = load i32*, i32** %6
%18 = load i32, i32* %17
%19 = sub nsw i32 %18, %16
store i32 %19, i32* %17
%20 = load i32*, i32** %7
%21 = load i32, i32* %20
%22 = load i32*, i32** %6
%23 = load i32, i32* %22
%24 = icmp slt i32 %21, %23
br i1 %24, label %25, label %26
25: ; preds = %13
store i32 -1, i32* %5
br label %30
26: ; preds = %13
%27 = load i32*, i32** %6
%28 = load i32, i32* %27
%29 = load i32*, i32** %7
store i32 %28, i32* %29
store i32 0, i32* %5
br label %30
30: ; preds = %26, %25, %12
%31 = load i32, i32* %5
ret i32 %31
}

LLVM IR (-O2):
define i32 @_my_getnbr_base_calc(i32* nocapture %0, i32* nocapture %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %3, -1
br i1 %5, label %13, label %6
6: ; preds = %4
%7 = mul nsw i32 %3, %2
%8 = load i32, i32* %0
%9 = sub nsw i32 %8, %7
store i32 %9, i32* %0
%10 = load i32, i32* %1
%11 = icmp slt i32 %10, %9
br i1 %11, label %13, label %12
12: ; preds = %6
store i32 %9, i32* %1
br label %13
13: ; preds = %6, %4, %12
%14 = phi i32 [ 0, %12 ], [ -1, %4 ], [ -1, %6 ]
ret i32 %14
}
void caller_1_1_1_2_2_2_2() {}


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

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

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

LLVM IR (-O2):
define void @caller_1_1_1_2_2_2_2() {
ret void
}
void XWhitePixelOfScreen() {}


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

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

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

LLVM IR (-O2):
define void @XWhitePixelOfScreen() {
ret void
}
void XkbBell() {}


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

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

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

LLVM IR (-O2):
define void @XkbBell() {
ret void
}
void swap2(int *x, int *y) {
  int tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}


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

LLVM IR (-O0):
define void @swap2(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 @swap2(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 */
scalar_t__ isspace(char const);
const char *skipspace(const char *s) {
  while (isspace(*s))
    s++;
  return s;
}


x86 assembly (clang, -O0):
<skipspace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     1143 <skipspace+0x33>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <skipspace+0xc>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipspace>:
push   %rbx
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rbx
nopl   0x0(%rax,%rax,1)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <isspace@plt>
test   %rax,%rax
jne    1120 <skipspace+0x10>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @skipspace(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %8, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = call i64 @isspace(i8 signext %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %2
br label %3
11: ; preds = %3
%12 = load i8*, i8** %2
ret i8* %12
}

LLVM IR (-O2):
define i8* @skipspace(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %7, %2 ]
%4 = load i8, i8* %3
%5 = tail call i64 @isspace(i8 signext %4)
%6 = icmp eq i64 %5, 0
%7 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %6, label %8, label %2
8: ; preds = %2
ret i8* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_add_epi32(int /*<<< orphan*/ const,
                                 int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm_srai_epi32(int /*<<< orphan*/, int);
int /*<<< orphan*/ _mm_unpackhi_epi16(int /*<<< orphan*/ const,
                                      int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm_unpacklo_epi16(int /*<<< orphan*/ const,
                                      int /*<<< orphan*/ const);
__m128i sum_to_32bit_sse2(const __m128i sum) {
  const __m128i sum_lo = _mm_srai_epi32(_mm_unpacklo_epi16(sum, sum), 16);
  const __m128i sum_hi = _mm_srai_epi32(_mm_unpackhi_epi16(sum, sum), 16);
  return _mm_add_epi32(sum_lo, sum_hi);
}


x86 assembly (clang, -O0):
<sum_to_32bit_sse2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1060 <_mm_unpacklo_epi16@plt>
mov    %eax,%edi
mov    $0x10,%esi
call   1050 <_mm_srai_epi32@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1030 <_mm_unpackhi_epi16@plt>
mov    %eax,%edi
mov    $0x10,%esi
call   1050 <_mm_srai_epi32@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <_mm_add_epi32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum_to_32bit_sse2>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    %edi,%esi
call   1060 <_mm_unpacklo_epi16@plt>
mov    %eax,%edi
mov    $0x10,%esi
call   1050 <_mm_srai_epi32@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    %ebx,%esi
call   1030 <_mm_unpackhi_epi16@plt>
mov    %eax,%edi
mov    $0x10,%esi
call   1050 <_mm_srai_epi32@plt>
mov    %ebp,%edi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <_mm_add_epi32@plt>

LLVM IR (-O0):
define i32 @sum_to_32bit_sse2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @_mm_unpacklo_epi16(i32 %5, i32 %6)
%8 = call i32 @_mm_srai_epi32(i32 %7, i32 16)
store i32 %8, i32* %3
%9 = load i32, i32* %2
%10 = load i32, i32* %2
%11 = call i32 @_mm_unpackhi_epi16(i32 %9, i32 %10)
%12 = call i32 @_mm_srai_epi32(i32 %11, i32 16)
store i32 %12, i32* %4
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = call i32 @_mm_add_epi32(i32 %13, i32 %14)
ret i32 %15
}

LLVM IR (-O2):
define i32 @sum_to_32bit_sse2(i32 %0) {
%2 = tail call i32 @_mm_unpacklo_epi16(i32 %0, i32 %0)
%3 = tail call i32 @_mm_srai_epi32(i32 %2, i32 16)
%4 = tail call i32 @_mm_unpackhi_epi16(i32 %0, i32 %0)
%5 = tail call i32 @_mm_srai_epi32(i32 %4, i32 16)
%6 = tail call i32 @_mm_add_epi32(i32 %3, i32 %5)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ jerry_port_console(char *, char *);
void print_help(char *name) {
  jerry_port_console("Usage: %s [OPTION]... [FILE]...\n"
                     "\n"
                     "Options:\n"
                     "  --log-level [0-3]\n"
                     "  --mem-stats\n"
                     "  --mem-stats-separate\n"
                     "  --show-opcodes\n"
                     "  --start-debug-server\n"
                     "\n",
                     name);
}


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

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

LLVM IR (-O0):
@.str = [141 x i8] c"Usage: %s [OPTION]... [FILE]...\0A\0AOptions:\0A --log-level [0-3]\0A --mem-stats\0A --mem-stats-separate\0A --show-opcodes\0A --start-debug-server\0A\0A\00"
define void @print_help(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @jerry_port_console(i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [141 x i8] c"Usage: %s [OPTION]... [FILE]...\0A\0AOptions:\0A --log-level [0-3]\0A --mem-stats\0A --mem-stats-separate\0A --show-opcodes\0A --start-debug-server\0A\0A\00"
define void @print_help(i8* %0) {
%2 = tail call i32 @jerry_port_console(i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LDDR(int, int, int, int);
void op_ED_0xb8(void) {
  LDDR(12, 17, 4, 7);
  return;
}


x86 assembly (clang, -O0):
<op_ED_0xb8>:
push   %rbp
mov    %rsp,%rbp
mov    $0xc,%edi
mov    $0x11,%esi
mov    $0x4,%edx
mov    $0x7,%ecx
call   1030 <LDDR@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_ED_0xb8>:
mov    $0xc,%edi
mov    $0x11,%esi
mov    $0x4,%edx
mov    $0x7,%ecx
jmp    1030 <LDDR@plt>

LLVM IR (-O0):
define void @op_ED_0xb8() {
%1 = call i32 @LDDR(i32 12, i32 17, i32 4, i32 7)
ret void
}

LLVM IR (-O2):
define void @op_ED_0xb8() {
%1 = tail call i32 @LDDR(i32 12, i32 17, i32 4, i32 7)
ret void
}
/* Variables and functions */
int CountingDifference(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int n = 100;
  printf("%d\n", CountingDifference(n));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x64,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <CountingDifference@plt>
mov    %eax,%esi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @CountingDifference(i32 100)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
char getchar(void) {
  while (((*((volatile unsigned long *)0x7F005018)) & (1 << 6)) == 0 &&
         ((*((volatile unsigned long *)0x7F005018)) & 0x3f) == 0)
    ;
  return (*((volatile unsigned char *)0x7F005024));
}


x86 assembly (clang, -O0):
<getchar>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <getchar+0x9>
mov    $0x7f005018,%eax
mov    (%rax),%rcx
and    $0x40,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x1(%rbp)
jne    113a <getchar+0x3a>
mov    $0x7f005018,%eax
mov    (%rax),%rax
and    $0x3f,%rax
cmp    $0x0,%rax
sete   %al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
test   $0x1,%al
jne    114a <getchar+0x4a>
jmp    114f <getchar+0x4f>
jmp    1109 <getchar+0x9>
mov    $0x7f005024,%eax
mov    (%rax),%al
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getchar>:
testq  $0x40,0x7f005018
jne    111c <getchar+0x1c>
testq  $0x3f,0x7f005018
je     1100 <getchar>
mov    0x7f005024,%al
ret

LLVM IR (-O0):
define signext i8 @getchar() {
br label %1
1: ; preds = %11, %0
%2 = load volatile i64, i64* inttoptr (i64 2130726936 to i64*)
%3 = and i64 %2, 64
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load volatile i64, i64* inttoptr (i64 2130726936 to i64*)
%7 = and i64 %6, 63
%8 = icmp eq i64 %7, 0
br label %9
9: ; preds = %5, %1
%10 = phi i1 [ false, %1 ], [ %8, %5 ]
br i1 %10, label %11, label %12
11: ; preds = %9
br label %1
12: ; preds = %9
%13 = load volatile i8, i8* inttoptr (i64 2130726948 to i8*)
ret i8 %13
}

LLVM IR (-O2):
define signext i8 @getchar() {
br label %1
1: ; preds = %5, %0
%2 = load volatile i64, i64* inttoptr (i64 2130726936 to i64*)
%3 = and i64 %2, 64
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load volatile i64, i64* inttoptr (i64 2130726936 to i64*)
%7 = and i64 %6, 63
%8 = icmp eq i64 %7, 0
br i1 %8, label %1, label %9
9: ; preds = %1, %5
%10 = load volatile i8, i8* inttoptr (i64 2130726948 to i8*)
ret i8 %10
}
/* Variables and functions */
scalar_t__ COND_EQ();
int /*<<< orphan*/ EA_A7_PI_8();
int /*<<< orphan*/ m68ki_write_8(int /*<<< orphan*/, int);
void m68k_op_seq_8_pi7(void) {
  m68ki_write_8(EA_A7_PI_8(), COND_EQ() ? 0xff : 0);
}


x86 assembly (clang, -O0):
<m68k_op_seq_8_pi7>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <EA_A7_PI_8@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1040 <COND_EQ@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rcx
xor    %esi,%esi
mov    $0xff,%eax
cmp    $0x0,%rcx
cmovne %eax,%esi
call   1050 <m68ki_write_8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m68k_op_seq_8_pi7>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <EA_A7_PI_8@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <COND_EQ@plt>
test   %rax,%rax
mov    $0xff,%esi
cmove  %ebp,%esi
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <m68ki_write_8@plt>

LLVM IR (-O0):
define void @m68k_op_seq_8_pi7() {
%1 = call i32 (...) @EA_A7_PI_8()
%2 = call i64 (...) @COND_EQ()
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i64
%5 = select i1 %3, i32 255, i32 0
%6 = call i32 @m68ki_write_8(i32 %1, i32 %5)
ret void
}

LLVM IR (-O2):
define void @m68k_op_seq_8_pi7() {
%1 = tail call i32 (...) @EA_A7_PI_8()
%2 = tail call i64 (...) @COND_EQ()
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 0, i32 255
%5 = tail call i32 @m68ki_write_8(i32 %1, i32 %4)
ret void
}
int num2eng(int number) {
  if (number >= 0 && number <= 17)
    return ((number / 3) * 10 + (number % 3));
  else
    return -1;
}


x86 assembly (clang, -O0):
<num2eng>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1144 <num2eng+0x44>
cmpl   $0x11,-0x8(%rbp)
jg     1144 <num2eng+0x44>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
imul   $0xa,%eax,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    -0xc(%rbp),%eax
add    %edx,%eax
mov    %eax,-0x4(%rbp)
jmp    114b <num2eng+0x4b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<num2eng>:
mov    $0xffffffff,%eax
cmp    $0x11,%edi
ja     1125 <num2eng+0x25>
movzbl %dil,%eax
imul   $0xab,%eax,%ecx
shr    $0x9,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rcx,2),%ecx
sub    %cl,%al
movzbl %al,%eax
lea    (%rax,%rdx,2),%eax
ret

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

LLVM IR (-O2):
define i32 @num2eng(i32 %0) {
%2 = icmp ult i32 %0, 18
br i1 %2, label %3, label %11
3: ; preds = %1
%4 = trunc i32 %0 to i8
%5 = udiv i8 %4, 3
%6 = zext i8 %5 to i32
%7 = mul nuw nsw i32 %6, 10
%8 = urem i8 %4, 3
%9 = zext i8 %8 to i32
%10 = add nuw nsw i32 %7, %9
br label %11
11: ; preds = %1, %3
%12 = phi i32 [ %10, %3 ], [ -1, %1 ]
ret i32 %12
}
unsigned char med3(unsigned char a, unsigned char b, unsigned char c) {
  unsigned char t;
  if (a > b) {
    t = a;
    a = b;
    b = t;
  };
  if (b > c) {
    t = b;
    b = c;
    c = t;
  };
  if (a > b)
    b = a;
  return b;
}


x86 assembly (clang, -O0):
<med3>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %cl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
movzbl -0x1(%rbp),%eax
movzbl -0x2(%rbp),%ecx
cmp    %ecx,%eax
jle    1137 <med3+0x37>
mov    -0x1(%rbp),%al
mov    %al,-0x4(%rbp)
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
mov    -0x4(%rbp),%al
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
movzbl -0x3(%rbp),%ecx
cmp    %ecx,%eax
jle    1159 <med3+0x59>
mov    -0x2(%rbp),%al
mov    %al,-0x4(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x4(%rbp),%al
mov    %al,-0x3(%rbp)
movzbl -0x1(%rbp),%eax
movzbl -0x2(%rbp),%ecx
cmp    %ecx,%eax
jle    116f <med3+0x6f>
mov    -0x1(%rbp),%al
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<med3>:
cmp    %sil,%dil
mov    %edi,%eax
cmova  %esi,%eax
cmova  %edi,%esi
cmp    %dl,%sil
cmova  %edx,%esi
cmp    %sil,%al
cmovbe %esi,%eax
ret

LLVM IR (-O0):
define zeroext i8 @med3(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
store i8 %0, i8* %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%8 = load i8, i8* %4
%9 = zext i8 %8 to i32
%10 = load i8, i8* %5
%11 = zext i8 %10 to i32
%12 = icmp sgt i32 %9, %11
br i1 %12, label %13, label %17
13: ; preds = %3
%14 = load i8, i8* %4
store i8 %14, i8* %7
%15 = load i8, i8* %5
store i8 %15, i8* %4
%16 = load i8, i8* %7
store i8 %16, i8* %5
br label %17
17: ; preds = %13, %3
%18 = load i8, i8* %5
%19 = zext i8 %18 to i32
%20 = load i8, i8* %6
%21 = zext i8 %20 to i32
%22 = icmp sgt i32 %19, %21
br i1 %22, label %23, label %27
23: ; preds = %17
%24 = load i8, i8* %5
store i8 %24, i8* %7
%25 = load i8, i8* %6
store i8 %25, i8* %5
%26 = load i8, i8* %7
store i8 %26, i8* %6
br label %27
27: ; preds = %23, %17
%28 = load i8, i8* %4
%29 = zext i8 %28 to i32
%30 = load i8, i8* %5
%31 = zext i8 %30 to i32
%32 = icmp sgt i32 %29, %31
br i1 %32, label %33, label %35
33: ; preds = %27
%34 = load i8, i8* %4
store i8 %34, i8* %5
br label %35
35: ; preds = %33, %27
%36 = load i8, i8* %5
ret i8 %36
}

LLVM IR (-O2):
define zeroext i8 @med3(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = icmp ugt i8 %0, %1
%5 = select i1 %4, i8 %1, i8 %0
%6 = select i1 %4, i8 %0, i8 %1
%7 = icmp ugt i8 %6, %2
%8 = select i1 %7, i8 %2, i8 %6
%9 = icmp ugt i8 %5, %8
%10 = select i1 %9, i8 %5, i8 %8
ret i8 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ wint_t;
typedef int /*<<< orphan*/ wchar_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputwc(int /*<<< orphan*/, int /*<<< orphan*/ *);
wint_t putwc(wchar_t c, FILE *f) { return fputwc(c, f); }


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

x86 assembly (clang, -O2):
<putwc>:
jmp    1030 <fputwc@plt>

LLVM IR (-O0):
define i32 @putwc(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 = call i32 @fputwc(i32 %5, i32* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @putwc(i32 %0, i32* %1) {
%3 = tail call i32 @fputwc(i32 %0, i32* %1)
ret i32 %3
}
void AssetCreateController(struct _Asset *asset) {}


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

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

LLVM IR (-O0):
%struct._Asset = type opaque
define void @AssetCreateController(%struct._Asset* %0) {
%2 = alloca %struct._Asset*
store %struct._Asset* %0, %struct._Asset** %2
ret void
}

LLVM IR (-O2):
%struct._Asset = type opaque
define void @AssetCreateController(%struct._Asset* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(char *);
char *malloc(int);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *mkcopy(char *s, char *es) {
  int n = es - s;
  char *c = malloc(n + 1);
  assert(c);
  strncpy(c, s, n);
  c[n] = 0;
  return c;
}


x86 assembly (clang, -O0):
<mkcopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
add    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <assert@plt>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkcopy>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
sub    %rdi,%r15
lea    0x1(%r15),%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1030 <strncpy@plt>
movslq %r15d,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @mkcopy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
%8 = load i8*, i8** %3
%9 = ptrtoint i8* %7 to i64
%10 = ptrtoint i8* %8 to i64
%11 = sub i64 %9, %10
%12 = trunc i64 %11 to i32
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = add nsw i32 %13, 1
%15 = call i8* @malloc(i32 %14)
store i8* %15, i8** %6
%16 = load i8*, i8** %6
%17 = call i32 @assert(i8* %16)
%18 = load i8*, i8** %6
%19 = load i8*, i8** %3
%20 = load i32, i32* %5
%21 = call i32 @strncpy(i8* %18, i8* %19, i32 %20)
%22 = load i8*, i8** %6
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
store i8 0, i8* %25
%26 = load i8*, i8** %6
ret i8* %26
}

LLVM IR (-O2):
define i8* @mkcopy(i8* %0, i8* %1) {
%3 = ptrtoint i8* %1 to i64
%4 = ptrtoint i8* %0 to i64
%5 = sub i64 %3, %4
%6 = trunc i64 %5 to i32
%7 = add nsw i32 %6, 1
%8 = tail call i8* @malloc(i32 %7)
%9 = tail call i32 @assert(i8* %8)
%10 = tail call i32 @strncpy(i8* %8, i8* %0, i32 %6)
%11 = shl i64 %5, 32
%12 = ashr exact i64 %11, 32
%13 = getelementptr inbounds i8, i8* %8, i64 %12
store i8 0, i8* %13
ret i8* %8
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int32_t FixedToRoundedInt(int32_t val) { return (val + 0x800) >> 12; }


x86 assembly (clang, -O0):
<FixedToRoundedInt>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x800,%eax
sar    $0xc,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FixedToRoundedInt>:
lea    0x800(%rdi),%eax
sar    $0xc,%eax
ret

LLVM IR (-O0):
define i32 @FixedToRoundedInt(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 2048
%5 = ashr i32 %4, 12
ret i32 %5
}

LLVM IR (-O2):
define i32 @FixedToRoundedInt(i32 %0) {
%2 = add nsw i32 %0, 2048
%3 = ashr i32 %2, 12
ret i32 %3
}
/* Variables and functions */
int STDERR_FILENO;
int STDOUT_FILENO;
int _isatty(int fd) {
  if (fd == STDOUT_FILENO || fd == STDERR_FILENO)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<_isatty>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2edf(%rip),%rcx
cmp    (%rcx),%eax
je     112b <_isatty+0x2b>
mov    -0x8(%rbp),%eax
mov    0x2eb5(%rip),%rcx
cmp    (%rcx),%eax
jne    1137 <_isatty+0x37>
movl   $0x1,-0x4(%rbp)
jmp    113e <_isatty+0x3e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_isatty>:
mov    0x2ee9(%rip),%rax
cmp    %edi,(%rax)
sete   %al
mov    0x2ec5(%rip),%rcx
cmp    %edi,(%rcx)
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
@STDOUT_FILENO = global i32 0
@STDERR_FILENO = global i32 0
define i32 @_isatty(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = load i32, i32* @STDOUT_FILENO
%6 = icmp eq i32 %4, %5
br i1 %6, label %11, label %7
7: ; preds = %1
%8 = load i32, i32* %3
%9 = load i32, i32* @STDERR_FILENO
%10 = icmp eq i32 %8, %9
br i1 %10, label %11, label %12
11: ; preds = %7, %1
store i32 1, i32* %2
br label %13
12: ; preds = %7
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@STDOUT_FILENO = global i32 0
@STDERR_FILENO = global i32 0
define i32 @_isatty(i32 %0) {
%2 = load i32, i32* @STDOUT_FILENO
%3 = icmp eq i32 %2, %0
%4 = load i32, i32* @STDERR_FILENO
%5 = icmp eq i32 %4, %0
%6 = select i1 %3, i1 true, i1 %5
%7 = zext i1 %6 to i32
ret i32 %7
}
char *sccsid(void) {
  return ("@(#)sysstat-"
          "8.1.5"
          ": "
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/odit/rv042/refs/heads/master/linux/"
          "embedded_rootfs/pkg_addon/sysstat-8.1.5/sar.c"
          " compiled "
          "Mar 16 2022"
          " "
          "17:12:43");
}


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

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

LLVM IR (-O0):
@.str = [220 x i8] c"@(#)sysstat-8.1.5: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/odit/rv042/refs/heads/master/linux/embedded_rootfs/pkg_addon/sysstat-8.1.5/sar.c compiled Mar 16 2022 17:12:43\00"
define i8* @sccsid() {
ret i8* getelementptr inbounds ([220 x i8], [220 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [220 x i8] c"@(#)sysstat-8.1.5: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/odit/rv042/refs/heads/master/linux/embedded_rootfs/pkg_addon/sysstat-8.1.5/sar.c compiled Mar 16 2022 17:12:43\00"
define i8* @sccsid() {
ret i8* getelementptr inbounds ([220 x i8], [220 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char *);
void EssentialFunc11(char *Input) {
  char Buffer2S[60];
  strcpy(Buffer2S, Input);
}


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

x86 assembly (clang, -O2):
<EssentialFunc11>:
sub    $0x48,%rsp
mov    %rdi,%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
add    $0x48,%rsp
ret

LLVM IR (-O0):
define void @EssentialFunc11(i8* %0) {
%2 = alloca i8*
%3 = alloca [60 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [60 x i8], [60 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = call i32 @strcpy(i8* %4, i8* %5)
ret void
}

LLVM IR (-O2):
define void @EssentialFunc11(i8* %0) {
%2 = alloca [60 x i8]
%3 = getelementptr inbounds [60 x i8], [60 x i8]* %2, i64 0, i64 0
%4 = call i32 @strcpy(i8* %3, i8* %0)
ret void
}
/* Variables and functions */
void *malloc(int);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *);
int main(void) {
  void *p = malloc(128);
  printf("allocating 128 bytes of memory\n");
  while (1) {
    memset(p, 0, 128);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x80,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
jmp    1159 <main+0x29>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x80,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
jmp    1150 <main+0x20>

LLVM IR (-O0):
@.str = [32 x i8] c"allocating 128 bytes of memory\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i8* @malloc(i32 128)
store i8* %3, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %0, %5
%6 = load i8*, i8** %2
%7 = call i32 @memset(i8* %6, i32 0, i32 128)
br label %5
}

LLVM IR (-O2):
@str = [31 x i8] c"allocating 128 bytes of memory\00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(128) i8* @malloc(i32 128)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
br label %3
3: ; preds = %3, %0
%4 = tail call i32 @memset(i8* %1, i32 0, i32 128)
br label %3
}
/* Variables and functions */
char *calloc(size_t, int);
size_t strlen(char *);
char *strncpy(char *, char *, size_t);
char *common_strdup(char *input) {
  char *duplicate = NULL;
  size_t length = strlen(input);
  duplicate = calloc(length + 1, sizeof(char));
  if (!duplicate) {
    return NULL;
  }
  return strncpy(duplicate, input, length);
}


x86 assembly (clang, -O0):
<common_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
add    $0x1,%rdi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    117f <common_strdup+0x4f>
movq   $0x0,-0x8(%rbp)
jmp    1194 <common_strdup+0x64>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <strncpy@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<common_strdup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1040 <strlen@plt>
mov    %rax,%r15
lea    0x1(%rax),%rdi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1164 <common_strdup+0x34>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <strncpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @common_strdup(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, 1
%4 = tail call i8* @calloc(i64 %3, i32 1)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i8* @strncpy(i8* %4, i8* %0, i64 %2)
br label %8
8: ; preds = %1, %6
ret i8* %4
}
/* Variables and functions */
char toupper(char);
void capitalize(void *string) {
  for (char *chars = *(char **)string; *chars != '\0'; ++chars) {
    *chars = toupper(*chars);
  }
}


x86 assembly (clang, -O0):
<capitalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     115c <capitalize+0x4c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1127 <capitalize+0x17>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @capitalize(i8* nocapture %0) {
%2 = bitcast i8* %0 to i8**
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %7, %1
ret void
7: ; preds = %1, %7
%8 = phi i8 [ %12, %7 ], [ %4, %1 ]
%9 = phi i8* [ %11, %7 ], [ %3, %1 ]
%10 = tail call signext i8 @toupper(i8 signext %8)
store i8 %10, i8* %9
%11 = getelementptr inbounds i8, i8* %9, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %6, label %7
}
/* Variables and functions */
int get_pages();
int getpagesize();
double mem_size(void) { return (double)(getpagesize() * get_pages()); }


x86 assembly (clang, -O0):
<mem_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <getpagesize@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <get_pages@plt>
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_size>:
push   %rbx
xor    %eax,%eax
call   1040 <getpagesize@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <get_pages@plt>
imul   %ebx,%eax
cvtsi2sd %eax,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define double @mem_size() {
%1 = call i32 (...) @getpagesize()
%2 = call i32 (...) @get_pages()
%3 = mul nsw i32 %1, %2
%4 = sitofp i32 %3 to double
ret double %4
}

LLVM IR (-O2):
define double @mem_size() {
%1 = tail call i32 (...) @getpagesize()
%2 = tail call i32 (...) @get_pages()
%3 = mul nsw i32 %2, %1
%4 = sitofp i32 %3 to double
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
int main() {
  int a = 3;
  int b = 2;
  double f = (double)a / b;
  printf("%f\n", f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
movsd  0xee0(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
store i32 0, i32* %1
store i32 3, i32* %2
store i32 2, i32* %3
%5 = load i32, i32* %2
%6 = sitofp i32 %5 to double
%7 = load i32, i32* %3
%8 = sitofp i32 %7 to double
%9 = fdiv double %6, %8
store double %9, double* %4
%10 = load double, double* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 1.500000e+00)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sync();
int hogio() {
  while (1)
    sync();
  return 0;
}


x86 assembly (clang, -O0):
<hogio>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <hogio+0x9>
mov    $0x0,%al
call   1030 <sync@plt>
jmp    1119 <hogio+0x9>

x86 assembly (clang, -O2):
<hogio>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <sync@plt>
jmp    1120 <hogio+0x10>

LLVM IR (-O0):
define i32 @hogio() {
br label %1
1: ; preds = %0, %1
%2 = call i32 (...) @sync()
br label %1
}

LLVM IR (-O2):
define i32 @hogio() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 (...) @sync()
br label %1
}
void main_loop(void *arg) {}


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

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

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

LLVM IR (-O2):
define void @main_loop(i8* nocapture %0) {
ret void
}
unsigned long getsrvaddress(char *host, int *port, char *srv) { return 0; }


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

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

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

LLVM IR (-O2):
define i64 @getsrvaddress(i8* nocapture readnone %0, i32* nocapture readnone %1, i8* nocapture readnone %2) {
ret i64 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int population = 9870, count_years = 0;
  while (population < 30000) {
    population *= 1.1;
    count_years++;
  }
  printf("It will take %d years\n", count_years);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x268e,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x7530,-0x8(%rbp)
jge    1160 <main+0x50>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xeb9(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <main+0x1d>
mov    -0xc(%rbp),%esi
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [23 x i8] c"It will take %d years\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 9870, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %7, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 30000
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32, i32* %2
%9 = sitofp i32 %8 to double
%10 = fmul double %9, 1.100000e+00
%11 = fptosi double %10 to i32
store i32 %11, i32* %2
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %4
14: ; preds = %4
%15 = load i32, i32* %3
%16 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"It will take %d years\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 12)
ret i32 0
}
/* Variables and functions */
int read(int, char *, int);
int readch(void) {
  char c;
  if (read(2, &c, 1) < 1)
    c = 0;
  return (c);
}


x86 assembly (clang, -O0):
<readch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x2,%edi
lea    -0x1(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
cmp    $0x1,%eax
jge    1138 <readch+0x28>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readch>:
push   %rax
lea    0x7(%rsp),%rsi
mov    $0x2,%edi
mov    $0x1,%edx
call   1030 <read@plt>
movsbl 0x7(%rsp),%edx
xor    %ecx,%ecx
test   %eax,%eax
cmovg  %edx,%ecx
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @readch() {
%1 = alloca i8
%2 = call i32 @read(i32 2, i8* %1, i32 1)
%3 = icmp slt i32 %2, 1
br i1 %3, label %4, label %5
4: ; preds = %0
store i8 0, i8* %1
br label %5
5: ; preds = %4, %0
%6 = load i8, i8* %1
%7 = sext i8 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @readch() {
%1 = alloca i8
%2 = call i32 @read(i32 2, i8* %1, i32 1)
%3 = load i8, i8* %1
%4 = sext i8 %3 to i32
%5 = icmp sgt i32 %2, 0
%6 = select i1 %5, i32 %4, i32 0
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ Cffempty();
extern void ftddef_(void) {
  ;
  Cffempty();
  return;
}


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

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

LLVM IR (-O0):
define void @ftddef_() {
%1 = call i32 (...) @Cffempty()
ret void
}

LLVM IR (-O2):
define void @ftddef_() {
%1 = tail call i32 (...) @Cffempty()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, int,
                           char const *);
int /*<<< orphan*/ stderr;
int do_bug_on(int cond, const char *condstr, const char *file, int line) {
  if (cond)
    fprintf(stderr, "%s:%d: internal error: %s\n", file, line, condstr);
  return cond;
}


x86 assembly (clang, -O0):
<do_bug_on>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1150 <do_bug_on+0x40>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%r8
lea    0xeb5(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_bug_on>:
push   %rbx
mov    %edi,%ebx
test   %edi,%edi
je     112f <do_bug_on+0x1f>
mov    %rsi,%r8
mov    0x2ebf(%rip),%rax
mov    (%rax),%edi
lea    0xed6(%rip),%rsi
call   1030 <fprintf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [27 x i8] c"%s:%d: internal error: %s\0A\00"
define i32 @do_bug_on(i32 %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %4
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %7
%14 = load i32, i32* %8
%15 = load i8*, i8** %6
%16 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %13, i32 %14, i8* %15)
br label %17
17: ; preds = %11, %4
%18 = load i32, i32* %5
ret i32 %18
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"%s:%d: internal error: %s\0A\00"
define i32 @do_bug_on(i32 returned %0, i8* %1, i8* %2, i32 %3) {
%5 = icmp eq i32 %0, 0
br i1 %5, label %9, label %6
6: ; preds = %4
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %3, i8* %1)
br label %9
9: ; preds = %6, %4
ret i32 %0
}
void enable_branch_predictor(void) {}


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

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

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

LLVM IR (-O2):
define void @enable_branch_predictor() {
ret void
}
/* Variables and functions */
int atof(char const *);
double get_base_sixty(const char *buff) {
  return (atof(buff) + atof(buff + 3) / 60. + atof(buff + 6) / 3600.);
}


x86 assembly (clang, -O0):
<get_base_sixty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <atof@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x3,%rdi
call   1030 <atof@plt>
movsd  -0x18(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
movsd  0xebc(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x6,%rdi
call   1030 <atof@plt>
movsd  -0x10(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
movsd  0xe89(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_base_sixty>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <atof@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%rsp)
lea    0x3(%rbx),%rdi
call   1030 <atof@plt>
mov    %eax,%ebp
add    $0x6,%rbx
mov    %rbx,%rdi
call   1030 <atof@plt>
movd   %ebp,%xmm0
movd   %eax,%xmm1
punpckldq %xmm1,%xmm0
cvtdq2pd %xmm0,%xmm0
divpd  0xead(%rip),%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @get_base_sixty(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @atof(i8* %3)
%5 = sitofp i32 %4 to double
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i64 3
%8 = call i32 @atof(i8* %7)
%9 = sitofp i32 %8 to double
%10 = fdiv double %9, 6.000000e+01
%11 = fadd double %5, %10
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i64 6
%14 = call i32 @atof(i8* %13)
%15 = sitofp i32 %14 to double
%16 = fdiv double %15, 3.600000e+03
%17 = fadd double %11, %16
ret double %17
}

LLVM IR (-O2):
define double @get_base_sixty(i8* nocapture %0) {
%2 = tail call i32 @atof(i8* %0)
%3 = sitofp i32 %2 to double
%4 = getelementptr inbounds i8, i8* %0, i64 3
%5 = tail call i32 @atof(i8* %4)
%6 = getelementptr inbounds i8, i8* %0, i64 6
%7 = tail call i32 @atof(i8* %6)
%8 = insertelement <2 x i32> poison, i32 %5, i64 0
%9 = insertelement <2 x i32> %8, i32 %7, i64 1
%10 = sitofp <2 x i32> %9 to <2 x double>
%11 = fdiv <2 x double> %10, <double 6.000000e+01, double 3.600000e+03>
%12 = extractelement <2 x double> %11, i64 0
%13 = fadd double %12, %3
%14 = extractelement <2 x double> %11, i64 1
%15 = fadd double %13, %14
ret double %15
}
/* Variables and functions */
int /*<<< orphan*/ saveFile();
int main() { saveFile(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @saveFile()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @saveFile()
ret i32 0
}
void dfn_rv(void) { return; }


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

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

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

LLVM IR (-O2):
define void @dfn_rv() {
ret void
}