xunge/DecIR huggingface dataset:
/* Variables and functions */
char *malloc(scalar_t__);
int /*<<< orphan*/ sprintf(char *, char *, char const *, char const *);
scalar_t__ strlen(char const *);
char *construct_path(const char *parent_path, const char *name) {
  char *buf = malloc(strlen(parent_path) + 1 + strlen(name) + 1);
  sprintf(buf, "%s/%s", parent_path, name);
  return buf;
}


x86 assembly (clang, -O0):
<construct_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
add    %rax,%rdi
add    $0x1,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe7f(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<construct_path>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
call   1030 <strlen@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1030 <strlen@plt>
lea    (%r15,%rax,1),%rdi
add    $0x2,%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xe9b(%rip),%rsi
mov    %rax,%rdi
mov    %r12,%rdx
mov    %r14,%rcx
call   1050 <sprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s/%s\00"
define i8* @construct_path(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
%8 = add nsw i64 %7, 1
%9 = load i8*, i8** %4
%10 = call i64 @strlen(i8* %9)
%11 = add nsw i64 %8, %10
%12 = add nsw i64 %11, 1
%13 = call i8* @malloc(i64 %12)
store i8* %13, i8** %5
%14 = load i8*, i8** %5
%15 = load i8*, i8** %3
%16 = load i8*, i8** %4
%17 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %15, i8* %16)
%18 = load i8*, i8** %5
ret i8* %18
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s/%s\00"
define noalias i8* @construct_path(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = add i64 %3, 2
%6 = add i64 %5, %4
%7 = tail call i8* @malloc(i64 %6)
%8 = tail call i32 @sprintf(i8* dereferenceable(1) %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M84_f(char *s) {
  debug("M84_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M84_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xef9(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M84_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf05(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [46 x i8] c"M84_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M84_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [46 x i8] c"M84_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M84_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ A_BOLD;
int /*<<< orphan*/ addch(char);
int /*<<< orphan*/ attroff(int /*<<< orphan*/);
int /*<<< orphan*/ attron(int /*<<< orphan*/);
void add_bold(char letter) {
  attron(A_BOLD);
  addch(letter);
  attroff(A_BOLD);
}


x86 assembly (clang, -O0):
<add_bold>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
call   1040 <attron@plt>
movsbl -0x1(%rbp),%edi
call   1050 <addch@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
call   1030 <attroff@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_bold>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    0x2ea3(%rip),%r14
mov    (%r14),%edi
call   1040 <attron@plt>
mov    %ebx,%edi
call   1050 <addch@plt>
mov    (%r14),%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <attroff@plt>

LLVM IR (-O0):
@A_BOLD = global i32 0
define void @add_bold(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i32, i32* @A_BOLD
%4 = call i32 @attron(i32 %3)
%5 = load i8, i8* %2
%6 = call i32 @addch(i8 signext %5)
%7 = load i32, i32* @A_BOLD
%8 = call i32 @attroff(i32 %7)
ret void
}

LLVM IR (-O2):
@A_BOLD = global i32 0
define void @add_bold(i8 signext %0) {
%2 = load i32, i32* @A_BOLD
%3 = tail call i32 @attron(i32 %2)
%4 = tail call i32 @addch(i8 signext %0)
%5 = load i32, i32* @A_BOLD
%6 = tail call i32 @attroff(i32 %5)
ret void
}
void delay(void) {
  int i;
  for (i = 0; i < 32000; i++)
    ;
}


x86 assembly (clang, -O0):
<delay>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x7d00,-0x4(%rbp)
jge    112b <delay+0x2b>
jmp    111d <delay+0x1d>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <delay+0xb>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @delay() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %6, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 32000
br i1 %4, label %5, label %9
5: ; preds = %2
br label %6
6: ; preds = %5
%7 = load i32, i32* %1
%8 = add nsw i32 %7, 1
store i32 %8, i32* %1
br label %2
9: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @delay() {
ret void
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void fill(int ar[], int size) {
  int q;
  srand(time(NULL));
  for (q = 0; q < size; q++)
    ar[q] = rand() % 100;
}


x86 assembly (clang, -O0):
<fill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    118a <fill+0x5a>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1156 <fill+0x26>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
test   %ebp,%ebp
jle    117f <fill+0x4f>
mov    %ebp,%ebp
xor    %ebx,%ebx
nop
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1150 <fill+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @fill(i32* nocapture writeonly %0, i32 %1) {
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%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 = tail call i32 (...) @rand()
%11 = srem i32 %10, 100
%12 = getelementptr inbounds i32, i32* %0, i64 %9
store i32 %11, i32* %12
%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 void
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ write(int, char *, int);
void *thread(void *arg) {
  if (0) {
    arg = 0;
  }
  write(1, "(thread created) ", sizeof("(thread created) ") - 1);
  sleep(1);
  write(1, "(thread exit) ", sizeof("(thread exit) ") - 1);
  return 0;
}


x86 assembly (clang, -O0):
<thread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%edi
lea    0xec8(%rip),%rsi
mov    $0x11,%edx
call   1030 <write@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    $0x1,%edi
lea    0xeba(%rip),%rsi
mov    $0xe,%edx
call   1030 <write@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread>:
push   %rax
lea    0xed8(%rip),%rsi
mov    $0x1,%edi
mov    $0x11,%edx
call   1030 <write@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
lea    0xeca(%rip),%rsi
mov    $0x1,%edi
mov    $0xe,%edx
call   1030 <write@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"(thread created) \00"
@.str.1 = [15 x i8] c"(thread exit) \00"
define i8* @thread(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @write(i32 1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 17)
%4 = call i32 @sleep(i32 1)
%5 = call i32 @write(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 14)
ret i8* null
}

LLVM IR (-O2):
@.str = [18 x i8] c"(thread created) \00"
@.str.1 = [15 x i8] c"(thread exit) \00"
define noalias i8* @thread(i8* nocapture readnone %0) {
%2 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 17)
%3 = tail call i32 @sleep(i32 1)
%4 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 14)
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ swap(int *, int *);
int main() {
  int a = 10;
  int b = 20;
  printf("%d, %d\n", a, b);
  swap(&a, &b);
  printf("%d, %d\n", a, b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x14,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <swap@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0xa,0xc(%rsp)
movl   $0x14,0x8(%rsp)
lea    0xec4(%rip),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x14,%edx
call   1030 <printf@plt>
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1040 <swap@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"%d, %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 10, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 20, i32* %2
%5 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 10, i32 20)
%6 = call i32 @swap(i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8)
ret i32 0
}
void foo570(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo570(i32 %0) {
ret void
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ NOROM_IntUnregister(int);
void stub1(uint32_t);
void IOCIntUnregister(void) {
  ((void (*)(uint32_t ui32Interrupt))(
      (uint32_t *)(((uint32_t *)0x10000180)[12]))[5])(16);
  NOROM_IntUnregister(16);
}


x86 assembly (clang, -O0):
<IOCIntUnregister>:
push   %rbp
mov    %rsp,%rbp
mov    $0x10000180,%eax
mov    0x60(%rax),%rax
mov    $0x10,%edi
call   *0x28(%rax)
mov    $0x10,%edi
call   1030 <NOROM_IntUnregister@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<IOCIntUnregister>:
push   %rax
mov    0x100001e0,%rax
10
mov    $0x10,%edi
call   *0x28(%rax)
mov    $0x10,%edi
pop    %rax
jmp    1030 <NOROM_IntUnregister@plt>

LLVM IR (-O0):
define void @IOCIntUnregister() {
%1 = load i64, i64* getelementptr inbounds (i64, i64* inttoptr (i64 268435840 to i64*), i64 12)
%2 = inttoptr i64 %1 to i64*
%3 = getelementptr inbounds i64, i64* %2, i64 5
%4 = load i64, i64* %3
%5 = inttoptr i64 %4 to void (i64)*
%6 = call i32 @NOROM_IntUnregister(i32 16)
ret void
}

LLVM IR (-O2):
define void @IOCIntUnregister() {
%1 = load i64, i64* inttoptr (i64 268435936 to i64*)
%2 = inttoptr i64 %1 to i64*
%3 = getelementptr inbounds i64, i64* %2, i64 5
%4 = load i64, i64* %3
%5 = inttoptr i64 %4 to void (i64)*
tail call void %5(i64 16)
%6 = tail call i32 @NOROM_IntUnregister(i32 16)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ I2CVMHandle();
int /*<<< orphan*/ UAVObjUpdated(int /*<<< orphan*/);
void I2CVMUpdated() { UAVObjUpdated(I2CVMHandle()); }


x86 assembly (clang, -O0):
<I2CVMUpdated>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <I2CVMHandle@plt>
mov    %eax,%edi
call   1040 <UAVObjUpdated@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @I2CVMUpdated() {
%1 = call i32 (...) @I2CVMHandle()
%2 = call i32 @UAVObjUpdated(i32 %1)
ret void
}

LLVM IR (-O2):
define void @I2CVMUpdated() {
%1 = tail call i32 (...) @I2CVMHandle()
%2 = tail call i32 @UAVObjUpdated(i32 %1)
ret void
}
/* Variables and functions */
float slapy3_(float *, float *, float *);
float aa_cla_slapy3(float x, float y, float z) { return slapy3_(&x, &y, &z); }


x86 assembly (clang, -O0):
<aa_cla_slapy3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1030 <slapy3_@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aa_cla_slapy3>:
sub    $0x18,%rsp
movss  %xmm0,0x14(%rsp)
movss  %xmm1,0x10(%rsp)
movss  %xmm2,0xc(%rsp)
lea    0x14(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1030 <slapy3_@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @aa_cla_slapy3(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = call float @slapy3_(float* %4, float* %5, float* %6)
ret float %7
}

LLVM IR (-O2):
define float @aa_cla_slapy3(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = call float @slapy3_(float* %4, float* %5, float* %6)
ret float %7
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void const *, size_t);
void retmem(void *dest, size_t *size, const void *src, size_t n) {
  if (dest && n <= *size)
    memcpy(dest, src, n);
  *size = n;
}


x86 assembly (clang, -O0):
<retmem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1155 <retmem+0x45>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%rax
ja     1155 <retmem+0x45>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<retmem>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %rsi,%r14
test   %rdi,%rdi
je     112f <retmem+0x1f>
cmp    %rbx,(%r14)
jb     112f <retmem+0x1f>
mov    %rdx,%rsi
mov    %rbx,%rdx
call   1030 <memcpy@plt>
mov    %rbx,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @retmem(i8* %0, i64* nocapture %1, i8* %2, i64 %3) {
%5 = icmp eq i8* %0, null
br i1 %5, label %11, label %6
6: ; preds = %4
%7 = load i64, i64* %1
%8 = icmp ult i64 %7, %3
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @memcpy(i8* %0, i8* %2, i64 %3)
br label %11
11: ; preds = %9, %6, %4
store i64 %3, i64* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ motors_brake_all();
void brake_all(void) { motors_brake_all(); }


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

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

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

LLVM IR (-O2):
define void @brake_all() {
%1 = tail call i32 (...) @motors_brake_all()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cmToIn(float);
int inchesToDriveTicks(int /*<<< orphan*/);
int centimetersToDriveTicks(float centimeters) {
  return inchesToDriveTicks(cmToIn(centimeters));
}


x86 assembly (clang, -O0):
<centimetersToDriveTicks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <cmToIn@plt>
mov    %eax,%edi
call   1030 <inchesToDriveTicks@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<centimetersToDriveTicks>:
push   %rax
call   1040 <cmToIn@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <inchesToDriveTicks@plt>

LLVM IR (-O0):
define i32 @centimetersToDriveTicks(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i32 @cmToIn(float %3)
%5 = call i32 @inchesToDriveTicks(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @centimetersToDriveTicks(float %0) {
%2 = tail call i32 @cmToIn(float %0)
%3 = tail call i32 @inchesToDriveTicks(i32 %2)
ret i32 %3
}
__attribute((no)) void broken_longjmp(void *p) {
  void *buf[32];
  __builtin_memcpy(buf, p, 5 * sizeof(void *));
  __builtin_memset(p, 0, 5 * sizeof(void *));
  __builtin_longjmp(buf, 1);
}


x86 assembly (clang, -O0):
<broken_longjmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
lea    -0x110(%rbp),%rcx
mov    (%rcx),%rbp
mov    0x8(%rcx),%rax
mov    0x10(%rcx),%rsp
jmp    *%rax

x86 assembly (clang, -O2):
<broken_longjmp>:
push   %rbp
sub    $0x80,%rsp
mov    0x20(%rdi),%rax
mov    %rax,-0x60(%rsp)
movups (%rdi),%xmm0
movups 0x10(%rdi),%xmm1
movaps %xmm1,-0x70(%rsp)
movaps %xmm0,-0x80(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,(%rdi)
movups %xmm0,0x10(%rdi)
movq   $0x0,0x20(%rdi)
mov    -0x80(%rsp),%rbp
mov    -0x78(%rsp),%rax
mov    -0x70(%rsp),%rsp
jmp    *%rax

LLVM IR (-O0):
define void @broken_longjmp(i8* %0) {
%2 = alloca i8*
%3 = alloca [32 x i8*]
store i8* %0, i8** %2
%4 = getelementptr inbounds [32 x i8*], [32 x i8*]* %3, i64 0, i64 0
%5 = bitcast i8** %4 to i8*
%6 = load i8*, i8** %2
%7 = load i8*, i8** %2
%8 = getelementptr inbounds [32 x i8*], [32 x i8*]* %3, i64 0, i64 0
%9 = bitcast i8** %8 to i8*
unreachable
}

LLVM IR (-O2):
define void @broken_longjmp(i8* nocapture %0) {
%2 = alloca [32 x i8*]
%3 = bitcast [32 x i8*]* %2 to i8*
tail call void @llvm.memset.p0i8.i64(i8* align 1 dereferenceable(40) %0, i8 0, i64 40, i1 false)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ glob_t;

/* Variables and functions */
int /*<<< orphan*/ globfree(int /*<<< orphan*/ *);
void cfs_free_param_data(glob_t *paths) { globfree(paths); }


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

x86 assembly (clang, -O2):
<cfs_free_param_data>:
jmp    1030 <globfree@plt>

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

LLVM IR (-O2):
define void @cfs_free_param_data(i32* %0) {
%2 = tail call i32 @globfree(i32* %0)
ret void
}
/* Type definitions */
struct Cyc_Absyn_Tvar {
  int dummy;
};

/* Variables and functions */
void *Cyc_Absyn_var_type(struct Cyc_Absyn_Tvar *);
struct Cyc_Absyn_Tvar *Cyc_Tcutil_copy_tvar(struct Cyc_Absyn_Tvar *);
void *Cyc_Tcutil_tvar2type(struct Cyc_Absyn_Tvar *t) {
  struct Cyc_Absyn_Tvar *_T0;
  void *_T1;
  _T0 = Cyc_Tcutil_copy_tvar(t);
  _T1 = Cyc_Absyn_var_type(_T0);
  return _T1;
}


x86 assembly (clang, -O0):
<Cyc_Tcutil_tvar2type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <Cyc_Tcutil_copy_tvar@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <Cyc_Absyn_var_type@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cyc_Tcutil_tvar2type>:
push   %rax
call   1030 <Cyc_Tcutil_copy_tvar@plt>
mov    %rax,%rdi
pop    %rax
jmp    1040 <Cyc_Absyn_var_type@plt>

LLVM IR (-O0):
%struct.Cyc_Absyn_Tvar = type { i32 }
define i8* @Cyc_Tcutil_tvar2type(%struct.Cyc_Absyn_Tvar* %0) {
%2 = alloca %struct.Cyc_Absyn_Tvar*
%3 = alloca %struct.Cyc_Absyn_Tvar*
%4 = alloca i8*
store %struct.Cyc_Absyn_Tvar* %0, %struct.Cyc_Absyn_Tvar** %2
%5 = load %struct.Cyc_Absyn_Tvar*, %struct.Cyc_Absyn_Tvar** %2
%6 = call %struct.Cyc_Absyn_Tvar* @Cyc_Tcutil_copy_tvar(%struct.Cyc_Absyn_Tvar* %5)
store %struct.Cyc_Absyn_Tvar* %6, %struct.Cyc_Absyn_Tvar** %3
%7 = load %struct.Cyc_Absyn_Tvar*, %struct.Cyc_Absyn_Tvar** %3
%8 = call i8* @Cyc_Absyn_var_type(%struct.Cyc_Absyn_Tvar* %7)
store i8* %8, i8** %4
%9 = load i8*, i8** %4
ret i8* %9
}

LLVM IR (-O2):
%struct.Cyc_Absyn_Tvar = type { i32 }
define i8* @Cyc_Tcutil_tvar2type(%struct.Cyc_Absyn_Tvar* %0) {
%2 = tail call %struct.Cyc_Absyn_Tvar* @Cyc_Tcutil_copy_tvar(%struct.Cyc_Absyn_Tvar* %0)
%3 = tail call i8* @Cyc_Absyn_var_type(%struct.Cyc_Absyn_Tvar* %2)
ret i8* %3
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
void mp2vpicx_set_fcode11(uint8_t *p_mp2vpicx, uint8_t i_fcode11) {
  p_mp2vpicx[6] &= 0x0f;
  p_mp2vpicx[6] |= (i_fcode11 << 4) & 0xf0;
}


x86 assembly (clang, -O0):
<mp2vpicx_set_fcode11>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%ecx
and    $0xf,%ecx
mov    %ecx,0x18(%rax)
mov    -0xc(%rbp),%ecx
shl    $0x4,%ecx
and    $0xf0,%ecx
mov    -0x8(%rbp),%rax
or     0x18(%rax),%ecx
mov    %ecx,0x18(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp2vpicx_set_fcode11>:
mov    0x18(%rdi),%eax
and    $0xf,%eax
shl    $0x4,%esi
movzbl %sil,%ecx
or     %eax,%ecx
mov    %ecx,0x18(%rdi)
ret

LLVM IR (-O0):
define void @mp2vpicx_set_fcode11(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 = getelementptr inbounds i32, i32* %5, i64 6
%7 = load i32, i32* %6
%8 = and i32 %7, 15
store i32 %8, i32* %6
%9 = load i32, i32* %4
%10 = shl i32 %9, 4
%11 = and i32 %10, 240
%12 = load i32*, i32** %3
%13 = getelementptr inbounds i32, i32* %12, i64 6
%14 = load i32, i32* %13
%15 = or i32 %14, %11
store i32 %15, i32* %13
ret void
}

LLVM IR (-O2):
define void @mp2vpicx_set_fcode11(i32* nocapture %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 6
%4 = load i32, i32* %3
%5 = and i32 %4, 15
%6 = shl i32 %1, 4
%7 = and i32 %6, 240
%8 = or i32 %5, %7
store i32 %8, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ daemon(int /*<<< orphan*/, int /*<<< orphan*/);
int main(void) {
  daemon(0, 0);
  return 64;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
call   1030 <daemon@plt>
mov    $0x40,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @daemon(i32 0, i32 0)
ret i32 64
}
/* Variables and functions */
int /*<<< orphan*/ __CrestCall(int, int);
int /*<<< orphan*/ __CrestReturn(int);
void isCopyOfHolder(void) {
  {
    __CrestCall(3, 2);
    {
      __CrestReturn(4);
      return;
    }
  }
}


x86 assembly (clang, -O0):
<isCopyOfHolder>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
mov    $0x2,%esi
call   1040 <__CrestCall@plt>
mov    $0x4,%edi
call   1030 <__CrestReturn@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<isCopyOfHolder>:
push   %rax
mov    $0x3,%edi
mov    $0x2,%esi
call   1040 <__CrestCall@plt>
mov    $0x4,%edi
pop    %rax
jmp    1030 <__CrestReturn@plt>

LLVM IR (-O0):
define void @isCopyOfHolder() {
%1 = call i32 @__CrestCall(i32 3, i32 2)
%2 = call i32 @__CrestReturn(i32 4)
ret void
}

LLVM IR (-O2):
define void @isCopyOfHolder() {
%1 = tail call i32 @__CrestCall(i32 3, i32 2)
%2 = tail call i32 @__CrestReturn(i32 4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void ___timeout_do2(int pid) { exit(1); }


x86 assembly (clang, -O0):
<___timeout_do2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<___timeout_do2>:
push   %rax
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @___timeout_do2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @___timeout_do2(i32 %0) {
%2 = tail call i32 @exit(i32 1)
unreachable
}
const char *TA_GetVersionString(void) {
  if (sizeof("dev") > 1) {
    return "0"
           "."
           "6"
           "."
           "0"
           "-"
           "dev"
           " "
           "("
           "Mar 15 2022"
           " "
           "19:27:03"
           ")";
  } else {
    return "0"
           "."
           "6"
           "."
           "0"
           " "
           "("
           "Mar 15 2022"
           " "
           "19:27:03"
           ")";
  }
}


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

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

LLVM IR (-O0):
@.str = [33 x i8] c"0.6.0-dev (Mar 15 2022 19:27:03)\00"
define i8* @TA_GetVersionString() {
ret i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [33 x i8] c"0.6.0-dev (Mar 15 2022 19:27:03)\00"
define i8* @TA_GetVersionString() {
ret i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0)
}
int __strcmp(const char *s1, const char *s2) {
  int d0, d1, ret;
  asm volatile("1: lodsb;"
               "scasb;"
               "jne 2f;"
               "testb %%al, %%al;"
               "jne 1b;"
               "xorl %%eax, %%eax;"
               "jmp 3f;"
               "2: sbbl %%eax, %%eax;"
               "orb $1, %%al;"
               "3:"
               : "=a"(ret), "=&S"(d0), "=&D"(d1)
               : "1"(s1), "2"(s2)
               : "memory");
  return ret;
}


x86 assembly (clang, -O0):
<__strcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdi
lods   %ds:(%rsi),%al
scas   %es:(%rdi),%al
jne    112b <__strcmp+0x2b>
test   %al,%al
jne    1114 <__strcmp+0x14>
xor    %eax,%eax
jmp    112f <__strcmp+0x2f>
sbb    %eax,%eax
or     $0x1,%al
mov    %eax,-0x1c(%rbp)
mov    %esi,%eax
mov    %eax,-0x14(%rbp)
mov    %edi,%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__strcmp>:
mov    %rsi,%rax
mov    %rdi,%rsi
mov    %rax,%rdi
lods   %ds:(%rsi),%al
scas   %es:(%rdi),%al
jne    1115 <__strcmp+0x15>
test   %al,%al
jne    1109 <__strcmp+0x9>
xor    %eax,%eax
jmp    1119 <__strcmp+0x19>
sbb    %eax,%eax
or     $0x1,%al
ret

LLVM IR (-O0):
define i32 @__strcmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %3
%9 = load i8*, i8** %4
%10 = call { i32, i8*, i8* } asm sideeffect "1: lodsb;scasb;jne 2f;testb %al, %al;jne 1b;xorl %eax, %eax;jmp 3f;2: sbbl %eax, %eax;orb $$1, %al;3:", "={ax},=&{si},=&{di},1,2,~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %8, i8* %9)
%11 = extractvalue { i32, i8*, i8* } %10, 0
%12 = extractvalue { i32, i8*, i8* } %10, 1
%13 = extractvalue { i32, i8*, i8* } %10, 2
store i32 %11, i32* %7
%14 = ptrtoint i8* %12 to i64
%15 = trunc i64 %14 to i32
store i32 %15, i32* %5
%16 = ptrtoint i8* %13 to i64
%17 = trunc i64 %16 to i32
store i32 %17, i32* %6
%18 = load i32, i32* %7
ret i32 %18
}

LLVM IR (-O2):
define i32 @__strcmp(i8* %0, i8* %1) {
%3 = tail call { i32, i8*, i8* } asm sideeffect "1: lodsb;scasb;jne 2f;testb %al, %al;jne 1b;xorl %eax, %eax;jmp 3f;2: sbbl %eax, %eax;orb $$1, %al;3:", "={ax},=&{si},=&{di},1,2,~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %0, i8* %1)
%4 = extractvalue { i32, i8*, i8* } %3, 0
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ munmap(void *, size_t);
void file_unmap(void *mem, size_t size) {
  assert(mem);
  assert(size > 0);
  munmap(mem, size);
}


x86 assembly (clang, -O0):
<file_unmap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%edi
call   1030 <assert@plt>
cmpq   $0x0,-0x10(%rbp)
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <munmap@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_unmap>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <assert@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1030 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <munmap@plt>

LLVM IR (-O0):
define void @file_unmap(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 = ptrtoint i8* %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = load i64, i64* %4
%9 = icmp ugt i64 %8, 0
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load i8*, i8** %3
%13 = load i64, i64* %4
%14 = call i32 @munmap(i8* %12, i64 %13)
ret void
}

LLVM IR (-O2):
define void @file_unmap(i8* %0, i64 %1) {
%3 = ptrtoint i8* %0 to i64
%4 = trunc i64 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = icmp ne i64 %1, 0
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 @munmap(i8* %0, i64 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ current(int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ status();
int /*<<< orphan*/ stderr;
void lost_comm(int current_bit, int current_value) {
  current(current_bit, current_value);
  status();
  fprintf(stderr, "lost communication with the target\n");
  exit(1);
}


x86 assembly (clang, -O0):
<lost_comm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <current@plt>
mov    $0x0,%al
call   1040 <status@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<lost_comm>:
push   %rax
call   1050 <current@plt>
xor    %eax,%eax
call   1040 <status@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
lea    0xea3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [36 x i8] c"lost communication with the target\0A\00"
define void @lost_comm(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @current(i32 %5, i32 %6)
%8 = call i32 (...) @status()
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [36 x i8] c"lost communication with the target\0A\00"
define void @lost_comm(i32 %0, i32 %1) {
%3 = tail call i32 @current(i32 %0, i32 %1)
%4 = tail call i32 (...) @status()
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
#define SIGALRM 131
#define SIGINT 130
#define SIGTERM 129
#define SIGUSR1 128
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
void signalHandle(int sig) {
  printf("caught signal %d\n", sig);
  switch (sig) {
  case SIGUSR1:
    break;
  case SIGALRM:
    break;
  case SIGINT:
    exit(0);
    break;
  case SIGTERM:
    break;
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<signalHandle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     1179 <signalHandle+0x59>
mov    -0x10(%rbp),%rax
lea    0xea6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    117e <signalHandle+0x5e>
jmp    117e <signalHandle+0x5e>
xor    %edi,%edi
call   1040 <exit@plt>
jmp    117e <signalHandle+0x5e>
jmp    117e <signalHandle+0x5e>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signalHandle>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
cmp    $0x82,%ebx
je     113b <signalHandle+0x1b>
pop    %rbx
ret
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"caught signal %d\0A\00"
define void @signalHandle(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %2
switch i32 %5, label %11 [
i32 128, label %6
i32 131, label %7
i32 130, label %8
i32 129, label %10
]
6: ; preds = %1
br label %12
7: ; preds = %1
br label %12
8: ; preds = %1
%9 = call i32 @exit(i32 0)
unreachable
10: ; preds = %1
br label %12
11: ; preds = %1
br label %12
12: ; preds = %11, %10, %7, %6
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"caught signal %d\0A\00"
define void @signalHandle(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = icmp eq i32 %0, 130
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @exit(i32 0)
unreachable
6: ; preds = %1
ret void
}
/* Type definitions */
typedef scalar_t__ time_t;
struct timespec {
  long tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ nanosleep(struct timespec *, int /*<<< orphan*/ *);
void my_sleep(double sleeptime) {
  struct timespec ts;
  ts.tv_sec = (time_t)sleeptime;
  ts.tv_nsec = (long)((sleeptime - (double)ts.tv_sec) * 1E9);
  nanosleep(&ts, NULL);
}


x86 assembly (clang, -O0):
<my_sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
cvtsi2sdq -0x10(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  0xec2(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <nanosleep@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_sleep>:
sub    $0x18,%rsp
cvttsd2si %xmm0,%rax
cvtsi2sd %rax,%xmm1
subsd  %xmm1,%xmm0
mulsd  0xed6(%rip),%xmm0
mov    %rax,0x10(%rsp)
cvttsd2si %xmm0,%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <nanosleep@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
define void @my_sleep(double %0) {
%2 = alloca double
%3 = alloca %struct.timespec
store double %0, double* %2
%4 = load double, double* %2
%5 = fptosi double %4 to i64
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
store i64 %5, i64* %6
%7 = load double, double* %2
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
%9 = load i64, i64* %8
%10 = sitofp i64 %9 to double
%11 = fsub double %7, %10
%12 = fmul double %11, 1.000000e+09
%13 = fptosi double %12 to i64
%14 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
store i64 %13, i64* %14
%15 = call i32 @nanosleep(%struct.timespec* %3, i32* null)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
define void @my_sleep(double %0) {
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %2 to i8*
%4 = fptosi double %0 to i64
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 1
store i64 %4, i64* %5
%6 = sitofp i64 %4 to double
%7 = fsub double %0, %6
%8 = fmul double %7, 1.000000e+09
%9 = fptosi double %8 to i64
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
store i64 %9, i64* %10
%11 = call i32 @nanosleep(%struct.timespec* %2, i32* null)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ messErr(int);
void IF_devShowDflt(void) { messErr(17); }


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

x86 assembly (clang, -O2):
<IF_devShowDflt>:
mov    $0x11,%edi
jmp    1030 <messErr@plt>

LLVM IR (-O0):
define void @IF_devShowDflt() {
%1 = call i32 @messErr(i32 17)
ret void
}

LLVM IR (-O2):
define void @IF_devShowDflt() {
%1 = tail call i32 @messErr(i32 17)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_indent(int j) {
  while (j--)
    printf("\t");
}


x86 assembly (clang, -O0):
<print_indent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
je     1140 <print_indent+0x30>
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
jmp    111b <print_indent+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_indent>:
push   %rbx
test   %edi,%edi
je     112f <print_indent+0x1f>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x9,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <print_indent+0x10>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\09\00"
define void @print_indent(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %7, %1
%4 = load i32, i32* %2
%5 = add nsw i32 %4, -1
store i32 %5, i32* %2
%6 = icmp ne i32 %4, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %3
9: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @print_indent(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %8, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %5, %3 ], [ %0, %1 ]
%5 = add nsw i32 %4, -1
%6 = tail call i32 @putchar(i32 9)
%7 = icmp eq i32 %5, 0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint8_t kaatcp_get_padding_from_length(uint32_t length) {
  uint8_t padding = length % 4;
  return padding ? 4 - padding : 0;
}


x86 assembly (clang, -O0):
<kaatcp_get_padding_from_length>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112f <kaatcp_get_padding_from_length+0x2f>
mov    $0x4,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1139 <kaatcp_get_padding_from_length+0x39>
xor    %eax,%eax
mov    %eax,-0xc(%rbp)
jmp    1139 <kaatcp_get_padding_from_length+0x39>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<kaatcp_get_padding_from_length>:
lea    0x3(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
and    $0xfffffffc,%eax
sub    %eax,%edi
mov    $0x4,%eax
sub    %edi,%eax
test   %edi,%edi
cmove  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @kaatcp_get_padding_from_length(i32 %0) {
%2 = srem i32 %0, 4
%3 = icmp eq i32 %2, 0
%4 = sub nsw i32 4, %2
%5 = select i1 %3, i32 0, i32 %4
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ sizes;

/* Variables and functions */
int test_loopback_all_sizes(int, int *, int);
int test_loopback_large_unaligned(int fd) {
  int sizes[] = {(1024 * 4) + 8,     (5 * 1024) + 9,   (1024 * 11) + 8,
                 (1024 * 12) + 12,   (1024 * 13) + 18, (1024 * 15),
                 (32 * 1024 + 8 * 5)};
  return test_loopback_all_sizes(fd, sizes,
                                 (int)(sizeof(sizes) / sizeof((sizes)[0])));
}


x86 assembly (clang, -O0):
<test_loopback_large_unaligned>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xedb(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed8(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed6(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0x7,%edx
call   1030 <test_loopback_all_sizes@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_loopback_large_unaligned>:
sub    $0x28,%rsp
movups 0xef1(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
mov    $0x7,%edx
call   1030 <test_loopback_all_sizes@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.test_loopback_large_unaligned.sizes = [7 x i32] [i32 4104, i32 5129, i32 11272, i32 12300, i32 13330, i32 15360, i32 32808]
define i32 @test_loopback_large_unaligned(i32 %0) {
%2 = alloca i32
%3 = alloca [7 x i32]
store i32 %0, i32* %2
%4 = bitcast [7 x i32]* %3 to i8*
%5 = load i32, i32* %2
%6 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 0
%7 = call i32 @test_loopback_all_sizes(i32 %5, i32* %6, i32 7)
ret i32 %7
}

LLVM IR (-O2):
@__const.test_loopback_large_unaligned.sizes = [7 x i32] [i32 4104, i32 5129, i32 11272, i32 12300, i32 13330, i32 15360, i32 32808]
define i32 @test_loopback_large_unaligned(i32 %0) {
%2 = alloca [7 x i32]
%3 = bitcast [7 x i32]* %2 to i8*
%4 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%5 = call i32 @test_loopback_all_sizes(i32 %0, i32* %4, i32 7)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void do_help(void) {
  printf("usage:\n");
  printf("-q: query system frame lock information.\n");
  printf("-e: enable frame lock on system.\n");
  printf("-d: disable frame lock on system.\n");
  printf("\n");
}


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

x86 assembly (clang, -O2):
<do_help>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <puts@plt>
lea    0xed3(%rip),%rdi
call   1040 <puts@plt>
lea    0xef0(%rip),%rdi
call   1040 <puts@plt>
lea    0xf05(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"usage:\0A\00"
@.str.1 = [42 x i8] c"-q: query system frame lock information.\0A\00"
@.str.2 = [34 x i8] c"-e: enable frame lock on system.\0A\00"
@.str.3 = [35 x i8] c"-d: disable frame lock on system.\0A\00"
@.str.4 = [2 x i8] c"\0A\00"
define void @do_help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [7 x i8] c"usage:\00"
@str.5 = [41 x i8] c"-q: query system frame lock information.\00"
@str.6 = [33 x i8] c"-e: enable frame lock on system.\00"
@str.7 = [34 x i8] c"-d: disable frame lock on system.\00"
define void @do_help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.5, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.6, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.7, i64 0, i64 0))
%5 = tail call i32 @putchar(i32 10)
ret void
}