xunge/DecIR huggingface dataset:
/* Variables and functions */
char *InputHandler();
scalar_t__ checkAlpha(char *);
int /*<<< orphan*/ checkNullity(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *);
char *getName(void) {
  printf("Name: ");
  char *name = InputHandler();
  checkNullity(name);
  if (checkAlpha(name)) {
    printf("Error: Invalid Name.");
    free(name);
    exit(1);
  }
  return name;
}


x86 assembly (clang, -O0):
<getName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe91(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <InputHandler@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <checkNullity@plt>
mov    -0x8(%rbp),%rdi
call   1040 <checkAlpha@plt>
cmp    $0x0,%rax
je     11ba <getName+0x5a>
lea    0xe65(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getName>:
push   %rbx
lea    0xe98(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <InputHandler@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1080 <checkNullity@plt>
mov    %rbx,%rdi
call   1040 <checkAlpha@plt>
test   %rax,%rax
jne    1191 <getName+0x31>
mov    %rbx,%rax
pop    %rbx
ret
lea    0xe6f(%rip),%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"Name: \00"
@.str.1 = [21 x i8] c"Error: Invalid Name.\00"
define i8* @getName() {
%1 = alloca i8*
%2 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = call i8* (...) @InputHandler()
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = call i32 @checkNullity(i8* %4)
%6 = load i8*, i8** %1
%7 = call i64 @checkAlpha(i8* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%11 = load i8*, i8** %1
%12 = call i32 @free(i8* %11)
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %0
%15 = load i8*, i8** %1
ret i8* %15
}

LLVM IR (-O2):
@.str = [7 x i8] c"Name: \00"
@.str.1 = [21 x i8] c"Error: Invalid Name.\00"
define i8* @getName() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = tail call i8* (...) @InputHandler()
%3 = tail call i32 @checkNullity(i8* %2)
%4 = tail call i64 @checkAlpha(i8* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %0
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @free(i8* %2)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %0
ret i8* %2
}
unsigned char my_set_a(void) { return 0xab; }


x86 assembly (clang, -O0):
<my_set_a>:
push   %rbp
mov    %rsp,%rbp
mov    $0xab,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_set_a>:
mov    $0xab,%al
ret

LLVM IR (-O0):
define zeroext i8 @my_set_a() {
ret i8 -85
}

LLVM IR (-O2):
define zeroext i8 @my_set_a() {
ret i8 -85
}
/* Variables and functions */
int PAPI_lock(int);
void papif_lock_(int *lock, int *check) { *check = PAPI_lock(*lock); }


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

x86 assembly (clang, -O2):
<papif_lock_>:
push   %rbx
mov    %rsi,%rbx
mov    (%rdi),%edi
call   1030 <PAPI_lock@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @papif_lock_(i32* nocapture %0, i32* nocapture writeonly %1) {
%3 = load i32, i32* %0
%4 = tail call i32 @PAPI_lock(i32 %3)
store i32 %4, i32* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ info_putchar(int /*<<< orphan*/);
void info_str(const char *c) {
  while (*c)
    info_putchar(*c++);
}


x86 assembly (clang, -O0):
<info_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <info_str+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <info_putchar@plt>
jmp    111c <info_str+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<info_str>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <info_str+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <info_putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <info_str+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @info_str(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 @info_putchar(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
void _threadpool_cleanup(void *m) {}


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

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

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

LLVM IR (-O2):
define void @_threadpool_cleanup(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void write(void *mellowStr) { printf("%s", (char *)(mellowStr + ((8) + (8)))); }


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

x86 assembly (clang, -O2):
<write>:
lea    0x10(%rdi),%rsi
lea    0xee5(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @write(i8* %0) {
%2 = getelementptr i8, i8* %0, i64 16
%3 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
ret void
}
void do_toggle_void(void) {}


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

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

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

LLVM IR (-O2):
define void @do_toggle_void() {
ret void
}
/* Variables and functions */
int _syscall(int, int, int /*<<< orphan*/, int /*<<< orphan*/);
int close(int fd) { return _syscall(6, fd, 0, 0); }


x86 assembly (clang, -O0):
<close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x6,%edi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1030 <_syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<close>:
mov    %edi,%esi
mov    $0x6,%edi
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <_syscall@plt>

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

LLVM IR (-O2):
define i32 @close(i32 %0) {
%2 = tail call i32 @_syscall(i32 6, i32 %0, i32 0, i32 0)
ret i32 %2
}
/* Variables and functions */
int respond_with_string(int, char *);
int respond_with_404(int connfd) {
  return respond_with_string(
      connfd, "<html><body><h3>400 - Not found<h3></body></html>");
}


x86 assembly (clang, -O0):
<respond_with_404>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    0xedb(%rip),%rsi
call   1030 <respond_with_string@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<respond_with_404>:
lea    0xee9(%rip),%rsi
jmp    1030 <respond_with_string@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"<html><body><h3>400 - Not found<h3></body></html>\00"
define i32 @respond_with_404(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @respond_with_string(i32 %3, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
ret i32 %4
}

LLVM IR (-O2):
@.str = [50 x i8] c"<html><body><h3>400 - Not found<h3></body></html>\00"
define i32 @respond_with_404(i32 %0) {
%2 = tail call i32 @respond_with_string(i32 %0, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
/* Variables and functions */
scalar_t__ malloc(int);
void leak_memory(void) {
  int *const temporary = (int *)malloc(sizeof(int));
  *temporary = 0;
}


x86 assembly (clang, -O0):
<leak_memory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<leak_memory>:
push   %rax
mov    $0x4,%edi
call   1030 <malloc@plt>
movl   $0x0,(%rax)
pop    %rax
ret

LLVM IR (-O0):
define void @leak_memory() {
%1 = alloca i32*
%2 = call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32* %3, i32** %1
%4 = load i32*, i32** %1
store i32 0, i32* %4
ret void
}

LLVM IR (-O2):
define void @leak_memory() {
%1 = tail call i64 @malloc(i32 4)
%2 = inttoptr i64 %1 to i32*
store i32 0, i32* %2
ret void
}
int main() {
  char c;
  void *x = __builtin_call_with_static_chain(ptr(), &c);
  if (x != &c)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x5(%rbp),%r10
mov    $0x0,%al
call   1040 <ptr@plt>
cltq
mov    %rax,-0x10(%rbp)
lea    -0x5(%rbp),%rax
cmp    %rax,-0x10(%rbp)
je     1153 <main+0x33>
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xf(%rsp),%rbx
mov    %rbx,%r10
xor    %eax,%eax
call   1040 <ptr@plt>
cltq
cmp    %rax,%rbx
jne    1143 <main+0x23>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8*
store i32 0, i32* %1
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @ptr to i32 (i8*, ...)*)(i8* nest %2)
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, %2
br i1 %8, label %9, label %10
9: ; preds = %0
unreachable
10: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i8
%2 = call i32 (i8*, ...) bitcast (i32 (...)* @ptr to i32 (i8*, ...)*)(i8* nest %1)
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i8*
%5 = icmp eq i8* %1, %4
br i1 %5, label %7, label %6
6: ; preds = %0
unreachable
7: ; preds = %0
ret i32 0
}
int test_imm_A4int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0xA4 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_A4int64_midword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
sar    $0x10,%rdx
and    $0xa4,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_A4int64_midword_mem>:
testb  $0xa4,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_A4int64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 16
%6 = and i64 %5, 164
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_A4int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 10747904
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int is_obs_text(char c) { return c < 0; }


x86 assembly (clang, -O0):
<is_obs_text>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x0,%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_obs_text>:
shr    $0x7,%dil
movzbl %dil,%eax
ret

LLVM IR (-O0):
define i32 @is_obs_text(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp slt i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @is_obs_text(i8 signext %0) {
%2 = lshr i8 %0, 7
%3 = zext i8 %2 to i32
ret i32 %3
}
int d_ge_rc2(double a1) { return !(((a1) >= (100))); }


x86 assembly (clang, -O0):
<d_ge_rc2>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
ucomisd %xmm1,%xmm0
setae  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_ge_rc2>:
xor    %eax,%eax
ucomisd 0xef6(%rip),%xmm0
setb   %al
ret

LLVM IR (-O0):
define i32 @d_ge_rc2(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp oge double %3, 1.000000e+02
%5 = xor i1 %4, true
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @d_ge_rc2(double %0) {
%2 = fcmp ult double %0, 1.000000e+02
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ function(int, int *, int /*<<< orphan*/, int *);
scalar_t__ malloc(int);
int totalNQueens(int n) {
  if (n <= 0)
    return 0;
  int result = 0;
  int *temp = (int *)malloc(sizeof(int) * n);
  function(n, temp, 0, &result);
  free(temp);
  return result;
}


x86 assembly (clang, -O0):
<totalNQueens>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     1151 <totalNQueens+0x21>
movl   $0x0,-0x4(%rbp)
jmp    118c <totalNQueens+0x5c>
movl   $0x0,-0xc(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%rsi
xor    %edx,%edx
lea    -0xc(%rbp),%rcx
call   1050 <function@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<totalNQueens>:
test   %edi,%edi
jle    1176 <totalNQueens+0x46>
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
movl   $0x0,0x4(%rsp)
lea    0x0(,%rbx,4),%edi
call   1040 <malloc@plt>
mov    %rax,%r14
lea    0x4(%rsp),%rcx
mov    %ebx,%edi
mov    %rax,%rsi
xor    %edx,%edx
call   1050 <function@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x4(%rsp),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @totalNQueens(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = icmp sle i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %22
9: ; preds = %1
store i32 0, i32* %4
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = mul i64 4, %11
%13 = trunc i64 %12 to i32
%14 = call i64 @malloc(i32 %13)
%15 = inttoptr i64 %14 to i32*
store i32* %15, i32** %5
%16 = load i32, i32* %3
%17 = load i32*, i32** %5
%18 = call i32 @function(i32 %16, i32* %17, i32 0, i32* %4)
%19 = load i32*, i32** %5
%20 = call i32 @free(i32* %19)
%21 = load i32, i32* %4
store i32 %21, i32* %2
br label %22
22: ; preds = %9, %8
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @totalNQueens(i32 %0) {
%2 = alloca i32
%3 = icmp slt i32 %0, 1
br i1 %3, label %12, label %4
4: ; preds = %1
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = shl i32 %0, 2
%7 = tail call i64 @malloc(i32 %6)
%8 = inttoptr i64 %7 to i32*
%9 = call i32 @function(i32 %0, i32* %8, i32 0, i32* %2)
%10 = call i32 @free(i32* %8)
%11 = load i32, i32* %2
br label %12
12: ; preds = %1, %4
%13 = phi i32 [ %11, %4 ], [ 0, %1 ]
ret i32 %13
}
/* Type definitions */
typedef int /*<<< orphan*/ u_char;
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int MAP_ANON;
int MAP_SHARED;
int PROT_EXEC;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ *mmap_or_null(int /*<<< orphan*/ *, size_t, int, int, int,
                                 int /*<<< orphan*/);
u_char *memzone_map_exec_area(size_t len) {
  return (mmap_or_null(NULL, len, PROT_EXEC | PROT_READ | PROT_WRITE,
                       MAP_SHARED | MAP_ANON, -1, (off_t)0));
}


x86 assembly (clang, -O0):
<memzone_map_exec_area>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    0x2eb1(%rip),%rax
mov    (%rax),%edx
mov    0x2ec8(%rip),%rax
or     (%rax),%edx
mov    0x2e8f(%rip),%rax
or     (%rax),%edx
mov    0x2ea6(%rip),%rax
mov    (%rax),%ecx
mov    0x2e75(%rip),%rax
or     (%rax),%ecx
xor    %eax,%eax
mov    %eax,%edi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1030 <mmap_or_null@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memzone_map_exec_area>:
mov    0x2ec1(%rip),%rax
mov    0x2eda(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2e9f(%rip),%rax
or     (%rax),%edx
mov    0x2eb6(%rip),%rax
mov    0x2e87(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    %rdi,%rsi
xor    %edi,%edi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
jmp    1030 <mmap_or_null@plt>

LLVM IR (-O0):
@PROT_EXEC = global i32 0
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@MAP_ANON = global i32 0
define i32* @memzone_map_exec_area(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = load i32, i32* @PROT_EXEC
%5 = load i32, i32* @PROT_READ
%6 = or i32 %4, %5
%7 = load i32, i32* @PROT_WRITE
%8 = or i32 %6, %7
%9 = load i32, i32* @MAP_SHARED
%10 = load i32, i32* @MAP_ANON
%11 = or i32 %9, %10
%12 = call i32* @mmap_or_null(i32* null, i64 %3, i32 %8, i32 %11, i32 -1, i32 0)
ret i32* %12
}

LLVM IR (-O2):
@PROT_EXEC = global i32 0
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@MAP_ANON = global i32 0
define i32* @memzone_map_exec_area(i64 %0) {
%2 = load i32, i32* @PROT_EXEC
%3 = load i32, i32* @PROT_READ
%4 = or i32 %3, %2
%5 = load i32, i32* @PROT_WRITE
%6 = or i32 %4, %5
%7 = load i32, i32* @MAP_SHARED
%8 = load i32, i32* @MAP_ANON
%9 = or i32 %8, %7
%10 = tail call i32* @mmap_or_null(i32* null, i64 %0, i32 %6, i32 %9, i32 -1, i32 0)
ret i32* %10
}
/* Variables and functions */
int /*<<< orphan*/ console_string(char const *);
void printString(const char *s) { console_string(s); }


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

x86 assembly (clang, -O2):
<printString>:
jmp    1030 <console_string@plt>

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

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

/* Variables and functions */
int /*<<< orphan*/ socket_printf(struct session *, int, char *, int, int, int);
int /*<<< orphan*/ telopt_debug(struct session *, char *);
int send_wont_new_environ(struct session *ses, int cplen,
                          unsigned char *cpsrc) {
  socket_printf(ses, 3, "%c%c%c", 255, 252, 39);
  telopt_debug(ses, "SENT IAC WONT NEW_ENVIRON");
  return 3;
}


x86 assembly (clang, -O0):
<send_wont_new_environ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3,%esi
lea    0xebd(%rip),%rdx
mov    $0xff,%ecx
mov    $0xfc,%r8d
mov    $0x27,%r9d
call   1040 <socket_printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xea3(%rip),%rsi
call   1030 <telopt_debug@plt>
mov    $0x3,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_wont_new_environ>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdx
mov    $0x3,%esi
mov    $0xff,%ecx
mov    $0xfc,%r8d
mov    $0x27,%r9d
call   1040 <socket_printf@plt>
lea    0xeba(%rip),%rsi
mov    %rbx,%rdi
call   1030 <telopt_debug@plt>
mov    $0x3,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.session = type { i32 }
@.str = [7 x i8] c"%c%c%c\00"
@.str.1 = [26 x i8] c"SENT IAC WONT NEW_ENVIRON\00"
define i32 @send_wont_new_environ(%struct.session* %0, i32 %1, i8* %2) {
%4 = alloca %struct.session*
%5 = alloca i32
%6 = alloca i8*
store %struct.session* %0, %struct.session** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load %struct.session*, %struct.session** %4
%8 = call i32 @socket_printf(%struct.session* %7, i32 3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 255, i32 252, i32 39)
%9 = load %struct.session*, %struct.session** %4
%10 = call i32 @telopt_debug(%struct.session* %9, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret i32 3
}

LLVM IR (-O2):
%struct.session = type { i32 }
@.str = [7 x i8] c"%c%c%c\00"
@.str.1 = [26 x i8] c"SENT IAC WONT NEW_ENVIRON\00"
define i32 @send_wont_new_environ(%struct.session* %0, i32 %1, i8* nocapture readnone %2) {
%4 = tail call i32 @socket_printf(%struct.session* %0, i32 3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 255, i32 252, i32 39)
%5 = tail call i32 @telopt_debug(%struct.session* %0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret i32 3
}
/* Variables and functions */
unsigned int value_as_int(float);
unsigned int itof_func(unsigned int param1, unsigned int param2) {
  (void)param2;
  return value_as_int((float)(int)param1);
}


x86 assembly (clang, -O0):
<itof_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
call   1030 <value_as_int@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<itof_func>:
cvtsi2ss %edi,%xmm0
jmp    1030 <value_as_int@plt>

LLVM IR (-O0):
define i32 @itof_func(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = sitofp i32 %6 to float
%8 = call i32 @value_as_int(float %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @itof_func(i32 %0, i32 %1) {
%3 = sitofp i32 %0 to float
%4 = tail call i32 @value_as_int(float %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int t;
  while (1) {
    scanf("%d", &t);
    if (t != 42)
      printf("%d\n", t);
    else
      exit(0);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x2a,-0x8(%rbp)
je     116d <main+0x3d>
mov    -0x8(%rbp),%esi
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
jmp    1174 <main+0x44>
xor    %edi,%edi
call   1050 <exit@plt>
jmp    113f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
cmp    $0x2a,%esi
je     118c <main+0x5c>
lea    0xea9(%rip),%r14
lea    0xe9f(%rip),%r15
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
cmp    $0x2a,%esi
jne    1170 <main+0x40>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %0, %12
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 42
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
br label %12
10: ; preds = %3
%11 = call i32 @exit(i32 0)
unreachable
12: ; preds = %7
br label %3
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 42
br i1 %5, label %12, label %6
6: ; preds = %0, %6
%7 = phi i32 [ %10, %6 ], [ %4, %0 ]
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
%11 = icmp eq i32 %10, 42
br i1 %11, label %12, label %6
12: ; preds = %6, %0
%13 = call i32 @exit(i32 0)
unreachable
}
int bitsToChars(int bits) { return ((bits + 7) & (~7)) >> 3; }


x86 assembly (clang, -O0):
<bitsToChars>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x7,%eax
and    $0xfffffff8,%eax
sar    $0x3,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitsToChars>:
lea    0x7(%rdi),%eax
sar    $0x3,%eax
ret

LLVM IR (-O0):
define i32 @bitsToChars(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 7
%5 = and i32 %4, -8
%6 = ashr i32 %5, 3
ret i32 %6
}

LLVM IR (-O2):
define i32 @bitsToChars(i32 %0) {
%2 = add nsw i32 %0, 7
%3 = ashr i32 %2, 3
ret i32 %3
}
/* Variables and functions */
int EXIT_SUCCESS;
int unsafe(void *cl) {
  int i, *ip = cl;
  for (i = 0; i < 30000; i++)
    *ip = *ip + 1;
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<unsafe>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x7530,-0xc(%rbp)
jge    1141 <unsafe+0x41>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1117 <unsafe+0x17>
mov    0x2e98(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unsafe>:
addl   $0x7530,(%rdi)
mov    0x2ed3(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @unsafe(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = bitcast i8* %5 to i32*
store i32* %6, i32** %4
store i32 0, i32* %3
br label %7
7: ; preds = %15, %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 30000
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = load i32*, i32** %4
%12 = load i32, i32* %11
%13 = add nsw i32 %12, 1
%14 = load i32*, i32** %4
store i32 %13, i32* %14
br label %15
15: ; preds = %10
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %7
18: ; preds = %7
%19 = load i32, i32* @EXIT_SUCCESS
ret i32 %19
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @unsafe(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = add i32 %3, 30000
store i32 %4, i32* %2
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int listen(int, int);
int /*<<< orphan*/ perror(char *);
void socket_listen(int server, int back) {
  int res;
  res = listen(server, back);
  if (res < 0) {
    perror("server could not listen on port");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<socket_listen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <listen@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    116c <socket_listen+0x3c>
lea    0xea3(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<socket_listen>:
push   %rax
call   1030 <listen@plt>
test   %eax,%eax
js     113c <socket_listen+0xc>
pop    %rax
ret
lea    0xebd(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"server could not listen on port\00"
define void @socket_listen(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
%7 = load i32, i32* %4
%8 = call i32 @listen(i32 %6, i32 %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"server could not listen on port\00"
define void @socket_listen(i32 %0, i32 %1) {
%3 = tail call i32 @listen(i32 %0, i32 %1)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
ret void
}
int lqtvq_clamp65535(int x) {
  return ((x < 0) ? 0 : ((x > 65535) ? 65535 : x));
}


x86 assembly (clang, -O0):
<lqtvq_clamp65535>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111b <lqtvq_clamp65535+0x1b>
xor    %eax,%eax
mov    %eax,-0x8(%rbp)
jmp    1141 <lqtvq_clamp65535+0x41>
cmpl   $0xffff,-0x4(%rbp)
jle    1135 <lqtvq_clamp65535+0x35>
mov    $0xffff,%eax
mov    %eax,-0xc(%rbp)
jmp    113b <lqtvq_clamp65535+0x3b>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lqtvq_clamp65535>:
cmp    $0xffff,%edi
mov    $0xffff,%ecx
cmovl  %edi,%ecx
xor    %eax,%eax
test   %ecx,%ecx
cmovns %ecx,%eax
ret

LLVM IR (-O0):
define i32 @lqtvq_clamp65535(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
br label %14
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 65535
br i1 %8, label %9, label %10
9: ; preds = %6
br label %12
10: ; preds = %6
%11 = load i32, i32* %2
br label %12
12: ; preds = %10, %9
%13 = phi i32 [ 65535, %9 ], [ %11, %10 ]
br label %14
14: ; preds = %12, %5
%15 = phi i32 [ 0, %5 ], [ %13, %12 ]
ret i32 %15
}

LLVM IR (-O2):
define i32 @lqtvq_clamp65535(i32 %0) {
%2 = icmp slt i32 %0, 65535
%3 = select i1 %2, i32 %0, i32 65535
%4 = icmp sgt i32 %3, 0
%5 = select i1 %4, i32 %3, i32 0
ret i32 %5
}
/* Variables and functions */
scalar_t__ malloc(unsigned short);
unsigned short *aus1d(unsigned short X) {
  unsigned short *A = (unsigned short *)malloc(X * sizeof(unsigned short *));
  return A;
}


x86 assembly (clang, -O0):
<aus1d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
shl    $0x3,%rax
movzwl %ax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aus1d>:
shl    $0x3,%edi
movzwl %di,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i16* @aus1d(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i16*
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = zext i16 %4 to i64
%6 = mul i64 %5, 8
%7 = trunc i64 %6 to i16
%8 = call i64 @malloc(i16 zeroext %7)
%9 = inttoptr i64 %8 to i16*
store i16* %9, i16** %3
%10 = load i16*, i16** %3
ret i16* %10
}

LLVM IR (-O2):
define i16* @aus1d(i16 zeroext %0) {
%2 = shl i16 %0, 3
%3 = tail call i64 @malloc(i16 zeroext %2)
%4 = inttoptr i64 %3 to i16*
ret i16* %4
}
/* Variables and functions */
int /*<<< orphan*/ bsp_coresight_disable();
void bsp_utrace_stop(void) {
  bsp_coresight_disable();
  return;
}


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

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

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

LLVM IR (-O2):
define void @bsp_utrace_stop() {
%1 = tail call i32 (...) @bsp_coresight_disable()
ret void
}
unsigned snmp_tag(const unsigned char *px, unsigned length,
                  unsigned *r_offset) {
  if (*r_offset >= length)
    return 0;
  return px[(*r_offset)++];
}


x86 assembly (clang, -O0):
<snmp_tag>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
cmp    -0x14(%rbp),%eax
jb     112a <snmp_tag+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    1144 <snmp_tag+0x44>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rdx
mov    (%rdx),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,(%rdx)
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<snmp_tag>:
mov    (%rdx),%ecx
xor    %eax,%eax
cmp    %esi,%ecx
jae    1111 <snmp_tag+0x11>
lea    0x1(%rcx),%eax
mov    %eax,(%rdx)
movzbl (%rdi,%rcx,1),%eax
ret

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

LLVM IR (-O2):
define i32 @snmp_tag(i8* nocapture %0, i32 %1, i32* nocapture %2) {
%4 = load i32, i32* %2
%5 = icmp ult i32 %4, %1
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = add nuw i32 %4, 1
store i32 %7, i32* %2
%8 = zext i32 %4 to i64
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
br label %12
12: ; preds = %3, %6
%13 = phi i32 [ %11, %6 ], [ 0, %3 ]
ret i32 %13
}
/* Type definitions */
typedef unsigned char u_int16_t;

/* Variables and functions */
unsigned char *deserialize_u_int16_t(u_int16_t *dest, unsigned char *data) {
  *dest = (data[0] << 8) + data[1];
  return data + 2;
}


x86 assembly (clang, -O0):
<deserialize_u_int16_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
shl    $0x8,%eax
mov    -0x10(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
add    %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x2,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<deserialize_u_int16_t>:
mov    0x1(%rsi),%al
mov    %al,(%rdi)
lea    0x2(%rsi),%rax
ret

LLVM IR (-O0):
define i8* @deserialize_u_int16_t(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 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = shl i32 %8, 8
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = add nsw i32 %9, %13
%15 = trunc i32 %14 to i8
%16 = load i8*, i8** %3
store i8 %15, i8* %16
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i64 2
ret i8* %18
}

LLVM IR (-O2):
define i8* @deserialize_u_int16_t(i8* nocapture writeonly %0, i8* %1) {
%3 = getelementptr inbounds i8, i8* %1, i64 1
%4 = load i8, i8* %3
store i8 %4, i8* %0
%5 = getelementptr inbounds i8, i8* %1, i64 2
ret i8* %5
}
/* Variables and functions */
unsigned long simple_strtoull(char const *, char **, unsigned int);
unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base) {
  return simple_strtoull(cp, endp, base);
}


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

x86 assembly (clang, -O2):
<simple_strtoul>:
jmp    1030 <simple_strtoull@plt>

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

LLVM IR (-O2):
define i64 @simple_strtoul(i8* %0, i8** %1, i32 %2) {
%4 = tail call i64 @simple_strtoull(i8* %0, i8** %1, i32 %2)
ret i64 %4
}
/* Variables and functions */
int FNM_PERIOD;
int internal_fnmatch(char const *, char const *, int, int);
int fnmatch(const char *pattern, const char *string, int flags) {
  return internal_fnmatch(pattern, string, flags & FNM_PERIOD, flags);
}


x86 assembly (clang, -O0):
<fnmatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    0x2eab(%rip),%rax
and    (%rax),%edx
mov    -0x14(%rbp),%ecx
call   1030 <internal_fnmatch@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnmatch>:
mov    %edx,%ecx
mov    0x2ec7(%rip),%rax
mov    (%rax),%edx
and    %ecx,%edx
jmp    1030 <internal_fnmatch@plt>

LLVM IR (-O0):
@FNM_PERIOD = global i32 0
define i32 @fnmatch(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = load i32, i32* @FNM_PERIOD
%11 = and i32 %9, %10
%12 = load i32, i32* %6
%13 = call i32 @internal_fnmatch(i8* %7, i8* %8, i32 %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
@FNM_PERIOD = global i32 0
define i32 @fnmatch(i8* %0, i8* %1, i32 %2) {
%4 = load i32, i32* @FNM_PERIOD
%5 = and i32 %4, %2
%6 = tail call i32 @internal_fnmatch(i8* %0, i8* %1, i32 %5, i32 %2)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ command(char *);
void EndCycles() { command("n\n"); }


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

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

LLVM IR (-O0):
@.str = [3 x i8] c"n\0A\00"
define void @EndCycles() {
%1 = call i32 @command(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"n\0A\00"
define void @EndCycles() {
%1 = tail call i32 @command(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void h2(char *header) { printf("<h2>%s</h2>\n", header); }


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

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

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

LLVM IR (-O2):
@.str = [13 x i8] c"<h2>%s</h2>\0A\00"
define void @h2(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ sqlite3;

/* Variables and functions */
int SQLITE_OK;
int /*<<< orphan*/ assert(int);
int sqlite3_exec(int /*<<< orphan*/ *, char const *, int /*<<< orphan*/ *,
                 int /*<<< orphan*/ *, char **);
int /*<<< orphan*/ sqlite3_free(char *);
void db_simple_exec(sqlite3 *db, const char *query) {
  char *errmsg;
  int ret;
  errmsg = NULL;
  ret = sqlite3_exec(db, query, NULL, NULL, &errmsg);
  assert(ret == SQLITE_OK);
  if (errmsg != NULL)
    sqlite3_free(errmsg);
}


x86 assembly (clang, -O0):
<db_simple_exec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x18(%rbp),%r8
mov    %rcx,%rdx
call   1030 <sqlite3_exec@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2e7b(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpq   $0x0,-0x18(%rbp)
je     1190 <db_simple_exec+0x60>
mov    -0x18(%rbp),%rdi
call   1050 <sqlite3_free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<db_simple_exec>:
push   %rax
movq   $0x0,(%rsp)
mov    %rsp,%r8
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <sqlite3_exec@plt>
mov    0x2e9c(%rip),%rcx
xor    %edi,%edi
cmp    (%rcx),%eax
sete   %dil
call   1040 <assert@plt>
mov    (%rsp),%rdi
test   %rdi,%rdi
je     1167 <db_simple_exec+0x37>
call   1050 <sqlite3_free@plt>
pop    %rax
ret

LLVM IR (-O0):
@SQLITE_OK = global i32 0
define void @db_simple_exec(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i32* %0, i32** %3
store i8* %1, i8** %4
store i8* null, i8** %5
%7 = load i32*, i32** %3
%8 = load i8*, i8** %4
%9 = call i32 @sqlite3_exec(i32* %7, i8* %8, i32* null, i32* null, i8** %5)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = load i32, i32* @SQLITE_OK
%12 = icmp eq i32 %10, %11
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load i8*, i8** %5
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %20
17: ; preds = %2
%18 = load i8*, i8** %5
%19 = call i32 @sqlite3_free(i8* %18)
br label %20
20: ; preds = %17, %2
ret void
}

LLVM IR (-O2):
@SQLITE_OK = global i32 0
define void @db_simple_exec(i32* %0, i8* %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%5 = call i32 @sqlite3_exec(i32* %0, i8* %1, i32* null, i32* null, i8** %3)
%6 = load i32, i32* @SQLITE_OK
%7 = icmp eq i32 %5, %6
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i8*, i8** %3
%11 = icmp eq i8* %10, null
br i1 %11, label %14, label %12
12: ; preds = %2
%13 = call i32 @sqlite3_free(i8* %10)
br label %14
14: ; preds = %12, %2
ret void
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char const *);
char *influxdb_strdup(const char *s) {
  char *d;
  if (s == NULL)
    return NULL;
  d = malloc(sizeof(char) * (strlen(s) + 1));
  if (d == NULL)
    return NULL;
  strcpy(d, s);
  return d;
}


x86 assembly (clang, -O0):
<influxdb_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1154 <influxdb_strdup+0x24>
movq   $0x0,-0x8(%rbp)
jmp    119e <influxdb_strdup+0x6e>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1189 <influxdb_strdup+0x59>
movq   $0x0,-0x8(%rbp)
jmp    119e <influxdb_strdup+0x6e>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<influxdb_strdup>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     115e <influxdb_strdup+0x2e>
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
call   1050 <malloc@plt>
test   %rax,%rax
je     115e <influxdb_strdup+0x2e>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
jmp    1160 <influxdb_strdup+0x30>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @influxdb_strdup(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = add nsw i32 %4, 1
%6 = tail call i8* @malloc(i32 %5)
%7 = icmp eq i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %3
%9 = tail call i32 @strcpy(i8* %6, i8* %0)
br label %10
10: ; preds = %3, %1, %8
%11 = phi i8* [ %6, %8 ], [ null, %1 ], [ null, %3 ]
ret i8* %11
}
long ascii_hash(char *key) {
  int i = 0;
  long result = 0;
  while (key[i] != 0) {
    result = result + ((i + 1) * key[i]);
    i = i + 1;
  }
  return (result);
}


x86 assembly (clang, -O0):
<ascii_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     115d <ascii_hash+0x5d>
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
mov    -0x8(%rbp),%rdx
movslq -0xc(%rbp),%rsi
movsbl (%rdx,%rsi,1),%edx
imul   %edx,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1117 <ascii_hash+0x17>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ascii_hash>:
mov    (%rdi),%dl
test   %dl,%dl
je     1129 <ascii_hash+0x29>
mov    $0x1,%ecx
xor    %eax,%eax
nopl   (%rax)
movsbl %dl,%edx
imul   %ecx,%edx
movslq %edx,%rdx
add    %rdx,%rax
movzbl (%rdi,%rcx,1),%edx
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <ascii_hash+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @ascii_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %17, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %9, %4 ], [ 0, %1 ]
%6 = phi i8 [ %15, %4 ], [ %2, %1 ]
%7 = phi i64 [ %13, %4 ], [ 0, %1 ]
%8 = sext i8 %6 to i64
%9 = add nuw nsw i64 %5, 1
%10 = mul i64 %9, %8
%11 = shl i64 %10, 32
%12 = ashr exact i64 %11, 32
%13 = add nsw i64 %7, %12
%14 = getelementptr inbounds i8, i8* %0, i64 %9
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %4
17: ; preds = %4, %1
%18 = phi i64 [ 0, %1 ], [ %13, %4 ]
ret i64 %18
}