xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ dbg_write_insn(void *, char, int);
void dbg_insert_bkpt_insn(void *addr, char kind) {
  if (kind == 0)
    dbg_write_insn(addr, kind, 0xe1200070);
  else
    dbg_write_insn(addr, kind, 0xbe00);
}


x86 assembly (clang, -O0):
<dbg_insert_bkpt_insn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x0,%eax
jne    1146 <dbg_insert_bkpt_insn+0x36>
mov    -0x8(%rbp),%rdi
mov    $0xe1200070,%edx
movsbl -0x9(%rbp),%esi
call   1030 <dbg_write_insn@plt>
jmp    1158 <dbg_insert_bkpt_insn+0x48>
mov    -0x8(%rbp),%rdi
mov    $0xbe00,%edx
movsbl -0x9(%rbp),%esi
call   1030 <dbg_write_insn@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dbg_insert_bkpt_insn>:
test   %sil,%sil
je     1123 <dbg_insert_bkpt_insn+0x13>
movsbl %sil,%esi
mov    $0xbe00,%edx
jmp    1030 <dbg_write_insn@plt>
xor    %esi,%esi
mov    $0xe1200070,%edx
jmp    1030 <dbg_write_insn@plt>

LLVM IR (-O0):
define void @dbg_insert_bkpt_insn(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = load i8, i8* %4
%11 = call i32 @dbg_write_insn(i8* %9, i8 signext %10, i32 -517996432)
br label %16
12: ; preds = %2
%13 = load i8*, i8** %3
%14 = load i8, i8* %4
%15 = call i32 @dbg_write_insn(i8* %13, i8 signext %14, i32 48640)
br label %16
16: ; preds = %12, %8
ret void
}

LLVM IR (-O2):
define void @dbg_insert_bkpt_insn(i8* %0, i8 signext %1) {
%3 = icmp eq i8 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @dbg_write_insn(i8* %0, i8 signext 0, i32 -517996432)
br label %8
6: ; preds = %2
%7 = tail call i32 @dbg_write_insn(i8* %0, i8 signext %1, i32 48640)
br label %8
8: ; preds = %6, %4
ret void
}
/* Variables and functions */
int check_arg_count(int, int);
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_error(char *);
void cmd_mvins_nwstr(int nargs, char **args) {
  if (check_arg_count(nargs, 1) == 1)
    return;
  report_count(1);
  report_error("UNSUPPORTED");
}


x86 assembly (clang, -O0):
<cmd_mvins_nwstr>:
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_mvins_nwstr+0x2a>
jmp    1170 <cmd_mvins_nwstr+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_mvins_nwstr>:
push   %rax
mov    $0x1,%esi
call   1030 <check_arg_count@plt>
cmp    $0x1,%eax
jne    1142 <cmd_mvins_nwstr+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_mvins_nwstr(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_mvins_nwstr(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 */
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
int /*<<< orphan*/ printf(char *, ...);
int waitpid(int, int *, int /*<<< orphan*/);
void netprobe_sigchld_handler(int s) {
  int status;
  pid_t rc;
  printf("Handler for SIGCHLD called. Trying to reap a child");
  rc = waitpid(-1, &status, WNOHANG);
  printf("Handler for SIGCHLD reaped child PID %d", rc);
}


x86 assembly (clang, -O0):
<netprobe_sigchld_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2ea8(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
lea    -0x8(%rbp),%rsi
call   1040 <waitpid@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<netprobe_sigchld_handler>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2eb2(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rsi
mov    $0xffffffff,%edi
call   1040 <waitpid@plt>
lea    0xee5(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [51 x i8] c"Handler for SIGCHLD called. Trying to reap a child\00"
@WNOHANG = global i32 0
@.str.1 = [40 x i8] c"Handler for SIGCHLD reaped child PID %d\00"
define void @netprobe_sigchld_handler(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @WNOHANG
%7 = call i32 @waitpid(i32 -1, i32* %3, i32 %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret void
}

LLVM IR (-O2):
@.str = [51 x i8] c"Handler for SIGCHLD called. Trying to reap a child\00"
@WNOHANG = global i32 0
@.str.1 = [40 x i8] c"Handler for SIGCHLD reaped child PID %d\00"
define void @netprobe_sigchld_handler(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @WNOHANG
%6 = call i32 @waitpid(i32 -1, i32* %2, i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret void
}
void baz(int **p, int *q) {
  **p = *q++;
  (*p++)++;
}


x86 assembly (clang, -O0):
<baz>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%rcx
add    $0x4,%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<baz>:
mov    (%rsi),%eax
mov    (%rdi),%rcx
mov    %eax,(%rcx)
add    $0x4,%rcx
mov    %rcx,(%rdi)
ret

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

LLVM IR (-O2):
define void @baz(i32** nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = load i32*, i32** %0
store i32 %3, i32* %4
%5 = getelementptr inbounds i32, i32* %4, i64 1
store i32* %5, i32** %0
ret void
}
int _PR_MD_GET_INTSOFF() { return 0; }


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

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

LLVM IR (-O0):
define i32 @_PR_MD_GET_INTSOFF() {
ret i32 0
}

LLVM IR (-O2):
define i32 @_PR_MD_GET_INTSOFF() {
ret i32 0
}
/* Type definitions */
struct udcFile {
  int dummy;
};

/* Variables and functions */
int udcReadBits32(struct udcFile *, int);
unsigned udcReadBits32Wrap(void *f, int isSwapped) {
  return udcReadBits32((struct udcFile *)f, isSwapped);
}


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

x86 assembly (clang, -O2):
<udcReadBits32Wrap>:
jmp    1030 <udcReadBits32@plt>

LLVM IR (-O0):
%struct.udcFile = type { i32 }
define i32 @udcReadBits32Wrap(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 = bitcast i8* %5 to %struct.udcFile*
%7 = load i32, i32* %4
%8 = call i32 @udcReadBits32(%struct.udcFile* %6, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
%struct.udcFile = type { i32 }
define i32 @udcReadBits32Wrap(i8* %0, i32 %1) {
%3 = bitcast i8* %0 to %struct.udcFile*
%4 = tail call i32 @udcReadBits32(%struct.udcFile* %3, i32 %1)
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ memset(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
int /*<<< orphan*/ packet_data_last0(int);
void do_req_error() {
  uint8_t i;
  memset(((uint8_t *)0xfffef400), 0, 10);
  packet_data_last0(10 / 2);
}


x86 assembly (clang, -O0):
<do_req_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xfffef400,%edi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <memset@plt>
mov    $0x5,%edi
call   1040 <packet_data_last0@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_req_error>:
push   %rax
mov    $0xfffef400,%edi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <memset@plt>
mov    $0x5,%edi
pop    %rax
jmp    1040 <packet_data_last0@plt>

LLVM IR (-O0):
define void @do_req_error() {
%1 = alloca i32
%2 = call i32 @memset(i32* inttoptr (i64 4294898688 to i32*), i32 0, i32 10)
%3 = call i32 @packet_data_last0(i32 5)
ret void
}

LLVM IR (-O2):
define void @do_req_error() {
%1 = tail call i32 @memset(i32* inttoptr (i64 4294898688 to i32*), i32 0, i32 10)
%2 = tail call i32 @packet_data_last0(i32 5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void printMaxHeap(int *Arr, int n) {
  int i;
  for (i = 1; i <= n; i++)
    printf("%d\t", *(Arr + i));
}


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

x86 assembly (clang, -O2):
<printMaxHeap>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1155 <printMaxHeap+0x45>
mov    %esi,%r12d
mov    %rdi,%r14
add    $0x1,%r12d
mov    $0x1,%ebx
lea    0xece(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r14,%rbx,4),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <printMaxHeap+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\09\00"
define void @printMaxHeap(i32* nocapture %0, i32 %1) {
%3 = icmp slt i32 %1, 1
br i1 %3, label %14, label %4
4: ; preds = %2
%5 = add nuw i32 %1, 1
%6 = zext i32 %5 to i64
br label %7
7: ; preds = %4, %7
%8 = phi i64 [ 1, %4 ], [ %12, %7 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %6
br i1 %13, label %14, label %7
14: ; preds = %7, %2
ret void
}
int strcmp2(char *s, char *t) {
  for (; *s == *t; s++, t++)
    if (*s == '\0')
      return 0;
  return *s - *t;
}


x86 assembly (clang, -O0):
<strcmp2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1160 <strcmp2+0x60>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    113e <strcmp2+0x3e>
movl   $0x0,-0x4(%rbp)
jmp    1173 <strcmp2+0x73>
jmp    1143 <strcmp2+0x43>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    110c <strcmp2+0xc>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmp2>:
mov    (%rdi),%al
mov    (%rsi),%cl
cmp    %cl,%al
jne    1124 <strcmp2+0x24>
mov    $0x1,%edx
nopl   (%rax)
test   %al,%al
je     112d <strcmp2+0x2d>
movzbl (%rdi,%rdx,1),%eax
movzbl (%rsi,%rdx,1),%ecx
add    $0x1,%rdx
cmp    %cl,%al
je     1110 <strcmp2+0x10>
movsbl %al,%eax
movsbl %cl,%ecx
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @strcmp2(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = icmp eq i8 %3, %4
br i1 %5, label %6, label %17
6: ; preds = %2, %11
%7 = phi i8 [ %14, %11 ], [ %3, %2 ]
%8 = phi i8* [ %13, %11 ], [ %1, %2 ]
%9 = phi i8* [ %12, %11 ], [ %0, %2 ]
%10 = icmp eq i8 %7, 0
br i1 %10, label %23, label %11
11: ; preds = %6
%12 = getelementptr inbounds i8, i8* %9, i64 1
%13 = getelementptr inbounds i8, i8* %8, i64 1
%14 = load i8, i8* %12
%15 = load i8, i8* %13
%16 = icmp eq i8 %14, %15
br i1 %16, label %6, label %17
17: ; preds = %11, %2
%18 = phi i8 [ %3, %2 ], [ %14, %11 ]
%19 = phi i8 [ %4, %2 ], [ %15, %11 ]
%20 = sext i8 %18 to i32
%21 = sext i8 %19 to i32
%22 = sub nsw i32 %20, %21
br label %23
23: ; preds = %6, %17
%24 = phi i32 [ %22, %17 ], [ 0, %6 ]
ret i32 %24
}
int strtoi(const char *str) {
  int sum = 0;
  int i = 0;
  while (str[i] != '\0') {
    sum = sum * 10 + str[i] - '0';
    i++;
  }
  return sum;
}


x86 assembly (clang, -O0):
<strtoi>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1151 <strtoi+0x51>
imul   $0xa,-0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
movslq -0x10(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1116 <strtoi+0x16>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtoi>:
mov    (%rdi),%cl
test   %cl,%cl
je     1128 <strtoi+0x28>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
lea    (%rax,%rax,4),%eax
lea    (%rcx,%rax,2),%eax
add    $0xffffffd0,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <strtoi+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @strtoi(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %12, %4 ], [ 0, %1 ]
%6 = phi i8 [ %14, %4 ], [ %2, %1 ]
%7 = phi i32 [ %11, %4 ], [ 0, %1 ]
%8 = sext i8 %6 to i32
%9 = mul nsw i32 %7, 10
%10 = add i32 %9, -48
%11 = add i32 %10, %8
%12 = add nuw nsw i64 %5, 1
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %4
16: ; preds = %4, %1
%17 = phi i32 [ 0, %1 ], [ %11, %4 ]
ret i32 %17
}
/* Variables and functions */
char *memchr(char const *, char, size_t);
size_t strnlen1(const char *string, size_t maxlen) {
  const char *end = memchr(string, '\0', maxlen);
  if (end != NULL)
    return end - string + 1;
  else
    return maxlen;
}


x86 assembly (clang, -O0):
<strnlen1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
xor    %esi,%esi
call   1030 <memchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1156 <strnlen1+0x46>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    115e <strnlen1+0x4e>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strnlen1>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %esi,%esi
mov    %r14,%rdx
call   1030 <memchr@plt>
mov    %rax,%rcx
sub    %rbx,%rcx
add    $0x1,%rcx
test   %rax,%rax
cmove  %r14,%rcx
mov    %rcx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @strnlen1(i8* %0, i64 %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
%7 = load i8*, i8** %4
%8 = load i64, i64* %5
%9 = call i8* @memchr(i8* %7, i8 signext 0, i64 %8)
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %19
12: ; preds = %2
%13 = load i8*, i8** %6
%14 = load i8*, i8** %4
%15 = ptrtoint i8* %13 to i64
%16 = ptrtoint i8* %14 to i64
%17 = sub i64 %15, %16
%18 = add nsw i64 %17, 1
store i64 %18, i64* %3
br label %21
19: ; preds = %2
%20 = load i64, i64* %5
store i64 %20, i64* %3
br label %21
21: ; preds = %19, %12
%22 = load i64, i64* %3
ret i64 %22
}

LLVM IR (-O2):
define i64 @strnlen1(i8* %0, i64 %1) {
%3 = tail call i8* @memchr(i8* %0, i8 signext 0, i64 %1)
%4 = icmp eq i8* %3, null
%5 = ptrtoint i8* %3 to i64
%6 = ptrtoint i8* %0 to i64
%7 = sub i64 1, %6
%8 = add i64 %7, %5
%9 = select i1 %4, i64 %1, i64 %8
ret i64 %9
}
unsigned xrop3_138_0_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = ~T;
  stk2 = S | stk3;
  stk1 = D & stk2;
  return (stk1 & S) | (stk1 & (~T)) | (T & (~S) & D);
}


x86 assembly (clang, -O0):
<xrop3_138_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
or     -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
and    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
and    -0x8(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_138_0_1>:
mov    %edi,%eax
shl    $0x8,%eax
or     %edi,%eax
mov    %esi,%ecx
shl    $0x8,%ecx
or     %esi,%ecx
not    %ecx
or     %eax,%ecx
not    %eax
and    %esi,%eax
xor    $0xff,%esi
or     %edi,%esi
and    %esi,%ecx
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_138_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %7
%24 = xor i32 %23, -1
store i32 %24, i32* %10
%25 = load i32, i32* %6
%26 = load i32, i32* %10
%27 = or i32 %25, %26
store i32 %27, i32* %9
%28 = load i32, i32* %5
%29 = load i32, i32* %9
%30 = and i32 %28, %29
store i32 %30, i32* %8
%31 = load i32, i32* %8
%32 = load i32, i32* %6
%33 = and i32 %31, %32
%34 = load i32, i32* %8
%35 = load i32, i32* %7
%36 = xor i32 %35, -1
%37 = and i32 %34, %36
%38 = or i32 %33, %37
%39 = load i32, i32* %7
%40 = load i32, i32* %6
%41 = xor i32 %40, -1
%42 = and i32 %39, %41
%43 = load i32, i32* %5
%44 = and i32 %42, %43
%45 = or i32 %38, %44
ret i32 %45
}

LLVM IR (-O2):
define i32 @xrop3_138_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = xor i32 %6, -1
%8 = xor i32 %5, 255
%9 = or i32 %8, %3
%10 = or i32 %4, %7
%11 = and i32 %10, %9
%12 = xor i32 %4, -1
%13 = and i32 %12, %5
%14 = or i32 %11, %13
ret i32 %14
}
int GreatestCommonDivisor(int a, int b) {
  while (b != 0) {
    int remainder = a % b;
    a = b;
    b = remainder;
  }
  return a;
}


x86 assembly (clang, -O0):
<GreatestCommonDivisor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112f <GreatestCommonDivisor+0x2f>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    110a <GreatestCommonDivisor+0xa>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GreatestCommonDivisor>:
mov    %edi,%eax
test   %esi,%esi
je     111d <GreatestCommonDivisor+0x1d>
mov    %esi,%edx
nopl   0x0(%rax,%rax,1)
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <GreatestCommonDivisor+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @GreatestCommonDivisor(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %6, %4 ], [ %0, %2 ]
%6 = phi i32 [ %7, %4 ], [ %1, %2 ]
%7 = srem i32 %5, %6
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ %0, %2 ], [ %6, %4 ]
ret i32 %10
}
void BsdFragHashInit(int max) {}


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

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

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

LLVM IR (-O2):
define void @BsdFragHashInit(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ RxD2Interrupt();
void UART5_IRQHandler(void) { RxD2Interrupt(); }


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

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

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

LLVM IR (-O2):
define void @UART5_IRQHandler() {
%1 = tail call i32 (...) @RxD2Interrupt()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
void kotlinclib_print_float(float message) { printf("%f", message); }


x86 assembly (clang, -O0):
<kotlinclib_print_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
define void @kotlinclib_print_float(float %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float %0)
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
size_t tcp_get_header_size(const uint8_t *tcp_segment) {
  return (tcp_segment[12] & 0xf0) >> 2;
}


x86 assembly (clang, -O0):
<tcp_get_header_size>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x30(%rax),%eax
and    $0xf0,%eax
sar    $0x2,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcp_get_header_size>:
mov    0x30(%rdi),%eax
shr    $0x2,%rax
and    $0x3c,%eax
ret

LLVM IR (-O0):
define i64 @tcp_get_header_size(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 12
%5 = load i32, i32* %4
%6 = and i32 %5, 240
%7 = ashr i32 %6, 2
%8 = sext i32 %7 to i64
ret i64 %8
}

LLVM IR (-O2):
define i64 @tcp_get_header_size(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 12
%3 = load i32, i32* %2
%4 = lshr i32 %3, 2
%5 = and i32 %4, 60
%6 = zext i32 %5 to i64
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ __sh_or(void volatile *, long);
void a_or_l(volatile void *p, long v) { __sh_or(p, v); }


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

x86 assembly (clang, -O2):
<a_or_l>:
jmp    1030 <__sh_or@plt>

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

LLVM IR (-O2):
define void @a_or_l(i8* %0, i64 %1) {
%3 = tail call i32 @__sh_or(i8* %0, i64 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ e(int);
int /*<<< orphan*/ set_err(char *);
addr_lb() {
  char a[6];
  int i;
  set_err("addr_lb");
  i = 6;
  if (&a[6] != a + i)
    e(1);
}


x86 assembly (clang, -O0):
<addr_lb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1040 <set_err@plt>
movl   $0x6,-0x10(%rbp)
lea    -0xa(%rbp),%rax
add    $0x6,%rax
lea    -0xa(%rbp),%rcx
movslq -0x10(%rbp),%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
je     1161 <addr_lb+0x41>
mov    $0x1,%edi
call   1030 <e@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"addr_lb\00"
define i32 @addr_lb() {
%1 = tail call i32 @set_err(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
int __crow_lt(int a, int b) { return a < b; }


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

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

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

LLVM IR (-O2):
define i32 @__crow_lt(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ hip2_1(void (*)());
void hip1_1(void (*g)()) { hip2_1(g); }


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

x86 assembly (clang, -O2):
<hip1_1>:
jmp    1030 <hip2_1@plt>

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

LLVM IR (-O2):
define void @hip1_1(void (...)* %0) {
%2 = tail call i32 @hip2_1(void (...)* %0)
ret void
}
/* Variables and functions */
int STC311x_WriteDataToRam(unsigned char *);
int /*<<< orphan*/ UpdateRamCrc(unsigned char *);
int STC31xx_SaveBackupSocToRam(unsigned char *p_RamData) {
  int status;
  UpdateRamCrc(p_RamData);
  status = STC311x_WriteDataToRam(p_RamData);
  return status;
}


x86 assembly (clang, -O0):
<STC31xx_SaveBackupSocToRam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <UpdateRamCrc@plt>
mov    -0x8(%rbp),%rdi
call   1030 <STC311x_WriteDataToRam@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<STC31xx_SaveBackupSocToRam>:
push   %rbx
mov    %rdi,%rbx
call   1040 <UpdateRamCrc@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <STC311x_WriteDataToRam@plt>

LLVM IR (-O0):
define i32 @STC31xx_SaveBackupSocToRam(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @UpdateRamCrc(i8* %4)
%6 = load i8*, i8** %2
%7 = call i32 @STC311x_WriteDataToRam(i8* %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
define i32 @STC31xx_SaveBackupSocToRam(i8* %0) {
%2 = tail call i32 @UpdateRamCrc(i8* %0)
%3 = tail call i32 @STC311x_WriteDataToRam(i8* %0)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ fmax(float, int /*<<< orphan*/);
float fmin(int /*<<< orphan*/, int);
float powf(float const, int);
unsigned char linearFloatToGammaEncodedUint8(const float channel,
                                             const float gamma) {
  float gammaEncoded = powf(channel, 1 / gamma);
  float clipped = fmin(fmax(gammaEncoded, 0), 1);
  return clipped * 255 + 0.5;
}


x86 assembly (clang, -O0):
<linearFloatToGammaEncodedUint8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
movss  0xeac(%rip),%xmm1
divss  %xmm2,%xmm1
cvttss2si %xmm1,%edi
call   1030 <powf@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
xor    %edi,%edi
call   1050 <fmax@plt>
mov    %eax,%edi
mov    $0x1,%esi
call   1040 <fmin@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  0xe74(%rip),%xmm1
mulss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe68(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<linearFloatToGammaEncodedUint8>:
push   %rax
movss  0xec7(%rip),%xmm2
divss  %xmm1,%xmm2
cvttss2si %xmm2,%edi
call   1030 <powf@plt>
xor    %edi,%edi
call   1050 <fmax@plt>
mov    %eax,%edi
mov    $0x1,%esi
call   1040 <fmin@plt>
mulss  0xea3(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xe9b(%rip),%xmm0
cvttsd2si %xmm0,%eax
pop    %rcx
ret

LLVM IR (-O0):
define zeroext i8 @linearFloatToGammaEncodedUint8(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %3
store float %1, float* %4
%7 = load float, float* %3
%8 = load float, float* %4
%9 = fdiv float 1.000000e+00, %8
%10 = fptosi float %9 to i32
%11 = call float @powf(float %7, i32 %10)
store float %11, float* %5
%12 = load float, float* %5
%13 = call i32 @fmax(float %12, i32 0)
%14 = call float @fmin(i32 %13, i32 1)
store float %14, float* %6
%15 = load float, float* %6
%16 = fmul float %15, 2.550000e+02
%17 = fpext float %16 to double
%18 = fadd double %17, 5.000000e-01
%19 = fptoui double %18 to i8
ret i8 %19
}

LLVM IR (-O2):
define zeroext i8 @linearFloatToGammaEncodedUint8(float %0, float %1) {
%3 = fdiv float 1.000000e+00, %1
%4 = fptosi float %3 to i32
%5 = tail call float @powf(float %0, i32 %4)
%6 = tail call i32 @fmax(float %5, i32 0)
%7 = tail call float @fmin(i32 %6, i32 1)
%8 = fmul float %7, 2.550000e+02
%9 = fpext float %8 to double
%10 = fadd double %9, 5.000000e-01
%11 = fptoui double %10 to i8
ret i8 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
size_t fread(void *, int, size_t, int /*<<< orphan*/ *);
size_t read_bin(FILE *fp, void *array, size_t arrayBytes) {
  return fread(array, 1, arrayBytes, fp);
}


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

x86 assembly (clang, -O2):
<read_bin>:
mov    %rdi,%rcx
mov    %rsi,%rdi
mov    $0x1,%esi
jmp    1030 <fread@plt>

LLVM IR (-O0):
define i64 @read_bin(i32* %0, i8* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i64
store i32* %0, i32** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %5
%8 = load i64, i64* %6
%9 = load i32*, i32** %4
%10 = call i64 @fread(i8* %7, i32 1, i64 %8, i32* %9)
ret i64 %10
}

LLVM IR (-O2):
define i64 @read_bin(i32* nocapture %0, i8* nocapture %1, i64 %2) {
%4 = tail call i64 @fread(i8* %1, i32 1, i64 %2, i32* %0)
ret i64 %4
}
/* Variables and functions */
int isdigit(int);
bool is_digit(int a) { return isdigit(a); }


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

x86 assembly (clang, -O2):
<is_digit>:
add    $0xffffffd0,%edi
xor    %eax,%eax
cmp    $0xa,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @is_digit(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
void ft_strclr(char *s) {
  if (s)
    while (*s)
      *s++ = '\0';
}


x86 assembly (clang, -O0):
<ft_strclr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1141 <ft_strclr+0x41>
jmp    1118 <ft_strclr+0x18>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     113c <ft_strclr+0x3c>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0x0,(%rax)
jmp    1118 <ft_strclr+0x18>
jmp    1141 <ft_strclr+0x41>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strclr>:
test   %rdi,%rdi
je     111d <ft_strclr+0x1d>
cmpb   $0x0,(%rdi)
je     111d <ft_strclr+0x1d>
add    $0x1,%rdi
xchg   %ax,%ax
movb   $0x0,-0x1(%rdi)
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <ft_strclr+0x10>
ret

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

LLVM IR (-O2):
define void @ft_strclr(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %3, %6
%7 = phi i8* [ %8, %6 ], [ %0, %3 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
store i8 0, i8* %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %6
11: ; preds = %6, %3, %1
ret void
}
extern double s1s2(float s1, float s2) { return s1 + s2; }


x86 assembly (clang, -O0):
<s1s2>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<s1s2>:
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @s1s2(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 = fadd float %5, %6
%8 = fpext float %7 to double
ret double %8
}

LLVM IR (-O2):
define double @s1s2(float %0, float %1) {
%3 = fadd float %0, %1
%4 = fpext float %3 to double
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ delay(int);
int /*<<< orphan*/ mbus_remote_register_write(int, int, int);
void pmu_set_sleep_radio() {
  mbus_remote_register_write(0x6, 0x15,
                             ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) |
                              (0 << 13) | (10 << 9) | (8 << 5) | (5)));
  delay(100);
  mbus_remote_register_write(0x6, 0x15,
                             ((0 << 19) | (0 << 18) | (0 << 17) | (3 << 14) |
                              (0 << 13) | (10 << 9) | (8 << 5) | (5)));
  delay(100);
  mbus_remote_register_write(
      0x6, 0x17, ((3 << 14) | (0 << 13) | (4 << 9) | (2 << 5) | (5)));
  delay(100);
}


x86 assembly (clang, -O0):
<pmu_set_sleep_radio>:
push   %rbp
mov    %rsp,%rbp
mov    $0x6,%edi
mov    $0x15,%esi
mov    $0xd505,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0x15,%esi
mov    $0xd505,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0x17,%esi
mov    $0xc845,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pmu_set_sleep_radio>:
push   %rax
mov    $0x6,%edi
mov    $0x15,%esi
mov    $0xd505,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0x15,%esi
mov    $0xd505,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
mov    $0x17,%esi
mov    $0xc845,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
pop    %rax
jmp    1030 <delay@plt>

LLVM IR (-O0):
define void @pmu_set_sleep_radio() {
%1 = call i32 @mbus_remote_register_write(i32 6, i32 21, i32 54533)
%2 = call i32 @delay(i32 100)
%3 = call i32 @mbus_remote_register_write(i32 6, i32 21, i32 54533)
%4 = call i32 @delay(i32 100)
%5 = call i32 @mbus_remote_register_write(i32 6, i32 23, i32 51269)
%6 = call i32 @delay(i32 100)
ret void
}

LLVM IR (-O2):
define void @pmu_set_sleep_radio() {
%1 = tail call i32 @mbus_remote_register_write(i32 6, i32 21, i32 54533)
%2 = tail call i32 @delay(i32 100)
%3 = tail call i32 @mbus_remote_register_write(i32 6, i32 21, i32 54533)
%4 = tail call i32 @delay(i32 100)
%5 = tail call i32 @mbus_remote_register_write(i32 6, i32 23, i32 51269)
%6 = tail call i32 @delay(i32 100)
ret void
}
/* Variables and functions */
char *safe_malloc(size_t);
int /*<<< orphan*/ safe_strncpy(char *, char const *const, size_t);
int strlen(char const *const);
char *safe_strdup(const char *const input) {
  char *output;
  size_t s;
  if (input == NULL)
    return NULL;
  s = strlen(input) + 1;
  output = safe_malloc(s);
  safe_strncpy(output, input, s);
  return (output);
}


x86 assembly (clang, -O0):
<safe_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1154 <safe_strdup+0x24>
movq   $0x0,-0x8(%rbp)
jmp    118c <safe_strdup+0x5c>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <safe_malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1050 <safe_strncpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_strdup>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1163 <safe_strdup+0x33>
mov    %rdi,%rbx
call   1040 <strlen@plt>
add    $0x1,%eax
movslq %eax,%r15
mov    %r15,%rdi
call   1030 <safe_malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1050 <safe_strncpy@plt>
jmp    1166 <safe_strdup+0x36>
xor    %r14d,%r14d
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @safe_strdup(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = add nsw i32 %4, 1
%6 = sext i32 %5 to i64
%7 = tail call i8* @safe_malloc(i64 %6)
%8 = tail call i32 @safe_strncpy(i8* %7, i8* %0, i64 %6)
br label %9
9: ; preds = %1, %3
%10 = phi i8* [ %7, %3 ], [ null, %1 ]
ret i8* %10
}
double epj2jd(epoch)
double epoch;
{ return (2451545.0 + ((epoch - 2000.0) * 365.25)); }


x86 assembly (clang, -O0):
<epj2jd>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xefa(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xede(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeda(%rip),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<epj2jd>:
addsd  0xef8(%rip),%xmm0
mulsd  0xef8(%rip),%xmm0
addsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @epj2jd(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fsub double %3, 2.000000e+03
%5 = call double @llvm.fmuladd.f64(double %4, double 3.652500e+02, double 0x4142B42C80000000)
ret double %5
}

LLVM IR (-O2):
define double @epj2jd(double %0) {
%2 = fadd double %0, -2.000000e+03
%3 = tail call double @llvm.fmuladd.f64(double %2, double 3.652500e+02, double 0x4142B42C80000000)
ret double %3
}
int do_750() { return 750; }


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

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

LLVM IR (-O0):
define i32 @do_750() {
ret i32 750
}

LLVM IR (-O2):
define i32 @do_750() {
ret i32 750
}
/* Variables and functions */
char tolower(char);
char toupper(char);
void norm(char *s) {
  *s = toupper(*s);
  while (*(++s) != '\0')
    *s = tolower(*s);
}


x86 assembly (clang, -O0):
<norm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
je     1175 <norm+0x55>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <tolower@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
jmp    1140 <norm+0x20>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<norm>:
push   %rbx
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <toupper@plt>
mov    %al,(%rbx)
mov    0x1(%rbx),%al
test   %al,%al
je     1156 <norm+0x36>
add    $0x2,%rbx
nopl   0x0(%rax)
movsbl %al,%edi
call   1040 <tolower@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <norm+0x20>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @norm(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call signext i8 @toupper(i8 signext %2)
store i8 %3, i8* %0
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %1, %7
%8 = phi i8 [ %12, %7 ], [ %5, %1 ]
%9 = phi i8* [ %11, %7 ], [ %4, %1 ]
%10 = tail call signext i8 @tolower(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 %14, label %7
14: ; preds = %7, %1
ret void
}