xunge/DecIR huggingface dataset:
void panic(char *message, char *code, unsigned char halt) {
  print("<SYSTEM ERROR>:", 8);
  print(message, 9);
  if (halt == 0) {
    print("A Fatal!!!", 10);
    __asm__("cli\n"
            "hlt\n");
  }
}


x86 assembly (clang, -O0):
<panic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
lea    0xed4(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <print@plt>
mov    -0x8(%rbp),%rdi
mov    $0x9,%esi
mov    $0x0,%al
call   1030 <print@plt>
movzbl -0x11(%rbp),%eax
cmp    $0x0,%eax
jne    116a <panic+0x5a>
lea    0xeb4(%rip),%rdi
mov    $0xa,%esi
mov    $0x0,%al
call   1030 <print@plt>
cli
hlt
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<panic>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rdi,%rbx
lea    0xee1(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <print@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1030 <print@plt>
test   %ebp,%ebp
jne    1153 <panic+0x43>
lea    0xecb(%rip),%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1030 <print@plt>
cli
hlt
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"<SYSTEM ERROR>:\00"
@.str.1 = [11 x i8] c"A Fatal!!!\00"
define void @panic(i8* %0, i8* %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8 %2, i8* %6
%7 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @print to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 8)
%8 = load i8*, i8** %4
%9 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @print to i32 (i8*, i32, ...)*)(i8* %8, i32 9)
%10 = load i8, i8* %6
%11 = zext i8 %10 to i32
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %3
%14 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @print to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 10)
br label %15
15: ; preds = %13, %3
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"<SYSTEM ERROR>:\00"
@.str.1 = [11 x i8] c"A Fatal!!!\00"
define void @panic(i8* %0, i8* nocapture readnone %1, i8 zeroext %2) {
%4 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @print to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 8)
%5 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @print to i32 (i8*, i32, ...)*)(i8* %0, i32 9)
%6 = icmp eq i8 %2, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @print to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 10)
tail call void asm sideeffect "cli\0Ahlt\0A", "~{dirflag},~{fpsr},~{flags}"()
br label %9
9: ; preds = %7, %3
ret void
}
/* Variables and functions */
scalar_t__ fork();
long FORK() { return ((long)fork()); }


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

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

LLVM IR (-O0):
define i64 @FORK() {
%1 = call i64 (...) @fork()
ret i64 %1
}

LLVM IR (-O2):
define i64 @FORK() {
%1 = tail call i64 (...) @fork()
ret i64 %1
}
/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
void *realloc(void *, size_t);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
void *xrealloc(void *ptr, size_t s) {
  void *m = realloc(ptr, s);
  if (m == NULL) {
    fprintf(stderr, "Unable to reallocate memory: %s\n", strerror(errno));
    exit(1);
  }
  return m;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11a2 <xrealloc+0x62>
mov    0x2e6d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    -0x1c(%rbp),%edi
mov    %rax,%rdx
lea    0xe6d(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %rbx
call   1040 <realloc@plt>
test   %rax,%rax
je     114d <xrealloc+0xd>
pop    %rbx
ret
mov    0x2e8c(%rip),%rax
mov    (%rax),%ebx
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
lea    0xe95(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"Unable to reallocate memory: %s\0A\00"
@errno = global i32 0
define i8* @xrealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i32, i32* @errno
%14 = call i8* @strerror(i32 %13)
%15 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %2
%18 = load i8*, i8** %5
ret i8* %18
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"Unable to reallocate memory: %s\0A\00"
@errno = global i32 0
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = load i32, i32* @errno
%8 = tail call i8* @strerror(i32 %7)
%9 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ ICC_Async_Init_Locks();
void cardreader_init_locks(void) { ICC_Async_Init_Locks(); }


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

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

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

LLVM IR (-O2):
define void @cardreader_init_locks() {
%1 = tail call i32 (...) @ICC_Async_Init_Locks()
ret void
}
int any(c, p)
register char c, *p;
{
  while (p && *p)
    if (*p++ == c)
      return (1);
  return (0);
}


x86 assembly (clang, -O0):
<any>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     112e <any+0x2e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    113e <any+0x3e>
jmp    116d <any+0x6d>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
movsbl -0x5(%rbp),%ecx
cmp    %ecx,%eax
jne    1168 <any+0x68>
movl   $0x1,-0x4(%rbp)
jmp    1174 <any+0x74>
jmp    110e <any+0xe>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<any>:
movsbl %dil,%ecx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
test   %rsi,%rsi
je     1129 <any+0x29>
movsbl (%rsi),%edx
test   %edx,%edx
je     1129 <any+0x29>
add    $0x1,%rsi
cmp    %edx,%ecx
jne    1110 <any+0x10>
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @any(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8*
%6 = trunc i32 %0 to i8
store i8 %6, i8* %4
store i8* %1, i8** %5
br label %7
7: ; preds = %26, %2
%8 = load i8*, i8** %5
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %15
10: ; preds = %7
%11 = load i8*, i8** %5
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 0
br label %15
15: ; preds = %10, %7
%16 = phi i1 [ false, %7 ], [ %14, %10 ]
br i1 %16, label %17, label %27
17: ; preds = %15
%18 = load i8*, i8** %5
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %5
%20 = load i8, i8* %18
%21 = sext i8 %20 to i32
%22 = load i8, i8* %4
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %21, %23
br i1 %24, label %25, label %26
25: ; preds = %17
store i32 1, i32* %3
br label %28
26: ; preds = %17
br label %7
27: ; preds = %15
store i32 0, i32* %3
br label %28
28: ; preds = %27, %25
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
define i32 @any(i32 %0, i8* %1) {
%3 = shl i32 %0, 24
%4 = ashr exact i32 %3, 24
br label %5
5: ; preds = %11, %2
%6 = phi i8* [ %1, %2 ], [ %13, %11 ]
%7 = icmp eq i8* %6, null
br i1 %7, label %15, label %8
8: ; preds = %5
%9 = load i8, i8* %6
%10 = icmp eq i8 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = sext i8 %9 to i32
%13 = getelementptr inbounds i8, i8* %6, i64 1
%14 = icmp eq i32 %4, %12
br i1 %14, label %15, label %5
15: ; preds = %8, %5, %11
%16 = phi i32 [ 1, %11 ], [ 0, %5 ], [ 0, %8 ]
ret i32 %16
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
int /*<<< orphan*/ S_IFCHR;
int stat(const char *filepath, struct stat *st) {
  st->st_mode = S_IFCHR;
  return 0;
}


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

x86 assembly (clang, -O2):
<stat>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rsi)
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@S_IFCHR = global i32 0
define i32 @stat(i8* %0, %struct.stat* %1) {
%3 = alloca i8*
%4 = alloca %struct.stat*
store i8* %0, i8** %3
store %struct.stat* %1, %struct.stat** %4
%5 = load i32, i32* @S_IFCHR
%6 = load %struct.stat*, %struct.stat** %4
%7 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
store i32 %5, i32* %7
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@S_IFCHR = global i32 0
define i32 @stat(i8* nocapture readnone %0, %struct.stat* nocapture writeonly %1) {
%3 = load i32, i32* @S_IFCHR
%4 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 0
store i32 %3, i32* %4
ret i32 0
}
void test_funcdesg() { test_funcdesg; }


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

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

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

LLVM IR (-O2):
define void @test_funcdesg() {
ret void
}
/* Variables and functions */
int lace_builtin_add_main(int, char **, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  return lace_builtin_add_main(argc, argv, NULL, NULL);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rcx,%rdx
call   1030 <lace_builtin_add_main@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <lace_builtin_add_main@plt>

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @lace_builtin_add_main(i32 %0, i8** %1, i32* null, i32* null)
ret i32 %3
}
int substring_to_dec(char *start, char *end) {
  int result = 0;
  int base = 1;
  while (start <= end) {
    int current_number = *end - '0';
    result += current_number * base;
    base *= 10;
    end--;
  }
  return result;
}


x86 assembly (clang, -O0):
<substring_to_dec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
ja     115a <substring_to_dec+0x5a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
imul   -0x18(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
imul   $0xa,-0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    111a <substring_to_dec+0x1a>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<substring_to_dec>:
xor    %eax,%eax
cmp    %rdi,%rsi
jb     1129 <substring_to_dec+0x29>
xor    %eax,%eax
mov    $0x1,%ecx
xchg   %ax,%ax
movsbl (%rsi),%edx
add    $0xffffffd0,%edx
imul   %ecx,%edx
add    %edx,%eax
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
add    $0xffffffffffffffff,%rsi
cmp    %rdi,%rsi
jae    1110 <substring_to_dec+0x10>
ret

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

LLVM IR (-O2):
define i32 @substring_to_dec(i8* readnone %0, i8* %1) {
%3 = icmp ult i8* %1, %0
br i1 %3, label %16, label %4
4: ; preds = %2, %4
%5 = phi i8* [ %14, %4 ], [ %1, %2 ]
%6 = phi i32 [ %13, %4 ], [ 1, %2 ]
%7 = phi i32 [ %12, %4 ], [ 0, %2 ]
%8 = load i8, i8* %5
%9 = sext i8 %8 to i32
%10 = add nsw i32 %9, -48
%11 = mul nsw i32 %10, %6
%12 = add nsw i32 %11, %7
%13 = mul nsw i32 %6, 10
%14 = getelementptr inbounds i8, i8* %5, i64 -1
%15 = icmp ult i8* %14, %0
br i1 %15, label %16, label %4
16: ; preds = %4, %2
%17 = phi i32 [ 0, %2 ], [ %12, %4 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void display_help() {
  printf("****************************************"
         "****************************************\n");
  printf("*\t\tMSP430-Emulator\n*\n*\tUsage: ./msp430 [BINARY FILE]\n*\n");
  printf("****************************************"
         "****************************************\n");
}


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

x86 assembly (clang, -O2):
<display_help>:
push   %rbx
lea    0xf1f(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xed9(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [82 x i8] c"********************************************************************************\0A\00"
@.str.1 = [56 x i8] c"*\09\09MSP430-Emulator\0A*\0A*\09Usage: ./msp430 [BINARY FILE]\0A*\0A\00"
define void @display_help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str.2 = [55 x i8] c"*\09\09MSP430-Emulator\0A*\0A*\09Usage: ./msp430 [BINARY FILE]\0A*\00"
@str.3 = [81 x i8] c"********************************************************************************\00"
define void @display_help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @str.3, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.2, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @str.3, i64 0, i64 0))
ret void
}
void swap2(int *a, int *b) {
  int *k = a;
  a = b;
  b = k;
}


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

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

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

LLVM IR (-O2):
define void @swap2(i32* nocapture %0, i32* nocapture %1) {
ret void
}
void inc_count(int *count_ptr) { ++(*count_ptr); }


x86 assembly (clang, -O0):
<inc_count>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<inc_count>:
addl   $0x1,(%rdi)
ret

LLVM IR (-O0):
define void @inc_count(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = add nsw i32 %4, 1
store i32 %5, i32* %3
ret void
}

LLVM IR (-O2):
define void @inc_count(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = add nsw i32 %2, 1
store i32 %3, i32* %0
ret void
}
/* Variables and functions */
scalar_t__ Exponential(double);
long Poisson(double m) {
  double t = 0.0;
  long x = 0;
  while (t < m) {
    t += Exponential(1.0);
    x++;
  }
  return (x - 1);
}


x86 assembly (clang, -O0):
<Poisson>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    116e <Poisson+0x5e>
movsd  0xeb7(%rip),%xmm0
call   1030 <Exponential@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    112d <Poisson+0x1d>
mov    -0x18(%rbp),%rax
sub    $0x1,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Poisson>:
push   %rbx
sub    $0x10,%rsp
mov    $0xffffffffffffffff,%rbx
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1174 <Poisson+0x64>
mov    $0xffffffffffffffff,%rbx
movsd  %xmm0,(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  %xmm1,0x8(%rsp)
movsd  0xeb2(%rip),%xmm0
call   1030 <Exponential@plt>
movsd  0x8(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  %xmm0,%xmm1
movsd  (%rsp),%xmm0
add    $0x1,%rbx
ucomisd %xmm1,%xmm0
ja     1140 <Poisson+0x30>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i64 @Poisson(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca i64
store double %0, double* %2
store double 0.000000e+00, double* %3
store i64 0, i64* %4
br label %5
5: ; preds = %9, %1
%6 = load double, double* %3
%7 = load double, double* %2
%8 = fcmp olt double %6, %7
br i1 %8, label %9, label %16
9: ; preds = %5
%10 = call i64 @Exponential(double 1.000000e+00)
%11 = sitofp i64 %10 to double
%12 = load double, double* %3
%13 = fadd double %12, %11
store double %13, double* %3
%14 = load i64, i64* %4
%15 = add nsw i64 %14, 1
store i64 %15, i64* %4
br label %5
16: ; preds = %5
%17 = load i64, i64* %4
%18 = sub nsw i64 %17, 1
ret i64 %18
}

LLVM IR (-O2):
define i64 @Poisson(double %0) {
%2 = fcmp ogt double %0, 0.000000e+00
br i1 %2, label %3, label %11
3: ; preds = %1, %3
%4 = phi i64 [ %9, %3 ], [ 0, %1 ]
%5 = phi double [ %8, %3 ], [ 0.000000e+00, %1 ]
%6 = tail call i64 @Exponential(double 1.000000e+00)
%7 = sitofp i64 %6 to double
%8 = fadd double %5, %7
%9 = add nuw nsw i64 %4, 1
%10 = fcmp olt double %8, %0
br i1 %10, label %3, label %11
11: ; preds = %3, %1
%12 = phi i64 [ -1, %1 ], [ %4, %3 ]
ret i64 %12
}
short is_numeric(int c) { return ((c >= '0') && (c <= '9')) ? 1 : 0; }


x86 assembly (clang, -O0):
<is_numeric>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x30,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <is_numeric+0x20>
cmpl   $0x39,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
cwtl
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i16 @is_numeric(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 48
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 57
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 1, i32 0
%12 = trunc i32 %11 to i16
ret i16 %12
}

LLVM IR (-O2):
define signext i16 @is_numeric(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
%4 = zext i1 %3 to i16
ret i16 %4
}
void f(void) {
  int a;
#pragma hlt fusion
  { a = 3; }
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movl   $0x3,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f() {
%1 = alloca i32
store i32 3, i32* %1
ret void
}

LLVM IR (-O2):
define void @f() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ my_func();
int main(void) {
  my_func();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @my_func()
ret i32 0
}
/* Type definitions */
typedef int uint64_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t nextrand(uint64_t *cur) {
  *cur = (*cur * 2862933555777941757) + 3037000493;
  return *cur >> 32;
}


x86 assembly (clang, -O0):
<nextrand>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movslq (%rax),%rax
movabs $0x27bb2ee687b0b0fd,%rcx
2e bb 27
imul   %rcx,%rax
movabs $0xb504f32d,%rcx
add    %rcx,%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    $0x20,%ecx
sar    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nextrand>:
imul   $0x87b0b0fd,(%rdi),%eax
add    $0xb504f32d,%eax
mov    %eax,(%rdi)
ret

LLVM IR (-O0):
define i32 @nextrand(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = sext i32 %4 to i64
%6 = mul nsw i64 %5, 2862933555777941757
%7 = add nsw i64 %6, 3037000493
%8 = trunc i64 %7 to i32
%9 = load i32*, i32** %2
store i32 %8, i32* %9
%10 = load i32*, i32** %2
%11 = load i32, i32* %10
%12 = ashr i32 %11, 32
ret i32 %12
}

LLVM IR (-O2):
define i32 @nextrand(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = mul i32 %2, -2018463491
%4 = add i32 %3, -1257966803
store i32 %4, i32* %0
ret i32 poison
}
void db_conv(int b, int two[8]) {
  int count;
  for (count = 7; b != 0; count--) {
    two[count] = b % 2;
    b = b / 2;
  }
}


x86 assembly (clang, -O0):
<db_conv>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x7,-0x14(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     114e <db_conv+0x4e>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1112 <db_conv+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<db_conv>:
test   %edi,%edi
je     1130 <db_conv+0x30>
add    $0x1c,%rsi
mov    %edi,%eax
nopw   0x0(%rax,%rax,1)
shr    $0x1f,%eax
add    %edi,%eax
mov    %eax,%ecx
and    $0xfffffffe,%ecx
mov    %edi,%edx
sub    %ecx,%edx
mov    %edx,(%rsi)
sar    %eax
add    $0x1,%edi
add    $0xfffffffffffffffc,%rsi
cmp    $0x2,%edi
mov    %eax,%edi
ja     1110 <db_conv+0x10>
ret

LLVM IR (-O0):
define void @db_conv(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 7, i32* %5
br label %6
6: ; preds = %18, %2
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %21
9: ; preds = %6
%10 = load i32, i32* %3
%11 = srem i32 %10, 2
%12 = load i32*, i32** %4
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
store i32 %11, i32* %15
%16 = load i32, i32* %3
%17 = sdiv i32 %16, 2
store i32 %17, i32* %3
br label %18
18: ; preds = %9
%19 = load i32, i32* %5
%20 = add nsw i32 %19, -1
store i32 %20, i32* %5
br label %6
21: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @db_conv(i32 %0, i32* nocapture writeonly %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %13, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %10, %4 ], [ 7, %2 ]
%6 = phi i32 [ %9, %4 ], [ %0, %2 ]
%7 = srem i32 %6, 2
%8 = getelementptr inbounds i32, i32* %1, i64 %5
store i32 %7, i32* %8
%9 = sdiv i32 %6, 2
%10 = add i64 %5, -1
%11 = add i32 %6, 1
%12 = icmp ult i32 %11, 3
br i1 %12, label %13, label %4
13: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ isdigit(char const);
bool is_all_num(const char *s) {
  for (; *s; ++s) {
    if (!isdigit(*s))
      return false;
  }
  return true;
}


x86 assembly (clang, -O0):
<is_all_num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1160 <is_all_num+0x50>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    114a <is_all_num+0x3a>
movl   $0x0,-0x4(%rbp)
jmp    1167 <is_all_num+0x57>
jmp    114f <is_all_num+0x3f>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111c <is_all_num+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_all_num>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
mov    $0x1,%ebp
test   %al,%al
je     114b <is_all_num+0x3b>
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     1149 <is_all_num+0x39>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <is_all_num+0x20>
jmp    114b <is_all_num+0x3b>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @is_all_num(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %7
4: ; preds = %7
%5 = load i8, i8* %12
%6 = icmp eq i8 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %1, %4
%8 = phi i8 [ %5, %4 ], [ %2, %1 ]
%9 = phi i8* [ %12, %4 ], [ %0, %1 ]
%10 = tail call i32 @isdigit(i8 signext %8)
%11 = icmp eq i32 %10, 0
%12 = getelementptr inbounds i8, i8* %9, i64 1
br i1 %11, label %13, label %4
13: ; preds = %7, %4, %1
%14 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %7 ]
ret i32 %14
}
void rtmp_temp_pfree(void *p, void *u) { return; }


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

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

LLVM IR (-O0):
define void @rtmp_temp_pfree(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret void
}

LLVM IR (-O2):
define void @rtmp_temp_pfree(i8* nocapture %0, i8* nocapture %1) {
ret void
}
void foo467(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo467(i32 %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char fgetc(int /*<<< orphan*/ *);
void limpaTag(FILE *arqin) {
  char c = fgetc(arqin);
  while (c != '>')
    c = fgetc(arqin);
}


x86 assembly (clang, -O0):
<limpaTag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x3e,%eax
je     1146 <limpaTag+0x36>
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0x9(%rbp)
jmp    1128 <limpaTag+0x18>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<limpaTag>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
call   1030 <fgetc@plt>
cmp    $0x3e,%al
je     112e <limpaTag+0x1e>
mov    %rbx,%rdi
jmp    1120 <limpaTag+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @limpaTag(i32* %0) {
%2 = alloca i32*
%3 = alloca i8
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call signext i8 @fgetc(i32* %4)
store i8 %5, i8* %3
br label %6
6: ; preds = %10, %1
%7 = load i8, i8* %3
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 62
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = load i32*, i32** %2
%12 = call signext i8 @fgetc(i32* %11)
store i8 %12, i8* %3
br label %6
13: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @limpaTag(i32* nocapture %0) {
%2 = tail call signext i8 @fgetc(i32* %0)
%3 = icmp eq i8 %2, 62
br i1 %3, label %7, label %4
4: ; preds = %1, %4
%5 = tail call signext i8 @fgetc(i32* %0)
%6 = icmp eq i8 %5, 62
br i1 %6, label %7, label %4
7: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    printf("Usage: %s <pid to be traced>\n", argv[0]);
    exit(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     115d <main+0x3d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
cmp    $0x2,%edi
jne    1128 <main+0x8>
xor    %eax,%eax
ret
push   %rax
mov    (%rsi),%rsi
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"Usage: %s <pid to be traced>\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %2
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"Usage: %s <pid to be traced>\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ ntohl(int /*<<< orphan*/);
int32_t minipack_unpack_int32(void *ptr, size_t *sz) {
  *sz = 5;
  return ntohl(*((int32_t *)(ptr + 1)));
}


x86 assembly (clang, -O0):
<minipack_unpack_int32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x5,(%rax)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%edi
call   1030 <ntohl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<minipack_unpack_int32>:
movq   $0x5,(%rsi)
mov    0x1(%rdi),%edi
jmp    1030 <ntohl@plt>

LLVM IR (-O0):
define i32 @minipack_unpack_int32(i8* %0, i64* %1) {
%3 = alloca i8*
%4 = alloca i64*
store i8* %0, i8** %3
store i64* %1, i64** %4
%5 = load i64*, i64** %4
store i64 5, i64* %5
%6 = load i8*, i8** %3
%7 = getelementptr i8, i8* %6, i64 1
%8 = bitcast i8* %7 to i32*
%9 = load i32, i32* %8
%10 = call i32 @ntohl(i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @minipack_unpack_int32(i8* nocapture %0, i64* nocapture writeonly %1) {
store i64 5, i64* %1
%3 = getelementptr i8, i8* %0, i64 1
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
%6 = tail call i32 @ntohl(i32 %5)
ret i32 %6
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
uint16_t rot16l7(uint16_t x) { return (x << 7) | (x >> 9); }


x86 assembly (clang, -O0):
<rot16l7>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x7,%eax
mov    -0x4(%rbp),%ecx
sar    $0x9,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rot16l7>:
mov    %edi,%eax
shl    $0x7,%eax
sar    $0x9,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @rot16l7(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 7
%5 = load i32, i32* %2
%6 = ashr i32 %5, 9
%7 = or i32 %4, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @rot16l7(i32 %0) {
%2 = shl i32 %0, 7
%3 = ashr i32 %0, 9
%4 = or i32 %2, %3
ret i32 %4
}
int isupper(int ch) {
  if (ch >= 0x41 && ch <= 0x5A)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<isupper>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x41,-0x8(%rbp)
jl     1127 <isupper+0x27>
cmpl   $0x5a,-0x8(%rbp)
jg     1127 <isupper+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <isupper+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isupper>:
add    $0xffffffbf,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @isupper(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 65
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 90
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 1, i32* %2
br label %11
10: ; preds = %6, %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @isupper(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
int main() { return 1 + 2 != 3; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int strlen3(char s[]) {
  int n;
  for (n = 0; *s != '\0'; s++)
    n++;
  return n;
}


x86 assembly (clang, -O0):
<strlen3>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1139 <strlen3+0x39>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <strlen3+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen3>:
cmpb   $0x0,(%rdi)
je     111c <strlen3+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen3+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @strlen3(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = add nuw nsw i32 %5, 1
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void const *, size_t);
size_t memncpy(void *dst, size_t dst_sz, const void *src, size_t n) {
  if (dst_sz < n) {
    return 0;
  }
  memcpy(dst, src, n);
  return n;
}


x86 assembly (clang, -O0):
<memncpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    1143 <memncpy+0x33>
movq   $0x0,-0x8(%rbp)
jmp    115c <memncpy+0x4c>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memncpy>:
push   %rbx
cmp    %rcx,%rsi
jae    111a <memncpy+0xa>
xor    %ebx,%ebx
jmp    1128 <memncpy+0x18>
mov    %rcx,%rbx
mov    %rdx,%rsi
mov    %rcx,%rdx
call   1030 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i64 @memncpy(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = icmp ult i64 %1, %3
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = tail call i32 @memcpy(i8* %0, i8* %2, i64 %3)
br label %8
8: ; preds = %4, %6
%9 = phi i64 [ %3, %6 ], [ 0, %4 ]
ret i64 %9
}
void BSP_L1DWritebackInvalidate(void) {
  unsigned long tmp;
  tmp = ({
    unsigned long __v = (*(volatile unsigned long *)(0x01845044));
    __v;
  });
  tmp |= 0x1;
  ({
    unsigned long __v = tmp;
    (*(volatile unsigned long *)(0x01845044) = (__v));
    __v;
  });
}


x86 assembly (clang, -O0):
<BSP_L1DWritebackInvalidate>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1845044,%eax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
or     $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rcx
mov    $0x1845044,%eax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<BSP_L1DWritebackInvalidate>:
orq    $0x1,0x1845044
01 01
ret

LLVM IR (-O0):
define void @BSP_L1DWritebackInvalidate() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = load volatile i64, i64* inttoptr (i64 25448516 to i64*)
store i64 %6, i64* %2
%7 = load i64, i64* %2
store i64 %7, i64* %3
%8 = load i64, i64* %3
store i64 %8, i64* %1
%9 = load i64, i64* %1
%10 = or i64 %9, 1
store i64 %10, i64* %1
%11 = load i64, i64* %1
store i64 %11, i64* %4
%12 = load i64, i64* %4
store volatile i64 %12, i64* inttoptr (i64 25448516 to i64*)
%13 = load i64, i64* %4
store i64 %13, i64* %5
%14 = load i64, i64* %5
ret void
}

LLVM IR (-O2):
define void @BSP_L1DWritebackInvalidate() {
%1 = load volatile i64, i64* inttoptr (i64 25448516 to i64*)
%2 = or i64 %1, 1
store volatile i64 %2, i64* inttoptr (i64 25448516 to i64*)
ret void
}
void writeAddress(void *write, void *value) { *(void **)write = value; }


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

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

LLVM IR (-O0):
define void @writeAddress(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i8**
store i8* %5, i8** %7
ret void
}

LLVM IR (-O2):
define void @writeAddress(i8* nocapture writeonly %0, i8* %1) {
%3 = bitcast i8* %0 to i8**
store i8* %1, i8** %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int count_up(int userin1) {
  int loop;
  for (loop = 0; loop <= userin1; loop++) {
    printf("%d ", loop);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<count_up>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     114d <count_up+0x3d>
mov    -0xc(%rbp),%esi
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1122 <count_up+0x12>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_up>:
push   %rbp
push   %r14
push   %rbx
test   %edi,%edi
js     1153 <count_up+0x33>
mov    %edi,%ebx
add    $0x1,%ebx
lea    0xecc(%rip),%r14
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1140 <count_up+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define i32 @count_up(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %8, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = add nuw i32 %4, 1
%7 = icmp eq i32 %4, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
%9 = tail call i32 @putchar(i32 10)
ret i32 undef
}
/* Type definitions */
struct timeval {
  int tv_sec;
  int /*<<< orphan*/ tv_usec;
};

/* Variables and functions */
scalar_t__ floor(double);
int /*<<< orphan*/ lrint(double);
int /*<<< orphan*/ tkh_timeval_normalize(struct timeval *);
struct timeval tkh_timeval_from_double(double t) {
  struct timeval tv;
  tv.tv_sec = (int)floor(t);
  tv.tv_usec = lrint((t - tv.tv_sec) * 1e6);
  tkh_timeval_normalize(&tv);
  return tv;
}


x86 assembly (clang, -O0):
<tkh_timeval_from_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <floor@plt>
mov    %eax,-0x8(%rbp)
movsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  0xea0(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <lrint@plt>
mov    %eax,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <tkh_timeval_normalize@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tkh_timeval_from_double>:
sub    $0x18,%rsp
movsd  %xmm0,0x10(%rsp)
call   1050 <floor@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mov    %eax,0x8(%rsp)
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xea4(%rip),%xmm1
movapd %xmm1,%xmm0
call   1040 <lrint@plt>
mov    %eax,0xc(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <tkh_timeval_normalize@plt>
mov    0x8(%rsp),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i64 @tkh_timeval_from_double(double %0) {
%2 = alloca %struct.timeval
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = call i64 @floor(double %4)
%6 = trunc i64 %5 to i32
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
store i32 %6, i32* %7
%8 = load double, double* %3
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%10 = load i32, i32* %9
%11 = sitofp i32 %10 to double
%12 = fsub double %8, %11
%13 = fmul double %12, 1.000000e+06
%14 = call i32 @lrint(double %13)
%15 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 1
store i32 %14, i32* %15
%16 = call i32 @tkh_timeval_normalize(%struct.timeval* %2)
%17 = bitcast %struct.timeval* %2 to i64*
%18 = load i64, i64* %17
ret i64 %18
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i64 @tkh_timeval_from_double(double %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to %struct.timeval*
%4 = tail call i64 @floor(double %0)
%5 = trunc i64 %4 to i32
%6 = bitcast i64* %2 to i32*
store i32 %5, i32* %6
%7 = sitofp i32 %5 to double
%8 = fsub double %0, %7
%9 = fmul double %8, 1.000000e+06
%10 = tail call i32 @lrint(double %9)
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
store i32 %10, i32* %11
%12 = call i32 @tkh_timeval_normalize(%struct.timeval* %3)
%13 = load i64, i64* %2
ret i64 %13
}
int cbreak() { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @cbreak() {
ret i32 0
}