xunge/DecIR huggingface dataset:
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t load32(const void *src) {
  const uint8_t *p = (const uint8_t *)src;
  return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) |
         ((uint32_t)(p[2]) << 16) | ((uint32_t)(p[3]) << 24);
}


x86 assembly (clang, -O0):
<load32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
shl    $0x0,%eax
mov    -0x10(%rbp),%rcx
mov    0x8(%rcx),%rcx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x10(%rcx),%rcx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x18(%rcx),%rcx
shl    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<load32>:
mov    0x8(%rdi),%ecx
mov    0x10(%rdi),%edx
shl    $0x8,%ecx
or     (%rdi),%ecx
shl    $0x10,%edx
mov    0x18(%rdi),%eax
shl    $0x18,%eax
or     %edx,%eax
or     %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @load32(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
%5 = getelementptr inbounds i8, i8* %0, i64 8
%6 = bitcast i8* %5 to i64*
%7 = load i64, i64* %6
%8 = trunc i64 %7 to i32
%9 = shl i32 %8, 8
%10 = or i32 %9, %4
%11 = getelementptr inbounds i8, i8* %0, i64 16
%12 = bitcast i8* %11 to i64*
%13 = load i64, i64* %12
%14 = trunc i64 %13 to i32
%15 = shl i32 %14, 16
%16 = or i32 %10, %15
%17 = getelementptr inbounds i8, i8* %0, i64 24
%18 = bitcast i8* %17 to i64*
%19 = load i64, i64* %18
%20 = trunc i64 %19 to i32
%21 = shl i32 %20, 24
%22 = or i32 %16, %21
ret i32 %22
}
/* Variables and functions */
int /*<<< orphan*/ __util_oom(char const *, char const *, int, size_t);
void *malloc(size_t);
void *__util_malloc(const char *func, const char *file, int line, size_t size) {
  void *buf;
  buf = malloc(size);
  if (buf == NULL)
    __util_oom(func, file, line, size);
  return buf;
}


x86 assembly (clang, -O0):
<__util_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1163 <__util_malloc+0x43>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
call   1030 <__util_oom@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__util_malloc>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%rbx
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%r12
mov    %rcx,%rdi
call   1040 <malloc@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1155 <__util_malloc+0x35>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
mov    %rbx,%rcx
call   1030 <__util_oom@plt>
mov    %rbp,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define noalias i8* @__util_malloc(i8* %0, i8* %1, i32 %2, i64 %3) {
%5 = tail call i8* @malloc(i64 %3)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 @__util_oom(i8* %0, i8* %1, i32 %2, i64 %3)
br label %9
9: ; preds = %7, %4
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ curs_set(int /*<<< orphan*/);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ keypad(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ raw();
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ stdscr;
void initialize_ncurses(void) {
  initscr();
  raw();
  noecho();
  curs_set(0);
  keypad(stdscr, TRUE);
  refresh();
}


x86 assembly (clang, -O0):
<initialize_ncurses>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <initscr@plt>
mov    $0x0,%al
call   1050 <raw@plt>
mov    $0x0,%al
call   1070 <noecho@plt>
xor    %edi,%edi
call   1080 <curs_set@plt>
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
mov    0x2e50(%rip),%rax
mov    (%rax),%esi
call   1030 <keypad@plt>
mov    $0x0,%al
call   1060 <refresh@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<initialize_ncurses>:
push   %rax
xor    %eax,%eax
call   1040 <initscr@plt>
xor    %eax,%eax
call   1050 <raw@plt>
xor    %eax,%eax
call   1070 <noecho@plt>
xor    %edi,%edi
call   1080 <curs_set@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
mov    0x2e53(%rip),%rax
mov    (%rax),%esi
call   1030 <keypad@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <refresh@plt>

LLVM IR (-O0):
@stdscr = global i32 0
@TRUE = global i32 0
define void @initialize_ncurses() {
%1 = call i32 (...) @initscr()
%2 = call i32 (...) @raw()
%3 = call i32 (...) @noecho()
%4 = call i32 @curs_set(i32 0)
%5 = load i32, i32* @stdscr
%6 = load i32, i32* @TRUE
%7 = call i32 @keypad(i32 %5, i32 %6)
%8 = call i32 (...) @refresh()
ret void
}

LLVM IR (-O2):
@stdscr = global i32 0
@TRUE = global i32 0
define void @initialize_ncurses() {
%1 = tail call i32 (...) @initscr()
%2 = tail call i32 (...) @raw()
%3 = tail call i32 (...) @noecho()
%4 = tail call i32 @curs_set(i32 0)
%5 = load i32, i32* @stdscr
%6 = load i32, i32* @TRUE
%7 = tail call i32 @keypad(i32 %5, i32 %6)
%8 = tail call i32 (...) @refresh()
ret void
}
double fixed_to_float(short x) { return x / 16.0; }


x86 assembly (clang, -O0):
<fixed_to_float>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xee5(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fixed_to_float>:
cvtsi2sd %edi,%xmm0
mulsd  0xef4(%rip),%xmm0
ret

LLVM IR (-O0):
define double @fixed_to_float(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = sitofp i32 %4 to double
%6 = fdiv double %5, 1.600000e+01
ret double %6
}

LLVM IR (-O2):
define double @fixed_to_float(i16 signext %0) {
%2 = sitofp i16 %0 to double
%3 = fmul double %2, 6.250000e-02
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ myPrintHelloWorld();
int main(void) {
  myPrintHelloWorld();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @myPrintHelloWorld()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ send_com(unsigned char, int *);
int ComPortWrite(unsigned char *str, int NumberOfBytes) {
  int error_code;
  int i;
  for (i = 0; i < NumberOfBytes; i++) {
    send_com(str[i], &error_code);
  }
  return 1;
}


x86 assembly (clang, -O0):
<ComPortWrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1155 <ComPortWrite+0x45>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
lea    -0x10(%rbp),%rsi
movzbl (%rax,%rcx,1),%edi
call   1030 <send_com@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <ComPortWrite+0x16>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ComPortWrite>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1146 <ComPortWrite+0x36>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0x4(%rsp),%r14
nopl   0x0(%rax)
movzbl (%r15,%rbx,1),%edi
mov    %r14,%rsi
call   1030 <send_com@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <ComPortWrite+0x20>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @ComPortWrite(i8* nocapture %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %15
6: ; preds = %2
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %13, %8 ]
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = call i32 @send_com(i8 zeroext %11, i32* %3)
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %7
br i1 %14, label %15, label %8
15: ; preds = %8, %2
ret i32 1
}
void uppercase(char *c) {
  char tmp = (*c);
  if (tmp >= 'a' && tmp <= 'z') {
    tmp = tmp - 'a' + 'A';
    *c = tmp;
  }
}


x86 assembly (clang, -O0):
<uppercase>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x61,%eax
jl     1141 <uppercase+0x41>
movsbl -0x9(%rbp),%eax
cmp    $0x7a,%eax
jg     1141 <uppercase+0x41>
movsbl -0x9(%rbp),%eax
sub    $0x61,%eax
add    $0x41,%eax
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<uppercase>:
mov    (%rdi),%al
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
ja     110e <uppercase+0xe>
add    $0xe0,%al
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @uppercase(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
store i8 %5, i8* %3
%6 = load i8, i8* %3
%7 = sext i8 %6 to i32
%8 = icmp sge i32 %7, 97
br i1 %8, label %9, label %21
9: ; preds = %1
%10 = load i8, i8* %3
%11 = sext i8 %10 to i32
%12 = icmp sle i32 %11, 122
br i1 %12, label %13, label %21
13: ; preds = %9
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = sub nsw i32 %15, 97
%17 = add nsw i32 %16, 65
%18 = trunc i32 %17 to i8
store i8 %18, i8* %3
%19 = load i8, i8* %3
%20 = load i8*, i8** %2
store i8 %19, i8* %20
br label %21
21: ; preds = %13, %9, %1
ret void
}

LLVM IR (-O2):
define void @uppercase(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = add i8 %2, -97
%4 = icmp ult i8 %3, 26
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = add nsw i8 %2, -32
store i8 %6, i8* %0
br label %7
7: ; preds = %5, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cal_config(char const *, char const *, char const *,
                              char const *);
int /*<<< orphan*/ view_config(char const *, char const *, char const *,
                               char const *);
void on_config(const char *group, const char *name, const char *key,
               const char *value) {
  view_config(group, name, key, value);
  cal_config(group, name, key, value);
}


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

x86 assembly (clang, -O2):
<on_config>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
call   1040 <view_config@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <cal_config@plt>

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

LLVM IR (-O2):
define void @on_config(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i32 @view_config(i8* %0, i8* %1, i8* %2, i8* %3)
%6 = tail call i32 @cal_config(i8* %0, i8* %1, i8* %2, i8* %3)
ret void
}
unsigned int imapx200_get_pll(unsigned long pllval, unsigned long baseclk) {
  unsigned long odiv, ddiv, mdiv;
  baseclk /= 1000;
  odiv = (pllval & (0x3 << 12)) >> 12;
  ddiv = (pllval & (0x1f << 7)) >> 7;
  mdiv = (pllval & (0x7f << 0)) >> 0;
  return (baseclk * (2 * (mdiv + 1))) / ((ddiv + 1) * (2 << (odiv))) * 1000;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
and    $0x3000,%rax
shr    $0xc,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
and    $0xf80,%rax
shr    $0x7,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
and    $0x7f,%rax
shr    $0x0,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
add    $0x1,%rcx
shl    $0x1,%rcx
imul   %rcx,%rax
mov    -0x20(%rbp),%rcx
add    $0x1,%rcx
mov    %rcx,-0x30(%rbp)
mov    -0x18(%rbp),%rcx
mov    $0x2,%edx
shl    %cl,%edx
mov    -0x30(%rbp),%rcx
movslq %edx,%rdx
imul   %rdx,%rcx
xor    %edx,%edx
div    %rcx
imul   $0x3e8,%rax,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    %rsi,%rax
shr    $0x3,%rax
movabs $0x20c49ba5e353f7cf,%rcx
9b c4 20
mul    %rcx
mov    %rdi,%rcx
shr    $0x4,%rdx
shr    $0x7,%edi
and    $0x1f,%edi
mov    %ecx,%eax
and    $0x7f,%eax
add    %rax,%rax
add    $0x2,%rax
shr    $0xc,%ecx
and    $0x3,%cl
mov    $0x2,%esi
shl    %cl,%esi
imul   %rdx,%rax
add    $0x1,%rdi
imul   %rdi,%rsi
mov    %rax,%rcx
shr    $0x20,%rcx
je     115b <imapx200_get_pll+0x5b>
xor    %edx,%edx
div    %rsi
imul   $0x3e8,%eax,%eax
ret
xor    %edx,%edx
div    %esi
imul   $0x3e8,%eax,%eax
ret

LLVM IR (-O0):
define i32 @imapx200_get_pll(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%8 = load i64, i64* %4
%9 = udiv i64 %8, 1000
store i64 %9, i64* %4
%10 = load i64, i64* %3
%11 = and i64 %10, 12288
%12 = lshr i64 %11, 12
store i64 %12, i64* %5
%13 = load i64, i64* %3
%14 = and i64 %13, 3968
%15 = lshr i64 %14, 7
store i64 %15, i64* %6
%16 = load i64, i64* %3
%17 = and i64 %16, 127
%18 = lshr i64 %17, 0
store i64 %18, i64* %7
%19 = load i64, i64* %4
%20 = load i64, i64* %7
%21 = add i64 %20, 1
%22 = mul i64 2, %21
%23 = mul i64 %19, %22
%24 = load i64, i64* %6
%25 = add i64 %24, 1
%26 = load i64, i64* %5
%27 = trunc i64 %26 to i32
%28 = shl i32 2, %27
%29 = sext i32 %28 to i64
%30 = mul i64 %25, %29
%31 = udiv i64 %23, %30
%32 = mul i64 %31, 1000
%33 = trunc i64 %32 to i32
ret i32 %33
}

LLVM IR (-O2):
define i32 @imapx200_get_pll(i64 %0, i64 %1) {
%3 = udiv i64 %1, 1000
%4 = lshr i64 %0, 7
%5 = and i64 %4, 31
%6 = shl i64 %0, 1
%7 = and i64 %6, 254
%8 = add nuw nsw i64 %7, 2
%9 = mul nuw nsw i64 %8, %3
%10 = add nuw nsw i64 %5, 1
%11 = trunc i64 %0 to i32
%12 = lshr i32 %11, 12
%13 = and i32 %12, 3
%14 = shl nuw nsw i32 2, %13
%15 = zext i32 %14 to i64
%16 = mul nuw nsw i64 %10, %15
%17 = udiv i64 %9, %16
%18 = trunc i64 %17 to i32
%19 = mul i32 %18, 1000
ret i32 %19
}
/* Variables and functions */
int strlen(char const *);
int stringOverRightEdge(char const s[], int x) { return 26 < strlen(s) + x; }


x86 assembly (clang, -O0):
<stringOverRightEdge>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
add    -0xc(%rbp),%ecx
mov    $0x1a,%eax
cmp    %ecx,%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringOverRightEdge>:
push   %rbx
mov    %esi,%ebx
call   1030 <strlen@plt>
add    %ebx,%eax
xor    %ecx,%ecx
cmp    $0x1b,%eax
setge  %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @stringOverRightEdge(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = call i32 @strlen(i8* %5)
%7 = load i32, i32* %4
%8 = add nsw i32 %6, %7
%9 = icmp slt i32 26, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @stringOverRightEdge(i8* %0, i32 %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = add nsw i32 %3, %1
%5 = icmp sgt i32 %4, 26
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int check_arg_count(int, int);
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_error(char *);
void cmd_mvget_wstr(int nargs, char **args) {
  if (check_arg_count(nargs, 1) == 1)
    return;
  report_count(1);
  report_error("UNSUPPORTED");
}


x86 assembly (clang, -O0):
<cmd_mvget_wstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <check_arg_count@plt>
cmp    $0x1,%eax
jne    115a <cmd_mvget_wstr+0x2a>
jmp    1170 <cmd_mvget_wstr+0x40>
mov    $0x1,%edi
call   1040 <report_count@plt>
lea    0xe95(%rip),%rdi
call   1050 <report_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_mvget_wstr>:
push   %rax
mov    $0x1,%esi
call   1030 <check_arg_count@plt>
cmp    $0x1,%eax
jne    1142 <cmd_mvget_wstr+0x12>
pop    %rax
ret
mov    $0x1,%edi
call   1040 <report_count@plt>
lea    0xead(%rip),%rdi
pop    %rax
jmp    1050 <report_error@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"UNSUPPORTED\00"
define void @cmd_mvget_wstr(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = call i32 @check_arg_count(i32 %5, i32 1)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %2
br label %12
9: ; preds = %2
%10 = call i32 @report_count(i32 1)
%11 = call i32 @report_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %9, %8
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"UNSUPPORTED\00"
define void @cmd_mvget_wstr(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @check_arg_count(i32 %0, i32 1)
%4 = icmp eq i32 %3, 1
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @report_count(i32 1)
%7 = tail call i32 @report_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %5
ret void
}
/* Type definitions */
struct option {
  int dummy;
};

/* Variables and functions */
int _getopt_internal(int, char *const *, char const *, struct option const *,
                     int *, int /*<<< orphan*/);
int getopt_long(int ___argc, char *const *___argv, const char *__shortopts,
                const struct option *__longopts, int *__longind) {
  return _getopt_internal(___argc, ___argv, __shortopts, __longopts, __longind,
                          0);
}


x86 assembly (clang, -O0):
<getopt_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
xor    %r9d,%r9d
call   1030 <_getopt_internal@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getopt_long>:
xor    %r9d,%r9d
jmp    1030 <_getopt_internal@plt>

LLVM IR (-O0):
%struct.option = type { i32 }
define i32 @getopt_long(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca %struct.option*
%10 = alloca i32*
store i32 %0, i32* %6
store i8** %1, i8*** %7
store i8* %2, i8** %8
store %struct.option* %3, %struct.option** %9
store i32* %4, i32** %10
%11 = load i32, i32* %6
%12 = load i8**, i8*** %7
%13 = load i8*, i8** %8
%14 = load %struct.option*, %struct.option** %9
%15 = load i32*, i32** %10
%16 = call i32 @_getopt_internal(i32 %11, i8** %12, i8* %13, %struct.option* %14, i32* %15, i32 0)
ret i32 %16
}

LLVM IR (-O2):
%struct.option = type { i32 }
define i32 @getopt_long(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4) {
%6 = tail call i32 @_getopt_internal(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4, i32 0)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void asmfooter() {
  printf("# contents of %%eax will be the exit code\n");
  printf("	leave\n");
  printf("	ret\n");
  printf("	.subsections_via_symbols\n");
}


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

x86 assembly (clang, -O2):
<asmfooter>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <printf@plt>
lea    0xef7(%rip),%rdi
call   1030 <puts@plt>
lea    0xef2(%rip),%rdi
call   1030 <puts@plt>
lea    0xeeb(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [43 x i8] c"# contents of %%eax will be the exit code\0A\00"
@.str.1 = [8 x i8] c"\09leave\0A\00"
@.str.2 = [6 x i8] c"\09ret\0A\00"
@.str.3 = [27 x i8] c"\09.subsections_via_symbols\0A\00"
define void @asmfooter() {
%1 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [43 x i8] c"# contents of %%eax will be the exit code\0A\00"
@str = [7 x i8] c"\09leave\00"
@str.4 = [5 x i8] c"\09ret\00"
@str.5 = [26 x i8] c"\09.subsections_via_symbols\00"
define void @asmfooter() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.4, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.5, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  printf("Course: EG1302A - Spring 2014\n");
  printf("Name: Ewa Nowara\n");
  printf("Date created: %d/%d/%d\n", 01, 28, 2014);
  printf("Assignment: Assignment 05\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
mov    $0x1,%esi
mov    $0x1c,%edx
mov    $0x7de,%ecx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
call   1030 <puts@plt>
lea    0xf02(%rip),%rdi
call   1030 <puts@plt>
lea    0xec0(%rip),%rdi
mov    $0x1,%esi
mov    $0x1c,%edx
mov    $0x7de,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeea(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Course: EG1302A - Spring 2014\0A\00"
@.str.1 = [18 x i8] c"Name: Ewa Nowara\0A\00"
@.str.2 = [24 x i8] c"Date created: %d/%d/%d\0A\00"
@.str.3 = [27 x i8] c"Assignment: Assignment 05\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 28, i32 2014)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [24 x i8] c"Date created: %d/%d/%d\0A\00"
@str = [30 x i8] c"Course: EG1302A - Spring 2014\00"
@str.4 = [17 x i8] c"Name: Ewa Nowara\00"
@str.5 = [26 x i8] c"Assignment: Assignment 05\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 28, i32 2014)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.5, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct sysinfo {
  size_t freeram;
};

/* Variables and functions */
int /*<<< orphan*/ sysinfo(struct sysinfo *);
size_t freeRAM() {
  struct sysinfo info;
  sysinfo(&info);
  return info.freeram;
}


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

x86 assembly (clang, -O2):
<freeRAM>:
push   %rax
mov    %rsp,%rdi
call   1030 <sysinfo@plt>
mov    (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.sysinfo = type { i64 }
define i64 @freeRAM() {
%1 = alloca %struct.sysinfo
%2 = call i32 @sysinfo(%struct.sysinfo* %1)
%3 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i32 0, i32 0
%4 = load i64, i64* %3
ret i64 %4
}

LLVM IR (-O2):
%struct.sysinfo = type { i64 }
define i64 @freeRAM() {
%1 = alloca %struct.sysinfo
%2 = bitcast %struct.sysinfo* %1 to i8*
%3 = call i32 @sysinfo(%struct.sysinfo* %1)
%4 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %1, i64 0, i32 0
%5 = load i64, i64* %4
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ compare_set_baseline_cstate(int /*<<< orphan*/ *, void *);
void compare_cstate_end_cpu(void *report_data) {
  compare_set_baseline_cstate(NULL, report_data);
}


x86 assembly (clang, -O0):
<compare_cstate_end_cpu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1030 <compare_set_baseline_cstate@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_cstate_end_cpu>:
mov    %rdi,%rsi
xor    %edi,%edi
jmp    1030 <compare_set_baseline_cstate@plt>

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

LLVM IR (-O2):
define void @compare_cstate_end_cpu(i8* %0) {
%2 = tail call i32 @compare_set_baseline_cstate(i32* null, i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ unlink(char *);
void runes_socket_server_close(int s, char *path) {
  close(s);
  unlink(path);
}


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

x86 assembly (clang, -O2):
<runes_socket_server_close>:
push   %rbx
mov    %rsi,%rbx
call   1040 <close@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <unlink@plt>

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

LLVM IR (-O2):
define void @runes_socket_server_close(i32 %0, i8* nocapture %1) {
%3 = tail call i32 @close(i32 %0)
%4 = tail call i32 @unlink(i8* %1)
ret void
}
/* Variables and functions */
float pow(float, float);
float fpow32(float x, float y) { return pow(x, y); }


x86 assembly (clang, -O0):
<fpow32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1030 <pow@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fpow32>:
jmp    1030 <pow@plt>

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

LLVM IR (-O2):
define float @fpow32(float %0, float %1) {
%3 = tail call float @pow(float %0, float %1)
ret float %3
}
/* Variables and functions */
int smsc911x_init();
int eninit(void) { return smsc911x_init(); }


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

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

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

LLVM IR (-O2):
define i32 @eninit() {
%1 = tail call i32 (...) @smsc911x_init()
ret i32 %1
}
/* Variables and functions */
int add(int, int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int a = 3;
  int b = 4;
  int c = add(a, b);
  printf("a+b=%d\n", c);
  printf("Hello World!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x3,-0x14(%rbp)
movl   $0x4,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <add@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3,%edi
mov    $0x4,%esi
call   1030 <add@plt>
lea    0xeb9(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb1(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"a+b=%d\0A\00"
@.str.1 = [14 x i8] c"Hello World!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 3, i32* %6
store i32 4, i32* %7
%9 = load i32, i32* %6
%10 = load i32, i32* %7
%11 = call i32 @add(i32 %9, i32 %10)
store i32 %11, i32* %8
%12 = load i32, i32* %8
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"a+b=%d\0A\00"
@str = [13 x i8] c"Hello World!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @add(i32 3, i32 4)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
void ft_striteri(char *s, void (*f)(unsigned int, char *)) {
  size_t i;
  i = 0;
  if (f) {
    while (s[i]) {
      f(i, s + i);
      i++;
    }
  }
}


x86 assembly (clang, -O0):
<ft_striteri>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1164 <ft_striteri+0x64>
jmp    1128 <ft_striteri+0x28>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     115f <ft_striteri+0x5f>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %ecx,%edi
mov    -0x8(%rbp),%rsi
add    -0x18(%rbp),%rsi
call   *%rax
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <ft_striteri+0x28>
jmp    1164 <ft_striteri+0x64>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_striteri>:
push   %r15
push   %r14
push   %rbx
test   %rsi,%rsi
je     1135 <ft_striteri+0x35>
mov    %rdi,%r15
cmpb   $0x0,(%rdi)
je     1135 <ft_striteri+0x35>
mov    %rsi,%r14
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
lea    (%r15,%rbx,1),%rsi
mov    %ebx,%edi
call   *%r14
cmpb   $0x0,0x1(%r15,%rbx,1)
lea    0x1(%rbx),%rbx
jne    1120 <ft_striteri+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @ft_striteri(i8* %0, void (i32, i8*)* %1) {
%3 = icmp eq void (i32, i8*)* %1, null
br i1 %3, label %15, label %4
4: ; preds = %2
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %15, label %7
7: ; preds = %4, %7
%8 = phi i8* [ %12, %7 ], [ %0, %4 ]
%9 = phi i64 [ %11, %7 ], [ 0, %4 ]
%10 = trunc i64 %9 to i32
tail call void %1(i32 %10, i8* %8)
%11 = add i64 %9, 1
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %7
15: ; preds = %7, %4, %2
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
void set_TCP_src_port(uint8_t *tcp_packet, uint16_t port) {
  tcp_packet[0] = port >> 8;
  tcp_packet[1] = (uint8_t)port;
}


x86 assembly (clang, -O0):
<set_TCP_src_port>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_TCP_src_port>:
mov    %esi,%eax
sar    $0x8,%eax
mov    %eax,(%rdi)
mov    %esi,0x4(%rdi)
ret

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

LLVM IR (-O2):
define void @set_TCP_src_port(i32* nocapture writeonly %0, i32 %1) {
%3 = ashr i32 %1, 8
store i32 %3, i32* %0
%4 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %1, i32* %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ output_line(char *);
gen_ret() {
  output_line("lw\t$ra, 16($sp)");
  output_line("jr\t$ra");
  output_line("addiu\t$sp, 20");
}


x86 assembly (clang, -O0):
<gen_ret>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <output_line@plt>
lea    0xee5(%rip),%rdi
call   1030 <output_line@plt>
lea    0xee0(%rip),%rdi
call   1030 <output_line@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_ret>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <output_line@plt>
lea    0xeec(%rip),%rdi
call   1030 <output_line@plt>
lea    0xee7(%rip),%rdi
pop    %rax
jmp    1030 <output_line@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"lw\09$ra, 16($sp)\00"
@.str.1 = [7 x i8] c"jr\09$ra\00"
@.str.2 = [14 x i8] c"addiu\09$sp, 20\00"
define i32 @gen_ret() {
%1 = alloca i32
%2 = call i32 @output_line(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @output_line(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @output_line(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%5 = load i32, i32* %1
ret i32 %5
}

LLVM IR (-O2):
@.str = [16 x i8] c"lw\09$ra, 16($sp)\00"
@.str.1 = [7 x i8] c"jr\09$ra\00"
@.str.2 = [14 x i8] c"addiu\09$sp, 20\00"
define i32 @gen_ret() {
%1 = tail call i32 @output_line(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @output_line(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @output_line(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void *calloc(size_t, size_t);
void *xcalloc(size_t nmemb, size_t size) {
  void *ptr;
  if (nmemb == 0)
    nmemb = 1;
  if (size == 0)
    size = 1;
  ptr = calloc(nmemb, size);
  if (!ptr)
    abort();
  return ptr;
}


x86 assembly (clang, -O0):
<xcalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1143 <xcalloc+0x23>
movq   $0x1,-0x8(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1156 <xcalloc+0x36>
movq   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1179 <xcalloc+0x59>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcalloc>:
push   %rax
test   %rdi,%rdi
mov    $0x1,%eax
cmove  %rax,%rdi
test   %rsi,%rsi
cmove  %rax,%rsi
call   1040 <calloc@plt>
test   %rax,%rax
je     1140 <xcalloc+0x20>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define noalias i8* @xcalloc(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, 0
%4 = select i1 %3, i64 1, i64 %0
%5 = icmp eq i64 %1, 0
%6 = select i1 %5, i64 1, i64 %1
%7 = tail call i8* @calloc(i64 %4, i64 %6)
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 (...) @abort()
unreachable
11: ; preds = %2
ret i8* %7
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void TimerMatchSet(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value) {
  ;

  ;
  if (ui32Timer & 0x000000ff) {
    (*((volatile unsigned long *)(ui32Base + 0x00000030))) = ui32Value;
  }
  if (ui32Timer & 0x0000ff00) {
    (*((volatile unsigned long *)(ui32Base + 0x00000034))) = ui32Value;
  }
}


x86 assembly (clang, -O0):
<TimerMatchSet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
cmp    $0x0,%eax
je     112d <TimerMatchSet+0x2d>
movslq -0xc(%rbp),%rcx
mov    -0x4(%rbp),%eax
add    $0x30,%eax
cltq
mov    %rcx,(%rax)
mov    -0x8(%rbp),%eax
and    $0xff00,%eax
cmp    $0x0,%eax
je     114d <TimerMatchSet+0x4d>
movslq -0xc(%rbp),%rcx
mov    -0x4(%rbp),%eax
add    $0x34,%eax
cltq
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerMatchSet>:
movslq %edx,%rax
movslq %edi,%rcx
test   %sil,%sil
je     110f <TimerMatchSet+0xf>
mov    %rax,0x30(%rcx)
test   $0xff00,%esi
je     111b <TimerMatchSet+0x1b>
mov    %rax,0x34(%rcx)
ret

LLVM IR (-O0):
define void @TimerMatchSet(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = and i32 %7, 255
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %3
%11 = load i32, i32* %6
%12 = sext i32 %11 to i64
%13 = load i32, i32* %4
%14 = add nsw i32 %13, 48
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i64*
store volatile i64 %12, i64* %16
br label %17
17: ; preds = %10, %3
%18 = load i32, i32* %5
%19 = and i32 %18, 65280
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %28
21: ; preds = %17
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 52
%26 = sext i32 %25 to i64
%27 = inttoptr i64 %26 to i64*
store volatile i64 %23, i64* %27
br label %28
28: ; preds = %21, %17
ret void
}

LLVM IR (-O2):
define void @TimerMatchSet(i32 %0, i32 %1, i32 %2) {
%4 = and i32 %1, 255
%5 = icmp eq i32 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = sext i32 %2 to i64
%8 = add nsw i32 %0, 48
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i64*
store volatile i64 %7, i64* %10
br label %11
11: ; preds = %6, %3
%12 = and i32 %1, 65280
%13 = icmp eq i32 %12, 0
br i1 %13, label %19, label %14
14: ; preds = %11
%15 = sext i32 %2 to i64
%16 = add nsw i32 %0, 52
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to i64*
store volatile i64 %15, i64* %18
br label %19
19: ; preds = %14, %11
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void SysCtlPeripheralSleepDisable(uint32_t ui32Peripheral) {
  ;
  (*((volatile unsigned long
          *)(((unsigned long)(0x400fe700 + ((ui32Peripheral & 0xff00) >> 8)) &
              0xF0000000) |
             0x02000000 |
             (((unsigned long)(0x400fe700 + ((ui32Peripheral & 0xff00) >> 8)) &
               0x000FFFFF)
              << 5) |
             ((ui32Peripheral & 0xff) << 2)))) = 0;
}


x86 assembly (clang, -O0):
<SysCtlPeripheralSleepDisable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
add    $0x400fe700,%eax
cltq
movabs $0xf0000000,%rcx
and    %rcx,%rax
or     $0x2000000,%rax
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
add    $0x400fe700,%ecx
movslq %ecx,%rcx
and    $0xfffff,%rcx
shl    $0x5,%rcx
or     %rcx,%rax
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
or     %rcx,%rax
movq   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysCtlPeripheralSleepDisable>:
movzbl %dil,%eax
shr    $0x3,%edi
and    $0x1fe0,%edi
shl    $0x2,%eax
or     %edi,%eax
movq   $0x0,0x43fce000(%rax)
ret

LLVM IR (-O0):
define void @SysCtlPeripheralSleepDisable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 65280
%5 = ashr i32 %4, 8
%6 = add nsw i32 1074784000, %5
%7 = sext i32 %6 to i64
%8 = and i64 %7, 4026531840
%9 = or i64 %8, 33554432
%10 = load i32, i32* %2
%11 = and i32 %10, 65280
%12 = ashr i32 %11, 8
%13 = add nsw i32 1074784000, %12
%14 = sext i32 %13 to i64
%15 = and i64 %14, 1048575
%16 = shl i64 %15, 5
%17 = or i64 %9, %16
%18 = load i32, i32* %2
%19 = and i32 %18, 255
%20 = shl i32 %19, 2
%21 = sext i32 %20 to i64
%22 = or i64 %17, %21
%23 = inttoptr i64 %22 to i64*
store volatile i64 0, i64* %23
ret void
}

LLVM IR (-O2):
define void @SysCtlPeripheralSleepDisable(i32 %0) {
%2 = lshr i32 %0, 3
%3 = and i32 %2, 8160
%4 = shl i32 %0, 2
%5 = and i32 %4, 1020
%6 = or i32 %5, %3
%7 = or i32 %6, 1140645888
%8 = zext i32 %7 to i64
%9 = inttoptr i64 %8 to i64*
store volatile i64 0, i64* %9
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fileno(int /*<<< orphan*/);
scalar_t__ isatty(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
void printfail(void) {
  printf(isatty(fileno(stdout)) ? "\e[1;31mFailed\e[0m" : "Failed");
}


x86 assembly (clang, -O0):
<printfail>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
call   1050 <fileno@plt>
mov    %eax,%edi
call   1030 <isatty@plt>
mov    %rax,%rcx
lea    0xebf(%rip),%rdi
lea    0xea6(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdi
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<printfail>:
push   %rax
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
call   1050 <fileno@plt>
mov    %eax,%edi
call   1030 <isatty@plt>
test   %rax,%rax
lea    0xec2(%rip),%rax
lea    0xea9(%rip),%rdi
cmove  %rax,%rdi
pop    %rax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [18 x i8] c"\1B[1;31mFailed\1B[0m\00"
@.str.1 = [7 x i8] c"Failed\00"
define void @printfail() {
%1 = load i32, i32* @stdout
%2 = call i32 @fileno(i32 %1)
%3 = call i64 @isatty(i32 %2)
%4 = icmp ne i64 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0)
%7 = call i32 @printf(i8* %6)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [18 x i8] c"\1B[1;31mFailed\1B[0m\00"
@.str.1 = [7 x i8] c"Failed\00"
define void @printfail() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fileno(i32 %1)
%3 = tail call i64 @isatty(i32 %2)
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0)
%6 = tail call i32 @printf(i8* dereferenceable(1) %5)
ret void
}