xunge/DecIR huggingface dataset:
/* Type definitions */
struct expr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ log_error(char *);
double _expr_double_value(struct expr *this, void *context) {
  log_error("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/Uga-Agga/Game/refs/heads/master/src/"
            "ticker/expression.c"
            ":"
            "67"
            ": "
            "error: "
            "type error: number expected");
  return 0;
}


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

x86 assembly (clang, -O2):
<_expr_double_value>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <log_error@plt>
xorps  %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
%struct.expr = type { i32 }
@.str = [185 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Uga-Agga/Game/refs/heads/master/src/ticker/expression.c:67: error: type error: number expected\00"
define double @_expr_double_value(%struct.expr* %0, i8* %1) {
%3 = alloca %struct.expr*
%4 = alloca i8*
store %struct.expr* %0, %struct.expr** %3
store i8* %1, i8** %4
%5 = call i32 @log_error(i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str, i64 0, i64 0))
ret double 0.000000e+00
}

LLVM IR (-O2):
%struct.expr = type { i32 }
@.str = [185 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Uga-Agga/Game/refs/heads/master/src/ticker/expression.c:67: error: type error: number expected\00"
define double @_expr_double_value(%struct.expr* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = tail call i32 @log_error(i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str, i64 0, i64 0))
ret double 0.000000e+00
}
/* Variables and functions */
char *om_gps_keep_on_in_suspend_path();
int om_sysfs_writefile(char const *, char *);
int om_gps_keep_on_in_suspend_set(int value) {
  const char *path = om_gps_keep_on_in_suspend_path();
  if (path == NULL)
    return -1;
  return om_sysfs_writefile(path, value ? "1\n" : "0\n");
}


x86 assembly (clang, -O0):
<om_gps_keep_on_in_suspend_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <om_gps_keep_on_in_suspend_path@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114d <om_gps_keep_on_in_suspend_set+0x2d>
movl   $0xffffffff,-0x4(%rbp)
jmp    1171 <om_gps_keep_on_in_suspend_set+0x51>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%ecx
lea    0xea8(%rip),%rsi
lea    0xe9e(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
call   1040 <om_sysfs_writefile@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<om_gps_keep_on_in_suspend_set>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <om_gps_keep_on_in_suspend_path@plt>
test   %rax,%rax
je     114c <om_gps_keep_on_in_suspend_set+0x2c>
test   %ebx,%ebx
lea    0xecb(%rip),%rcx
lea    0xec1(%rip),%rsi
cmove  %rcx,%rsi
mov    %rax,%rdi
pop    %rbx
jmp    1040 <om_sysfs_writefile@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"1\0A\00"
@.str.1 = [3 x i8] c"0\0A\00"
define i32 @om_gps_keep_on_in_suspend_set(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
%5 = call i8* (...) @om_gps_keep_on_in_suspend_path()
store i8* %5, i8** %4
%6 = load i8*, i8** %4
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 -1, i32* %2
br label %16
9: ; preds = %1
%10 = load i8*, i8** %4
%11 = load i32, i32* %3
%12 = icmp ne i32 %11, 0
%13 = zext i1 %12 to i64
%14 = select i1 %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0)
%15 = call i32 @om_sysfs_writefile(i8* %10, i8* %14)
store i32 %15, i32* %2
br label %16
16: ; preds = %9, %8
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
@.str = [3 x i8] c"1\0A\00"
@.str.1 = [3 x i8] c"0\0A\00"
define i32 @om_gps_keep_on_in_suspend_set(i32 %0) {
%2 = tail call i8* (...) @om_gps_keep_on_in_suspend_path()
%3 = icmp eq i8* %2, null
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = icmp eq i32 %0, 0
%6 = select i1 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
%7 = tail call i32 @om_sysfs_writefile(i8* %2, i8* %6)
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ -1, %1 ]
ret i32 %9
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int /*<<< orphan*/ xmapping;
};
typedef TYPE_1__ XEvent;

/* Variables and functions */
int /*<<< orphan*/ XRefreshKeyboardMapping(int /*<<< orphan*/ *);
void keymap_event(XEvent *ev, void *ptr) {
  ptr = ptr;
  XRefreshKeyboardMapping(&((*ev).xmapping));
}


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

x86 assembly (clang, -O2):
<keymap_event>:
jmp    1030 <XRefreshKeyboardMapping@plt>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32 }
define void @keymap_event(%struct.TYPE_3__* %0, i8* %1) {
%3 = alloca %struct.TYPE_3__*
%4 = alloca i8*
store %struct.TYPE_3__* %0, %struct.TYPE_3__** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
store i8* %5, i8** %4
%6 = load %struct.TYPE_3__*, %struct.TYPE_3__** %3
%7 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %6, i32 0, i32 0
%8 = call i32 @XRefreshKeyboardMapping(i32* %7)
ret void
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32 }
define void @keymap_event(%struct.TYPE_3__* %0, i8* nocapture readnone %1) {
%3 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 0
%4 = tail call i32 @XRefreshKeyboardMapping(i32* %3)
ret void
}
/* Variables and functions */
bool norg(bool s, bool c) { return !(s || c); }


x86 assembly (clang, -O0):
<norg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x9(%rbp)
jne    1123 <norg+0x23>
cmpl   $0x0,-0x8(%rbp)
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<norg>:
xor    %eax,%eax
or     %esi,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @norg(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 = icmp ne i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 0
br label %10
10: ; preds = %7, %2
%11 = phi i1 [ true, %2 ], [ %9, %7 ]
%12 = xor i1 %11, true
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @norg(i32 %0, i32 %1) {
%3 = or i32 %1, %0
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ perror(char *);
void *xmalloc(size_t size) {
  void *p;
  if ((p = malloc(size)) == NULL)
    perror("malloc failed");
  return p;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    114f <xmalloc+0x2f>
lea    0xeb6(%rip),%rdi
call   1040 <perror@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rbx
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1133 <xmalloc+0x13>
mov    %rbx,%rax
pop    %rbx
ret
lea    0xec6(%rip),%rdi
call   1040 <perror@plt>
jmp    112e <xmalloc+0xe>

LLVM IR (-O0):
@.str = [14 x i8] c"malloc failed\00"
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = load i8*, i8** %3
ret i8* %10
}

LLVM IR (-O2):
@.str = [14 x i8] c"malloc failed\00"
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
int compare_incr(const void *a, const void *b) {
  return *(float *)a - *(float *)b;
}


x86 assembly (clang, -O0):
<compare_incr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  (%rax),%xmm0
cvttss2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_incr>:
movss  (%rdi),%xmm0
subss  (%rsi),%xmm0
cvttss2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @compare_incr(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 = bitcast i8* %5 to float*
%7 = load float, float* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to float*
%10 = load float, float* %9
%11 = fsub float %7, %10
%12 = fptosi float %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @compare_incr(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to float*
%4 = load float, float* %3
%5 = bitcast i8* %1 to float*
%6 = load float, float* %5
%7 = fsub float %4, %6
%8 = fptosi float %7 to i32
ret i32 %8
}
/* Type definitions */
struct timeval {
  unsigned int tv_usec;
};

/* Variables and functions */
scalar_t__ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
unsigned int get_random_seed() {
  unsigned int seed;
  struct timeval r;
  if (gettimeofday(&r, NULL) == 0) {
    seed = r.tv_usec;
  } else {
    seed = 0xDEADBEEF;
  }
  return seed;
}


x86 assembly (clang, -O0):
<get_random_seed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cmp    $0x0,%rax
jne    113a <get_random_seed+0x2a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <get_random_seed+0x31>
movl   $0xdeadbeef,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_random_seed>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    %rax,%rcx
mov    $0xdeadbeef,%eax
test   %rcx,%rcx
jne    112b <get_random_seed+0x1b>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
define i32 @get_random_seed() {
%1 = alloca i32
%2 = alloca %struct.timeval
%3 = call i64 @gettimeofday(%struct.timeval* %2, i32* null)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%7 = load i32, i32* %6
store i32 %7, i32* %1
br label %9
8: ; preds = %0
store i32 -559038737, i32* %1
br label %9
9: ; preds = %8, %5
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define i32 @get_random_seed() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i64 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = icmp eq i64 %3, 0
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%6 = load i32, i32* %5
%7 = select i1 %4, i32 %6, i32 -559038737
ret i32 %7
}
void backtrace_sigsegv(void) {}


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

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

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

LLVM IR (-O2):
define void @backtrace_sigsegv() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ die_if_null(void *);
void *realloc(void *, size_t);
void *xrealloc(void *p, size_t size) {
  void *t;
  t = realloc(p, size);
  die_if_null(t);
  return t;
}


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

x86 assembly (clang, -O2):
<xrealloc>:
push   %rbx
call   1030 <realloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <die_if_null@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = tail call i32 @die_if_null(i8* %3)
ret i8* %3
}
/* Variables and functions */
int strcasecmp(char const *const, char const *const);
int gl_display_matches_sort_proc(const void *a, const void *b) {
  return (strcasecmp(*((const char *const *)a), *((const char *const *)b)));
}


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

x86 assembly (clang, -O2):
<gl_display_matches_sort_proc>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcasecmp@plt>

LLVM IR (-O0):
define i32 @gl_display_matches_sort_proc(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 = bitcast i8* %5 to i8**
%7 = load i8*, i8** %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i8**
%10 = load i8*, i8** %9
%11 = call i32 @strcasecmp(i8* %7, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @gl_display_matches_sort_proc(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @strcasecmp(i8* %4, i8* %6)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ fillArray(int *, int);
float getTimeForFindMaxElement(int *, int);
int /*<<< orphan*/ printf(char *, float);
void generateFindingMaxElement(int arrSize) {
  int arr[2500], i;
  float time;
  fillArray(arr, arrSize);
  time = getTimeForFindMaxElement(arr, arrSize);
  printf("%-10.3f", time);
}


x86 assembly (clang, -O0):
<generateFindingMaxElement>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2730,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x2720(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1040 <fillArray@plt>
lea    -0x2720(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1050 <getTimeForFindMaxElement@plt>
movss  %xmm0,-0x2728(%rbp)
ff
movss  -0x2728(%rbp),%xmm0
ff
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
add    $0x2730,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generateFindingMaxElement>:
push   %r14
push   %rbx
sub    $0x2718,%rsp
mov    %edi,%ebx
mov    %rsp,%r14
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <fillArray@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1050 <getTimeForFindMaxElement@plt>
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
add    $0x2718,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%-10.3f\00"
define void @generateFindingMaxElement(i32 %0) {
%2 = alloca i32
%3 = alloca [2500 x i32]
%4 = alloca i32
%5 = alloca float
store i32 %0, i32* %2
%6 = getelementptr inbounds [2500 x i32], [2500 x i32]* %3, i64 0, i64 0
%7 = load i32, i32* %2
%8 = call i32 @fillArray(i32* %6, i32 %7)
%9 = getelementptr inbounds [2500 x i32], [2500 x i32]* %3, i64 0, i64 0
%10 = load i32, i32* %2
%11 = call float @getTimeForFindMaxElement(i32* %9, i32 %10)
store float %11, float* %5
%12 = load float, float* %5
%13 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), float %12)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%-10.3f\00"
define void @generateFindingMaxElement(i32 %0) {
%2 = alloca [2500 x i32]
%3 = bitcast [2500 x i32]* %2 to i8*
%4 = getelementptr inbounds [2500 x i32], [2500 x i32]* %2, i64 0, i64 0
%5 = call i32 @fillArray(i32* %4, i32 %0)
%6 = call float @getTimeForFindMaxElement(i32* %4, i32 %0)
%7 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), float %6)
ret void
}
int tls13_server_finished_recv(struct tls13_ctx *ctx) { return 1; }


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

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

LLVM IR (-O0):
%struct.tls13_ctx = type opaque
define i32 @tls13_server_finished_recv(%struct.tls13_ctx* %0) {
%2 = alloca %struct.tls13_ctx*
store %struct.tls13_ctx* %0, %struct.tls13_ctx** %2
ret i32 1
}

LLVM IR (-O2):
%struct.tls13_ctx = type opaque
define i32 @tls13_server_finished_recv(%struct.tls13_ctx* nocapture readnone %0) {
ret i32 1
}
int main() {
  int i = 0;
  int b = 0;
  for (; i < 10; i++) {
    int a = i ^ 2;
    b += a;
  }
  return b;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1143 <main+0x43>
mov    -0x8(%rbp),%eax
xor    $0x2,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1119 <main+0x19>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 49
}
/* Variables and functions */
int /*<<< orphan*/ ASL_();
int /*<<< orphan*/ c64_memAbsoluteAddrX();
void ASL_absx(void) {
  c64_memAbsoluteAddrX();
  ASL_();
}


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

x86 assembly (clang, -O2):
<ASL_absx>:
push   %rax
xor    %eax,%eax
call   1030 <c64_memAbsoluteAddrX@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <ASL_@plt>

LLVM IR (-O0):
define void @ASL_absx() {
%1 = call i32 (...) @c64_memAbsoluteAddrX()
%2 = call i32 (...) @ASL_()
ret void
}

LLVM IR (-O2):
define void @ASL_absx() {
%1 = tail call i32 (...) @c64_memAbsoluteAddrX()
%2 = tail call i32 (...) @ASL_()
ret void
}
void CFGMR3GetValueNameLen(void) {}


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

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

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

LLVM IR (-O2):
define void @CFGMR3GetValueNameLen() {
ret void
}
/* Variables and functions */
int bar(int, int);
int /*<<< orphan*/ printf(char *);
int foo(int a, int b) {
  printf("fooA\n");
  return (b - a) + bar(3, 9);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xecb(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x3,%edi
mov    $0x9,%esi
call   1030 <bar@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
sub    %ebp,%ebx
mov    $0x3,%edi
mov    $0x9,%esi
call   1040 <bar@plt>
add    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@str = [5 x i8] c"fooA\00"
define i32 @foo(i32 %0, i32 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%4 = sub i32 %1, %0
%5 = tail call i32 @bar(i32 3, i32 9)
%6 = add nsw i32 %4, %5
ret i32 %6
}
/* Variables and functions */
void *malloc(int);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
void *_calloc(int n, int m) {
  void *p = malloc(n * m);
  if (p)
    memset(p, 0, n * m);
  return p;
}


x86 assembly (clang, -O0):
<_calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
imul   -0x8(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     115b <_calloc+0x3b>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
imul   -0x8(%rbp),%edx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_calloc>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
imul   %esi,%ebx
mov    %ebx,%edi
call   1040 <malloc@plt>
mov    %rax,%r14
test   %rax,%rax
je     1144 <_calloc+0x24>
mov    %r14,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   1030 <memset@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @_calloc(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
%4 = tail call i8* @malloc(i32 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @memset(i8* %4, i32 0, i32 %3)
br label %8
8: ; preds = %6, %2
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ __startrek_write_R_count(int);
int /*<<< orphan*/ __startrek_write_T_count(int);
int /*<<< orphan*/ __startrek_write_W_count(int);
void nxt_motor_set_count(unsigned int n, int count) {
  {
    switch (n) {
    case 0:
      __startrek_write_R_count(count);
      break;
    case 1:
      __startrek_write_W_count(count);
      break;
    case 2:
      __startrek_write_T_count(count);
      break;
    }
    return;
  }
}


x86 assembly (clang, -O0):
<nxt_motor_set_count>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     1173 <nxt_motor_set_count+0x43>
jmp    1151 <nxt_motor_set_count+0x21>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     1180 <nxt_motor_set_count+0x50>
jmp    1162 <nxt_motor_set_count+0x32>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     118d <nxt_motor_set_count+0x5d>
jmp    1195 <nxt_motor_set_count+0x65>
mov    -0x8(%rbp),%edi
call   1030 <__startrek_write_R_count@plt>
jmp    1195 <nxt_motor_set_count+0x65>
mov    -0x8(%rbp),%edi
call   1050 <__startrek_write_W_count@plt>
jmp    1195 <nxt_motor_set_count+0x65>
mov    -0x8(%rbp),%edi
call   1040 <__startrek_write_T_count@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nxt_motor_set_count>:
cmp    $0x2,%edi
je     1145 <nxt_motor_set_count+0x15>
cmp    $0x1,%edi
je     114c <nxt_motor_set_count+0x1c>
test   %edi,%edi
jne    1153 <nxt_motor_set_count+0x23>
mov    %esi,%edi
jmp    1030 <__startrek_write_R_count@plt>
mov    %esi,%edi
jmp    1040 <__startrek_write_T_count@plt>
mov    %esi,%edi
jmp    1050 <__startrek_write_W_count@plt>
ret

LLVM IR (-O0):
define void @nxt_motor_set_count(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
switch i32 %5, label %15 [
i32 0, label %6
i32 1, label %9
i32 2, label %12
]
6: ; preds = %2
%7 = load i32, i32* %4
%8 = call i32 @__startrek_write_R_count(i32 %7)
br label %15
9: ; preds = %2
%10 = load i32, i32* %4
%11 = call i32 @__startrek_write_W_count(i32 %10)
br label %15
12: ; preds = %2
%13 = load i32, i32* %4
%14 = call i32 @__startrek_write_T_count(i32 %13)
br label %15
15: ; preds = %2, %12, %9, %6
ret void
}

LLVM IR (-O2):
define void @nxt_motor_set_count(i32 %0, i32 %1) {
switch i32 %0, label %9 [
i32 0, label %3
i32 1, label %5
i32 2, label %7
]
3: ; preds = %2
%4 = tail call i32 @__startrek_write_R_count(i32 %1)
br label %9
5: ; preds = %2
%6 = tail call i32 @__startrek_write_W_count(i32 %1)
br label %9
7: ; preds = %2
%8 = tail call i32 @__startrek_write_T_count(i32 %1)
br label %9
9: ; preds = %2, %7, %5, %3
ret void
}
int lb_random(max)
short max;
{ return (int)(((long)rand() * max) / 0x7FFF); }


x86 assembly (clang, -O0):
<lb_random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cltq
movswq -0x2(%rbp),%rcx
imul   %rcx,%rax
mov    $0x7fff,%ecx
cqto
idiv   %rcx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lb_random>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltq
movswq %bx,%rcx
imul   %rax,%rcx
movabs $0x8001000200040009,%rdx
mov    %rcx,%rax
imul   %rdx
add    %rdx,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
shr    $0xe,%rcx
add    %eax,%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @lb_random(i32 %0) {
%2 = alloca i16
%3 = trunc i32 %0 to i16
store i16 %3, i16* %2
%4 = call i32 (...) @rand()
%5 = sext i32 %4 to i64
%6 = load i16, i16* %2
%7 = sext i16 %6 to i64
%8 = mul nsw i64 %5, %7
%9 = sdiv i64 %8, 32767
%10 = trunc i64 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @lb_random(i32 %0) {
%2 = zext i32 %0 to i64
%3 = tail call i32 (...) @rand()
%4 = sext i32 %3 to i64
%5 = shl i64 %2, 48
%6 = ashr exact i64 %5, 48
%7 = mul nsw i64 %6, %4
%8 = sdiv i64 %7, 32767
%9 = trunc i64 %8 to i32
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ ip2long(char const *);
int qqwry_get_location_by_long(char *, char *, int /*<<< orphan*/,
                               int /*<<< orphan*/ *);
int qqwry_get_location(char *addr1, char *addr2, const char *ip,
                       FILE *qqwry_file) {
  return qqwry_get_location_by_long(addr1, addr2, ip2long(ip), qqwry_file);
}


x86 assembly (clang, -O0):
<qqwry_get_location>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <ip2long@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
mov    -0x20(%rbp),%rcx
call   1030 <qqwry_get_location_by_long@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qqwry_get_location>:
push   %r15
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
mov    %rdx,%rdi
call   1040 <ip2long@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %eax,%edx
mov    %r14,%rcx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <qqwry_get_location_by_long@plt>

LLVM IR (-O0):
define i32 @qqwry_get_location(i8* %0, i8* %1, i8* %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32* %3, i32** %8
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = load i8*, i8** %7
%12 = call i32 @ip2long(i8* %11)
%13 = load i32*, i32** %8
%14 = call i32 @qqwry_get_location_by_long(i8* %9, i8* %10, i32 %12, i32* %13)
ret i32 %14
}

LLVM IR (-O2):
define i32 @qqwry_get_location(i8* %0, i8* %1, i8* %2, i32* %3) {
%5 = tail call i32 @ip2long(i8* %2)
%6 = tail call i32 @qqwry_get_location_by_long(i8* %0, i8* %1, i32 %5, i32* %3)
ret i32 %6
}
unsigned char fetchByte(inbuf)
unsigned char **inbuf;
{
  unsigned char byte = **inbuf;
  (*inbuf)++;
  return (byte);
}


x86 assembly (clang, -O0):
<fetchByte>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
movzbl -0x9(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fetchByte>:
mov    (%rdi),%rcx
mov    (%rcx),%al
add    $0x1,%rcx
mov    %rcx,(%rdi)
ret

LLVM IR (-O0):
define zeroext i8 @fetchByte(i8** %0) {
%2 = alloca i8**
%3 = alloca i8
store i8** %0, i8*** %2
%4 = load i8**, i8*** %2
%5 = load i8*, i8** %4
%6 = load i8, i8* %5
store i8 %6, i8* %3
%7 = load i8**, i8*** %2
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %7
%10 = load i8, i8* %3
ret i8 %10
}

LLVM IR (-O2):
define zeroext i8 @fetchByte(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
%4 = getelementptr inbounds i8, i8* %2, i64 1
store i8* %4, i8** %0
ret i8 %3
}
char TtyReadChar(fd, readChar)
int fd;
char *readChar;
{ return TtyTimedReadChar(fd, readChar, 0); }


x86 assembly (clang, -O0):
<TtyReadChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
mov    $0x0,%al
call   1030 <TtyTimedReadChar@plt>
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i8 @TtyReadChar(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = load i8*, i8** %4
%7 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @TtyTimedReadChar to i32 (i32, i8*, i32, ...)*)(i32 %5, i8* %6, i32 0)
%8 = trunc i32 %7 to i8
ret i8 %8
}

LLVM IR (-O2):
define signext i8 @TtyReadChar(i32 %0, i8* %1) {
%3 = tail call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @TtyTimedReadChar to i32 (i32, i8*, i32, ...)*)(i32 %0, i8* %1, i32 0)
%4 = trunc i32 %3 to i8
ret i8 %4
}
/* Variables and functions */
int /*<<< orphan*/ swift_inv_data_tag(unsigned long);
void swift_flush_dcache(void) {
  unsigned long addr;
  for (addr = 0; addr < 0x2000; addr += 0x10)
    swift_inv_data_tag(addr);
}


x86 assembly (clang, -O0):
<swift_flush_dcache>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
cmpq   $0x2000,-0x8(%rbp)
jae    1148 <swift_flush_dcache+0x38>
mov    -0x8(%rbp),%rdi
call   1030 <swift_inv_data_tag@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x8(%rbp)
jmp    1120 <swift_flush_dcache+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swift_flush_dcache>:
push   %rbx
mov    $0xfffffffffffffff0,%rbx
nopl   0x0(%rax,%rax,1)
add    $0x10,%rbx
mov    %rbx,%rdi
call   1030 <swift_inv_data_tag@plt>
cmp    $0x1ff0,%rbx
jb     1120 <swift_flush_dcache+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @swift_flush_dcache() {
%1 = alloca i64
store i64 0, i64* %1
br label %2
2: ; preds = %8, %0
%3 = load i64, i64* %1
%4 = icmp ult i64 %3, 8192
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = load i64, i64* %1
%7 = call i32 @swift_inv_data_tag(i64 %6)
br label %8
8: ; preds = %5
%9 = load i64, i64* %1
%10 = add i64 %9, 16
store i64 %10, i64* %1
br label %2
11: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @swift_flush_dcache() {
br label %1
1: ; preds = %0, %1
%2 = phi i64 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 @swift_inv_data_tag(i64 %2)
%4 = add nuw nsw i64 %2, 16
%5 = icmp ult i64 %2, 8176
br i1 %5, label %1, label %6
6: ; preds = %1
ret void
}
/* Variables and functions */
int strlen(const char *s) {
  int c = 0;
  while (s[c] != 0)
    c++;
  return c;
}


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

x86 assembly (clang, -O2):
<strlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
int getppid() {}


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

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

LLVM IR (-O0):
define i32 @getppid() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @getppid() {
ret i32 undef
}
strlwr(str) char *str;
{
  int i;
  char AZ;
  for (i = 0; str[i] != 0; i++) {
    AZ = str[i];
    if (AZ > 64 && AZ < 91)
      str[i] = (AZ + 32);
  }
}


x86 assembly (clang, -O0):
<strlwr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1173 <strlwr+0x73>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x15(%rbp)
movsbl -0x15(%rbp),%eax
cmp    $0x40,%eax
jle    1160 <strlwr+0x60>
movsbl -0x15(%rbp),%eax
cmp    $0x5b,%eax
jge    1160 <strlwr+0x60>
movsbl -0x15(%rbp),%eax
add    $0x20,%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1165 <strlwr+0x65>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    110f <strlwr+0xf>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlwr>:
mov    (%rdi),%al
test   %al,%al
je     112a <strlwr+0x2a>
add    $0x1,%rdi
jmp    111b <strlwr+0x1b>
nopl   0x0(%rax)
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
je     112a <strlwr+0x2a>
lea    -0x41(%rax),%ecx
cmp    $0x19,%cl
ja     1110 <strlwr+0x10>
add    $0x20,%al
mov    %al,-0x1(%rdi)
jmp    1110 <strlwr+0x10>
ret

LLVM IR (-O0):
define i32 @strlwr(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
store i8* %0, i8** %3
store i32 0, i32* %4
br label %6
6: ; preds = %37, %1
%7 = load i8*, i8** %3
%8 = load i32, i32* %4
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %7, i64 %9
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %40
14: ; preds = %6
%15 = load i8*, i8** %3
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
store i8 %19, i8* %5
%20 = load i8, i8* %5
%21 = sext i8 %20 to i32
%22 = icmp sgt i32 %21, 64
br i1 %22, label %23, label %36
23: ; preds = %14
%24 = load i8, i8* %5
%25 = sext i8 %24 to i32
%26 = icmp slt i32 %25, 91
br i1 %26, label %27, label %36
27: ; preds = %23
%28 = load i8, i8* %5
%29 = sext i8 %28 to i32
%30 = add nsw i32 %29, 32
%31 = trunc i32 %30 to i8
%32 = load i8*, i8** %3
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
store i8 %31, i8* %35
br label %36
36: ; preds = %27, %23, %14
br label %37
37: ; preds = %36
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
br label %6
40: ; preds = %6
%41 = load i32, i32* %2
ret i32 %41
}

LLVM IR (-O2):
define i32 @strlwr(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %17, label %4
4: ; preds = %1, %12
%5 = phi i64 [ %13, %12 ], [ 0, %1 ]
%6 = phi i8 [ %15, %12 ], [ %2, %1 ]
%7 = phi i8* [ %14, %12 ], [ %0, %1 ]
%8 = add i8 %6, -65
%9 = icmp ult i8 %8, 26
br i1 %9, label %10, label %12
10: ; preds = %4
%11 = add nuw nsw i8 %6, 32
store i8 %11, i8* %7
br label %12
12: ; preds = %4, %10
%13 = add nuw i64 %5, 1
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %4
17: ; preds = %12, %1
ret i32 undef
}
int f(long long a) { return a >> 10; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
sar    $0xa,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
mov    %rdi,%rax
shr    $0xa,%rax
ret

LLVM IR (-O0):
define i32 @f(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 10
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @f(i64 %0) {
%2 = lshr i64 %0, 10
%3 = trunc i64 %2 to i32
ret i32 %3
}
int test_imm_72int8_mem(signed char *val) {
  return ((*val) & (-0x72 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_72int8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0xffffff8e,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_72int8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, -114
%7 = icmp ne i32 %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_72int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -114
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("To jest testowy program do tesowania gita\n");
  printf("Tutaj jeszcze cos dopiesze \n");
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf06(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [43 x i8] c"To jest testowy program do tesowania gita\0A\00"
@.str.1 = [29 x i8] c"Tutaj jeszcze cos dopiesze \0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [42 x i8] c"To jest testowy program do tesowania gita\00"
@str.2 = [28 x i8] c"Tutaj jeszcze cos dopiesze \00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int fact(int);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int n, f;
  scanf("%d", &n);
  f = fact(n);
  printf("%d! = %d\n", n, f);
  return 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   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1040 <fact@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1040 <fact@plt>
mov    0x4(%rsp),%esi
lea    0xead(%rip),%rdi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [10 x i8] c"%d! = %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 = call i32 @fact(i32 %4)
%6 = load i32, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %6, i32 %5)
ret i32 0
}
void drawFrame(void) {}


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

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

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

LLVM IR (-O2):
define void @drawFrame() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ math_even(int);
int math_odd(int n) { return !math_even(n); }


x86 assembly (clang, -O0):
<math_odd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <math_even@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<math_odd>:
push   %rax
call   1030 <math_even@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @math_odd(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @math_even(i32 %3)
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @math_odd(i32 %0) {
%2 = tail call i32 @math_even(i32 %0)
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
int Regexec(void *re, const char *str, int nm, int so, int eo, int flag) {
  return -1;
}


x86 assembly (clang, -O0):
<Regexec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @Regexec(i8* %0, i8* %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %7
store i8* %1, i8** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
ret i32 -1
}

LLVM IR (-O2):
define i32 @Regexec(i8* nocapture readnone %0, i8* nocapture readnone %1, i32 %2, i32 %3, i32 %4, i32 %5) {
ret i32 -1
}
void uppercase(ch) char *ch;
{ *ch = (isupper(*ch) ? (*ch) : toupper(*ch)); }


x86 assembly (clang, -O0):
<uppercase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isupper@plt>
cmp    $0x0,%eax
je     1150 <uppercase+0x30>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0xc(%rbp)
jmp    115f <uppercase+0x3f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uppercase>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
movsbl (%rdi),%ebp
mov    %ebp,%edi
call   1040 <isupper@plt>
test   %eax,%eax
jne    113d <uppercase+0x1d>
mov    %ebp,%edi
call   1030 <toupper@plt>
mov    %eax,%ebp
mov    %bpl,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @uppercase(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = tail call i32 @isupper(i32 %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @toupper(i32 %3)
br label %8
8: ; preds = %1, %6
%9 = phi i32 [ %7, %6 ], [ %3, %1 ]
%10 = trunc i32 %9 to i8
store i8 %10, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void resume(void *m) {
  char *msg = m;
  printf("Resume: %s\n", msg);
}


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

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

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

LLVM IR (-O2):
@.str = [12 x i8] c"Resume: %s\0A\00"
define void @resume(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void print_two(void) { puts("Two"); }


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"Two\00"
define void @print_two() {
%1 = call i32 @puts(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"Two\00"
define void @print_two() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}
void RTNetIPv4FinalizeChecksum(void) {}


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

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

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

LLVM IR (-O2):
define void @RTNetIPv4FinalizeChecksum() {
ret void
}