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

/* Variables and functions */
unsigned int mget3l(const uint8_t *data) {
  return data[0] | (data[1] * 0x0100) | (data[2] * 0x010000);
}


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

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

LLVM IR (-O0):
define i32 @mget3l(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = load i32*, i32** %2
%7 = getelementptr inbounds i32, i32* %6, i64 1
%8 = load i32, i32* %7
%9 = mul nsw i32 %8, 256
%10 = or i32 %5, %9
%11 = load i32*, i32** %2
%12 = getelementptr inbounds i32, i32* %11, i64 2
%13 = load i32, i32* %12
%14 = mul nsw i32 %13, 65536
%15 = or i32 %10, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @mget3l(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = load i32, i32* %3
%5 = shl nsw i32 %4, 8
%6 = or i32 %5, %2
%7 = getelementptr inbounds i32, i32* %0, i64 2
%8 = load i32, i32* %7
%9 = shl nsw i32 %8, 16
%10 = or i32 %6, %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, char *);
void get_user_input(char *guess) { scanf("%99s", guess); }


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"%99s\00"
define void @get_user_input(i8* %0) {
%2 = tail call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
#define SIGHUP 131
#define SIGINT 130
#define SIGQUIT 129
#define SIGTERM 128
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ kill(int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, int);
void pr_signal_handler(int signum) {
  switch (signum) {
  case SIGTERM:
  case SIGINT:
  case SIGQUIT:
  case SIGHUP:
    printf("parent is getting %d\n", signum);
    kill(0, signum);
    exit(-1);
    break;
  default:
    printf("parent is getting %d\n", signum);
  }
}


x86 assembly (clang, -O0):
<pr_signal_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffff80,%eax
sub    $0x3,%eax
ja     1172 <pr_signal_handler+0x42>
jmp    114f <pr_signal_handler+0x1f>
mov    -0x4(%rbp),%esi
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
xor    %edi,%edi
call   1040 <kill@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    -0x4(%rbp),%esi
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_signal_handler>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    %edi,%ebp
and    $0xfffffffc,%ebp
lea    0xebf(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
cmp    $0x80,%ebp
je     1157 <pr_signal_handler+0x27>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
xor    %edi,%edi
mov    %ebx,%esi
call   1040 <kill@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@.str = [22 x i8] c"parent is getting %d\0A\00"
define void @pr_signal_handler(i32 %0) {
%2 = and i32 %0, -4
%3 = icmp eq i32 %2, 128
%4 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %0)
br i1 %3, label %5, label %8
5: ; preds = %1
%6 = tail call i32 @kill(i32 0, i32 %0)
%7 = tail call i32 @exit(i32 -1)
unreachable
8: ; preds = %1
ret void
}
/* Variables and functions */
int mysyscall();
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("Result: %u\n", mysyscall());
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [12 x i8] c"Result: %u\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @mysyscall()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int main(void) {
  fprintf(stderr,
          "This program (part of Valgrind) does nothing except print\n"
          "this text.  You should not see this text.  If you do, some\n"
          "part of valgrind's launch mechanism is not working correctly.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
lea    0xed1(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [180 x i8] c"This program (part of Valgrind) does nothing except print\0Athis text. You should not see this text. If you do, some\0Apart of valgrind's launch mechanism is not working correctly.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @stderr
%3 = call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([180 x i8], [180 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [180 x i8] c"This program (part of Valgrind) does nothing except print\0Athis text. You should not see this text. If you do, some\0Apart of valgrind's launch mechanism is not working correctly.\0A\00"
define i32 @main() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([180 x i8], [180 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int fb_GetX();
int fb_Pos(int dummy) { return fb_GetX(); }


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

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

LLVM IR (-O0):
define i32 @fb_Pos(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @fb_GetX()
ret i32 %3
}

LLVM IR (-O2):
define i32 @fb_Pos(i32 %0) {
%2 = tail call i32 (...) @fb_GetX()
ret i32 %2
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int syscon_write_dobldobl_system(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc(331, a, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<syscon_write_dobldobl_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x14b,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<syscon_write_dobldobl_system>:
mov    $0x14b,%edi
jmp    1030 <_ada_use_c2phc@plt>

LLVM IR (-O0):
define i32 @syscon_write_dobldobl_system() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc(i32 331, i32* %5, i32* %6, double* %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @syscon_write_dobldobl_system() {
%1 = tail call i32 @_ada_use_c2phc(i32 331, i32* undef, i32* undef, double* undef)
ret i32 %1
}
/* Variables and functions */
char *strstr(char *, char *);
bool startsWith(char *base, char *str) {
  return (strstr(base, str) - base) == 0;
}


x86 assembly (clang, -O0):
<startsWith>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strstr@plt>
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<startsWith>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @startsWith(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i8* @strstr(i8* %5, i8* %6)
%8 = load i8*, i8** %3
%9 = ptrtoint i8* %7 to i64
%10 = ptrtoint i8* %8 to i64
%11 = sub i64 %9, %10
%12 = icmp eq i64 %11, 0
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @startsWith(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%4 = tail call i32 @strncmp(i8* %0, i8* %1, i64 %3)
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef scalar_t__ int64_t;

/* Variables and functions */
scalar_t__ UINT8_MAX;
int QCBOR_Int64ToUInt8(int64_t src, uint8_t *dest) {
  if (src > UINT8_MAX || src < 0) {
    return -1;
  } else {
    *dest = (uint8_t)src;
  }
  return 0;
}


x86 assembly (clang, -O0):
<QCBOR_Int64ToUInt8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2ec9(%rip),%rcx
cmp    (%rcx),%rax
jg     112b <QCBOR_Int64ToUInt8+0x2b>
cmpq   $0x0,-0x10(%rbp)
jge    1137 <QCBOR_Int64ToUInt8+0x37>
movl   $0xffffffff,-0x4(%rbp)
jmp    1149 <QCBOR_Int64ToUInt8+0x49>
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<QCBOR_Int64ToUInt8>:
mov    $0xffffffff,%eax
test   %rdi,%rdi
js     111b <QCBOR_Int64ToUInt8+0x1b>
mov    0x2ecf(%rip),%rcx
cmp    %rdi,(%rcx)
jl     111b <QCBOR_Int64ToUInt8+0x1b>
mov    %rdi,(%rsi)
xor    %eax,%eax
ret

LLVM IR (-O0):
@UINT8_MAX = global i64 0
define i32 @QCBOR_Int64ToUInt8(i64 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64*
store i64 %0, i64* %4
store i64* %1, i64** %5
%6 = load i64, i64* %4
%7 = load i64, i64* @UINT8_MAX
%8 = icmp sgt i64 %6, %7
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = load i64, i64* %4
%11 = icmp slt i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %9, %2
store i32 -1, i32* %3
br label %17
13: ; preds = %9
%14 = load i64, i64* %4
%15 = load i64*, i64** %5
store i64 %14, i64* %15
br label %16
16: ; preds = %13
store i32 0, i32* %3
br label %17
17: ; preds = %16, %12
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
@UINT8_MAX = global i64 0
define i32 @QCBOR_Int64ToUInt8(i64 %0, i64* nocapture writeonly %1) {
%3 = load i64, i64* @UINT8_MAX
%4 = icmp slt i64 %3, %0
%5 = icmp slt i64 %0, 0
%6 = or i1 %5, %4
br i1 %6, label %8, label %7
7: ; preds = %2
store i64 %0, i64* %1
br label %8
8: ; preds = %2, %7
%9 = phi i32 [ 0, %7 ], [ -1, %2 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ itob(unsigned int, char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char s[20];
  itob(-((unsigned int)~0 >> 1) - 1, s, 16);
  printf("%s\n", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rsi
mov    $0x80000000,%edi
mov    $0x10,%edx
call   1040 <itob@plt>
lea    -0x20(%rbp),%rsi
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    %rsp,%rbx
mov    $0x80000000,%edi
mov    %rbx,%rsi
mov    $0x10,%edx
call   1040 <itob@plt>
lea    0xebf(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i32 @itob(i32 -2147483648, i8* %2, i32 16)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ DeinitFields();
void SwitchFrom_M16(void) { DeinitFields(); }


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

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

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

LLVM IR (-O2):
define void @SwitchFrom_M16() {
%1 = tail call i32 (...) @DeinitFields()
ret void
}
void X509_NAME_ENTRY_dup(void) {}


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

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

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

LLVM IR (-O2):
define void @X509_NAME_ENTRY_dup() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ s2ldev();
void s2ldev_() { s2ldev(); }


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

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

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

LLVM IR (-O2):
define void @s2ldev_() {
%1 = tail call i32 (...) @s2ldev()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ safeRead(int const, unsigned char *const,
                            unsigned int const);
void ReadBytes(int const fd, unsigned char *const buf,
               unsigned int const nbyte) {
  safeRead(fd, buf, nbyte);
}


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

x86 assembly (clang, -O2):
<ReadBytes>:
jmp    1030 <safeRead@plt>

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

LLVM IR (-O2):
define void @ReadBytes(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @safeRead(i32 %0, i8* %1, i32 %2)
ret void
}
char *clear_blanks(s)
char *s;
{
  char *res;
  for (res = s; (*res) == ' '; res++)
    ;
  return res;
}


x86 assembly (clang, -O0):
<clear_blanks>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1136 <clear_blanks+0x36>
jmp    1125 <clear_blanks+0x25>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <clear_blanks+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_blanks>:
mov    %rdi,%rax
add    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x20,0x1(%rax)
lea    0x1(%rax),%rax
je     1110 <clear_blanks+0x10>
ret

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

LLVM IR (-O2):
define i8* @clear_blanks(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 32
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %2, label %7
7: ; preds = %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ Set32(void *, int, int, int /*<<< orphan*/);
void omap_disable_display(int vid) {
  switch (vid) {
  case 0:
    Set32(((void *)0x48050400), 0x0A0, 1, 0);
    break;
  case 1:
    Set32(((void *)0x48050400), 0x0CC, 1, 0);
    break;
  case 2:
    Set32(((void *)0x48050400), (0x0CC + 0x90), 1, 0);
    break;
  }
}


x86 assembly (clang, -O0):
<omap_disable_display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
test   %eax,%eax
je     1150 <omap_disable_display+0x40>
jmp    112e <omap_disable_display+0x1e>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
je     116b <omap_disable_display+0x5b>
jmp    113f <omap_disable_display+0x2f>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
je     1186 <omap_disable_display+0x76>
jmp    119c <omap_disable_display+0x8c>
mov    $0x48050400,%edi
mov    $0xa0,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <Set32@plt>
jmp    119c <omap_disable_display+0x8c>
mov    $0x48050400,%edi
mov    $0xcc,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <Set32@plt>
jmp    119c <omap_disable_display+0x8c>
mov    $0x48050400,%edi
mov    $0x15c,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <Set32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<omap_disable_display>:
cmp    $0x2,%edi
ja     1133 <omap_disable_display+0x23>
movslq %edi,%rax
lea    0xee1(%rip),%rcx
mov    (%rcx,%rax,4),%esi
mov    $0x48050400,%edi
mov    $0x1,%edx
xor    %ecx,%ecx
jmp    1030 <Set32@plt>
ret

LLVM IR (-O0):
define void @omap_disable_display(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %10 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
]
4: ; preds = %1
%5 = call i32 @Set32(i8* inttoptr (i64 1208288256 to i8*), i32 160, i32 1, i32 0)
br label %10
6: ; preds = %1
%7 = call i32 @Set32(i8* inttoptr (i64 1208288256 to i8*), i32 204, i32 1, i32 0)
br label %10
8: ; preds = %1
%9 = call i32 @Set32(i8* inttoptr (i64 1208288256 to i8*), i32 348, i32 1, i32 0)
br label %10
10: ; preds = %1, %8, %6, %4
ret void
}

LLVM IR (-O2):
@switch.table.omap_disable_display = [3 x i32] [i32 160, i32 204, i32 348]
define void @omap_disable_display(i32 %0) {
%2 = icmp ult i32 %0, 3
br i1 %2, label %3, label %8
3: ; preds = %1
%4 = sext i32 %0 to i64
%5 = getelementptr inbounds [3 x i32], [3 x i32]* @switch.table.omap_disable_display, i64 0, i64 %4
%6 = load i32, i32* %5
%7 = tail call i32 @Set32(i8* inttoptr (i64 1208288256 to i8*), i32 %6, i32 1, i32 0)
br label %8
8: ; preds = %1, %3
ret void
}
/* Variables and functions */
long long strtoll(char const *, char **, int);
long long int atoll(const char *nptr) {
  return strtoll(nptr, (char **)NULL, 10);
}


x86 assembly (clang, -O0):
<atoll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1030 <strtoll@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atoll>:
xor    %esi,%esi
mov    $0xa,%edx
jmp    1030 <strtoll@plt>

LLVM IR (-O0):
define i64 @atoll(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strtoll(i8* %3, i8** null, i32 10)
ret i64 %4
}

LLVM IR (-O2):
define i64 @atoll(i8* nocapture %0) {
%2 = tail call i64 @strtoll(i8* nocapture %0, i8** null, i32 10)
ret i64 %2
}
void termop_testfill(struct ansiseq *s) {
  tnc_log_log(
      7, 4, -1,
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/fstd/telnetcat/refs/heads/devel/src/xterm.c",
      236, __func__, "unhandled");
  ansiseq_dump(s);
}


x86 assembly (clang, -O0):
<termop_testfill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x7,%edi
mov    $0x4,%esi
mov    $0xffffffff,%edx
lea    0xebe(%rip),%rcx
mov    $0xec,%r8d
lea    0xf37(%rip),%r9
lea    0xf40(%rip),%rax
mov    %rax,(%rsp)
mov    $0x0,%al
call   1030 <tnc_log_log@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <ansiseq_dump@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<termop_testfill>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xf67(%rip),%rax
mov    %rax,(%rsp)
lea    0xec6(%rip),%rcx
lea    0xf45(%rip),%r9
mov    $0x7,%edi
mov    $0x4,%esi
mov    $0xffffffff,%edx
mov    $0xec,%r8d
xor    %eax,%eax
call   1030 <tnc_log_log@plt>
mov    %rbx,%rdi
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1040 <ansiseq_dump@plt>

LLVM IR (-O0):
%struct.ansiseq = type opaque
@.str = [134 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fstd/telnetcat/refs/heads/devel/src/xterm.c\00"
@__func__.termop_testfill = [16 x i8] c"termop_testfill\00"
@.str.1 = [10 x i8] c"unhandled\00"
define void @termop_testfill(%struct.ansiseq* %0) {
%2 = alloca %struct.ansiseq*
store %struct.ansiseq* %0, %struct.ansiseq** %2
%3 = call i32 (i32, i32, i32, i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @tnc_log_log to i32 (i32, i32, i32, i8*, i32, i8*, i8*, ...)*)(i32 7, i32 4, i32 -1, i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str, i64 0, i64 0), i32 236, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @__func__.termop_testfill, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%4 = load %struct.ansiseq*, %struct.ansiseq** %2
%5 = call i32 (%struct.ansiseq*, ...) bitcast (i32 (...)* @ansiseq_dump to i32 (%struct.ansiseq*, ...)*)(%struct.ansiseq* %4)
ret void
}

LLVM IR (-O2):
%struct.ansiseq = type opaque
@.str = [134 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fstd/telnetcat/refs/heads/devel/src/xterm.c\00"
@__func__.termop_testfill = [16 x i8] c"termop_testfill\00"
@.str.1 = [10 x i8] c"unhandled\00"
define void @termop_testfill(%struct.ansiseq* %0) {
%2 = tail call i32 (i32, i32, i32, i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @tnc_log_log to i32 (i32, i32, i32, i8*, i32, i8*, i8*, ...)*)(i32 7, i32 4, i32 -1, i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str, i64 0, i64 0), i32 236, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @__func__.termop_testfill, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (%struct.ansiseq*, ...) bitcast (i32 (...)* @ansiseq_dump to i32 (%struct.ansiseq*, ...)*)(%struct.ansiseq* %0)
ret void
}
int GCD(int a, int b) {
  if (b == 0)
    return a;
  else
    return GCD(b, a % b);
}


x86 assembly (clang, -O0):
<GCD>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1133 <GCD+0x23>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1147 <GCD+0x37>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,%esi
call   1030 <GCD@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @GCD(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %1, %2 ]
%6 = phi i32 [ %5, %4 ], [ %0, %2 ]
%7 = srem i32 %6, %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ %0, %2 ], [ %5, %4 ]
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ Display;
typedef int /*<<< orphan*/ Bool;

/* Variables and functions */
int /*<<< orphan*/ XNVCTRLSetTargetAttributeAndGetStatus(int /*<<< orphan*/ *,
                                                         int /*<<< orphan*/,
                                                         int, unsigned int,
                                                         unsigned int, int);
Bool XNVCTRLSetAttributeAndGetStatus(Display *dpy, int screen,
                                     unsigned int display_mask,
                                     unsigned int attribute, int value) {
  return XNVCTRLSetTargetAttributeAndGetStatus(dpy, 0, screen, display_mask,
                                               attribute, value);
}


x86 assembly (clang, -O0):
<XNVCTRLSetAttributeAndGetStatus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
xor    %esi,%esi
call   1030 <XNVCTRLSetTargetAttributeAndGetStatus@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XNVCTRLSetAttributeAndGetStatus>:
mov    %r8d,%r9d
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %esi,%edx
xor    %esi,%esi
jmp    1030 <XNVCTRLSetTargetAttributeAndGetStatus@plt>

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

LLVM IR (-O2):
define i32 @XNVCTRLSetAttributeAndGetStatus(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @XNVCTRLSetTargetAttributeAndGetStatus(i32* %0, i32 0, i32 %1, i32 %2, i32 %3, i32 %4)
ret i32 %6
}
void term_OSProfile(void) {}


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

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

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

LLVM IR (-O2):
define void @term_OSProfile() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, char *, int);
int16_t extract_16bits(char *p) {
  int16_t tmp;
  memcpy(&tmp, p, sizeof(int16_t));
  return tmp;
}


x86 assembly (clang, -O0):
<extract_16bits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_16bits>:
push   %rax
mov    %rdi,%rsi
lea    0x4(%rsp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @extract_16bits(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @memcpy(i32* %2, i8* %0, i32 4)
%5 = load i32, i32* %2
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ prices;

/* Variables and functions */
int maxProfit(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int prices[6] = {7, 1, 5, 3, 6, 4};
  int priceSize = sizeof(prices) / sizeof(prices[0]);
  printf("%d\n", maxProfit(prices, priceSize));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x6,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1040 <maxProfit@plt>
mov    %eax,%esi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xee5(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x6,%esi
call   1040 <maxProfit@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@__const.main.prices = [6 x i32] [i32 7, i32 1, i32 5, i32 3, i32 6, i32 4]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [6 x i32]
%2 = bitcast [6 x i32]* %1 to i8*
%3 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%4 = call i32 @maxProfit(i32* %3, i32 6)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
void mpiboundary(long taskid) {}


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

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

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

LLVM IR (-O2):
define void @mpiboundary(i64 %0) {
ret void
}
int len(int num) {
  int len = 0;
  do {
    num /= 10;
    len++;
  } while (num != 0);
  return len;
}


x86 assembly (clang, -O0):
<len>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    110e <len+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<len>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
add    $0x1,%eax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <len+0x10>
ret

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

LLVM IR (-O2):
define i32 @len(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ %0, %1 ], [ %5, %2 ]
%4 = phi i32 [ 0, %1 ], [ %6, %2 ]
%5 = sdiv i32 %3, 10
%6 = add nuw nsw i32 %4, 1
%7 = add i32 %3, 9
%8 = icmp ult i32 %7, 19
br i1 %8, label %9, label %2
9: ; preds = %2
ret i32 %6
}
__attribute__((weak)) void MemManage_Handler(void) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<MemManage_Handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <MemManage_Handler+0x9>
jmp    1109 <MemManage_Handler+0x9>

x86 assembly (clang, -O2):
<MemManage_Handler>:
jmp    1100 <MemManage_Handler>

LLVM IR (-O0):
define weak void @MemManage_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define weak void @MemManage_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
double tan(double);
double hl_math_tan(double a) { return tan(a); }


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

x86 assembly (clang, -O2):
<hl_math_tan>:
jmp    1030 <tan@plt>

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

LLVM IR (-O2):
define double @hl_math_tan(double %0) {
%2 = tail call double @tan(double %0)
ret double %2
}
/* Variables and functions */
int cos(float);
float SineEaseInOut(float p) {
  return 0.5 * (1 - cos(p * 3.14159265358979323846));
}


x86 assembly (clang, -O0):
<SineEaseInOut>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeda(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <cos@plt>
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm1
movsd  0xeb0(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SineEaseInOut>:
push   %rax
cvtss2sd %xmm0,%xmm0
mulsd  0xee3(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <cos@plt>
mov    $0x1,%ecx
sub    %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
mulsd  0xecc(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @SineEaseInOut(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fmul double %4, 0x400921FB54442D18
%6 = fptrunc double %5 to float
%7 = call i32 @cos(float %6)
%8 = sub nsw i32 1, %7
%9 = sitofp i32 %8 to double
%10 = fmul double 5.000000e-01, %9
%11 = fptrunc double %10 to float
ret float %11
}

LLVM IR (-O2):
define float @SineEaseInOut(float %0) {
%2 = fpext float %0 to double
%3 = fmul double %2, 0x400921FB54442D18
%4 = fptrunc double %3 to float
%5 = tail call i32 @cos(float %4)
%6 = sub nsw i32 1, %5
%7 = sitofp i32 %6 to double
%8 = fmul double %7, 5.000000e-01
%9 = fptrunc double %8 to float
ret float %9
}
/* Variables and functions */
int FixedMul(int, int);
int smart_mul(int x, int y) {
  if (x >= 1.0 && y >= 1.0)
    return FixedMul(x, y);
  return x * y;
}


x86 assembly (clang, -O0):
<smart_mul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xed5(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     115f <smart_mul+0x4f>
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xebe(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     115f <smart_mul+0x4f>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <FixedMul@plt>
mov    %eax,-0x4(%rbp)
jmp    1169 <smart_mul+0x59>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smart_mul>:
test   %edi,%edi
jle    111d <smart_mul+0xd>
test   %esi,%esi
jle    111d <smart_mul+0xd>
jmp    1030 <FixedMul@plt>
imul   %edi,%esi
mov    %esi,%eax
ret

LLVM IR (-O0):
define i32 @smart_mul(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = sitofp i32 %6 to double
%8 = fcmp oge double %7, 1.000000e+00
br i1 %8, label %9, label %17
9: ; preds = %2
%10 = load i32, i32* %5
%11 = sitofp i32 %10 to double
%12 = fcmp oge double %11, 1.000000e+00
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = call i32 @FixedMul(i32 %14, i32 %15)
store i32 %16, i32* %3
br label %21
17: ; preds = %9, %2
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = mul nsw i32 %18, %19
store i32 %20, i32* %3
br label %21
21: ; preds = %17, %13
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @smart_mul(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, 0
%4 = icmp sgt i32 %1, 0
%5 = and i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @FixedMul(i32 %0, i32 %1)
br label %10
8: ; preds = %2
%9 = mul nsw i32 %1, %0
br label %10
10: ; preds = %8, %6
%11 = phi i32 [ %7, %6 ], [ %9, %8 ]
ret i32 %11
}
int main() {
  (*(void (*)())0)();
  return 0;
}


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

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

LLVM IR (-O2):
/* Variables and functions */
int shmdt(void const *);
int detach_shmem(const void *buffer) { return shmdt(buffer); }


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

x86 assembly (clang, -O2):
<detach_shmem>:
jmp    1030 <shmdt@plt>

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

LLVM IR (-O2):
define i32 @detach_shmem(i8* %0) {
%2 = tail call i32 @shmdt(i8* %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ x;

/* Variables and functions */
char **summaryRanges(int *, int, int *);
int main(void) {
  int x[] = {0, 5};
  char **res;
  int i;
  res = summaryRanges(x, sizeof(x) / sizeof(int), &i);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0xc(%rbp)
lea    -0xc(%rbp),%rdi
mov    $0x2,%esi
lea    -0x1c(%rbp),%rdx
call   1030 <summaryRanges@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movabs $0x500000000,%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
lea    0x14(%rsp),%rdx
mov    $0x2,%esi
call   1030 <summaryRanges@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.x = [2 x i32] [i32 0, i32 5]
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i32]
%3 = alloca i8**
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [2 x i32]* %2 to i8*
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%7 = call i8** @summaryRanges(i32* %6, i32 2, i32* %4)
store i8** %7, i8*** %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i64
%2 = alloca i32
%3 = bitcast i64* %1 to i8*
store i64 21474836480, i64* %1
%4 = bitcast i32* %2 to i8*
%5 = bitcast i64* %1 to i32*
%6 = call i8** @summaryRanges(i32* %5, i32 2, i32* %2)
ret i32 0
}
void mm_track_phys(void *physp) {}


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

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

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

LLVM IR (-O2):
define void @mm_track_phys(i8* nocapture %0) {
ret void
}
unsigned my_strlen(const char *s) {
  unsigned x = 0;
  while (*s) {
    s++;
    x++;
  }
  return x;
}


x86 assembly (clang, -O0):
<my_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1136 <my_strlen+0x36>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <my_strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @my_strlen(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 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add i32 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t btoh_u32(uint32_t bigval) {
  union {
    uint32_t l;
    uint8_t b[4];
  } u1, u2;
  u1.l = bigval;
  u2.b[0] = u1.b[3];
  u2.b[1] = u1.b[2];
  u2.b[2] = u1.b[1];
  u2.b[3] = u1.b[0];
  return u2.l;
}


x86 assembly (clang, -O0):
<btoh_u32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x28(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @btoh_u32(i32 %0) {
ret i32 undef
}
int prime(int n) {
  int i;
  if (n == 1)
    return 0;
  for (i = 2; i < n; i++) {
    if (n % i == 0)
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    111d <prime+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1166 <prime+0x66>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    115f <prime+0x5f>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    114c <prime+0x4c>
movl   $0x0,-0x4(%rbp)
jmp    1166 <prime+0x66>
jmp    1151 <prime+0x51>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1124 <prime+0x24>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<prime>:
xor    %ecx,%ecx
cmp    $0x1,%edi
jne    110a <prime+0xa>
mov    %ecx,%eax
ret
cmp    $0x3,%edi
jl     1130 <prime+0x30>
mov    $0x2,%esi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1107 <prime+0x7>
add    $0x1,%esi
cmp    %esi,%edi
jne    1120 <prime+0x20>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @prime(i32 %0) {
%2 = icmp eq i32 %0, 1
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = icmp sgt i32 %0, 2
br i1 %4, label %7, label %12
5: ; preds = %7
%6 = icmp eq i32 %11, %0
br i1 %6, label %12, label %7
7: ; preds = %3, %5
%8 = phi i32 [ %11, %5 ], [ 2, %3 ]
%9 = srem i32 %0, %8
%10 = icmp eq i32 %9, 0
%11 = add nuw nsw i32 %8, 1
br i1 %10, label %12, label %5
12: ; preds = %7, %5, %3, %1
%13 = phi i32 [ 0, %1 ], [ 1, %3 ], [ 0, %7 ], [ 1, %5 ]
ret i32 %13
}