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

/* Variables and functions */
int /*<<< orphan*/ wl_proxy_destroy(struct wl_proxy *);
int /*<<< orphan*/ wl_proxy_marshal(struct wl_proxy *, int /*<<< orphan*/);
void wl_surface_destroy(struct wl_surface *wl_surface) {
  wl_proxy_marshal((struct wl_proxy *)wl_surface, 0);
  wl_proxy_destroy((struct wl_proxy *)wl_surface);
}


x86 assembly (clang, -O0):
<wl_surface_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1040 <wl_proxy_marshal@plt>
mov    -0x8(%rbp),%rdi
call   1030 <wl_proxy_destroy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wl_surface_destroy>:
push   %rbx
mov    %rdi,%rbx
xor    %esi,%esi
call   1040 <wl_proxy_marshal@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <wl_proxy_destroy@plt>

LLVM IR (-O0):
%struct.wl_surface = type { i32 }
%struct.wl_proxy = type { i32 }
define void @wl_surface_destroy(%struct.wl_surface* %0) {
%2 = alloca %struct.wl_surface*
store %struct.wl_surface* %0, %struct.wl_surface** %2
%3 = load %struct.wl_surface*, %struct.wl_surface** %2
%4 = bitcast %struct.wl_surface* %3 to %struct.wl_proxy*
%5 = call i32 @wl_proxy_marshal(%struct.wl_proxy* %4, i32 0)
%6 = load %struct.wl_surface*, %struct.wl_surface** %2
%7 = bitcast %struct.wl_surface* %6 to %struct.wl_proxy*
%8 = call i32 @wl_proxy_destroy(%struct.wl_proxy* %7)
ret void
}

LLVM IR (-O2):
%struct.wl_surface = type { i32 }
%struct.wl_proxy = type { i32 }
define void @wl_surface_destroy(%struct.wl_surface* %0) {
%2 = bitcast %struct.wl_surface* %0 to %struct.wl_proxy*
%3 = tail call i32 @wl_proxy_marshal(%struct.wl_proxy* %2, i32 0)
%4 = tail call i32 @wl_proxy_destroy(%struct.wl_proxy* %2)
ret void
}
int analogReadDummy(struct wiringPiNodeStruct *node, int pin) { return 0; }


x86 assembly (clang, -O0):
<analogReadDummy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.wiringPiNodeStruct = type opaque
define i32 @analogReadDummy(%struct.wiringPiNodeStruct* %0, i32 %1) {
%3 = alloca %struct.wiringPiNodeStruct*
%4 = alloca i32
store %struct.wiringPiNodeStruct* %0, %struct.wiringPiNodeStruct** %3
store i32 %1, i32* %4
ret i32 0
}

LLVM IR (-O2):
%struct.wiringPiNodeStruct = type opaque
define i32 @analogReadDummy(%struct.wiringPiNodeStruct* nocapture readnone %0, i32 %1) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int fwrite(void *, size_t, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
void ckfwrite(void *ptr, size_t size, FILE *stream) {
  if (fwrite(ptr, size, 1, stream) < 1) {
    perror("fwrite non riuscita");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<ckfwrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    $0x1,%edx
call   1050 <fwrite@plt>
cmp    $0x1,%eax
jge    1179 <ckfwrite+0x49>
lea    0xe96(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ckfwrite>:
push   %rax
mov    %rdx,%rcx
mov    $0x1,%edx
call   1050 <fwrite@plt>
test   %eax,%eax
jle    1144 <ckfwrite+0x14>
pop    %rax
ret
lea    0xeb5(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"fwrite non riuscita\00"
define void @ckfwrite(i8* %0, i64 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32*
store i8* %0, i8** %4
store i64 %1, i64* %5
store i32* %2, i32** %6
%7 = load i8*, i8** %4
%8 = load i64, i64* %5
%9 = load i32*, i32** %6
%10 = call i32 @fwrite(i8* %7, i64 %8, i32 1, i32* %9)
%11 = icmp slt i32 %10, 1
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"fwrite non riuscita\00"
define void @ckfwrite(i8* nocapture %0, i64 %1, i32* nocapture %2) {
%4 = tail call i32 @fwrite(i8* %0, i64 %1, i32 1, i32* %2)
%5 = icmp slt i32 %4, 1
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ error(char *, long);
void *realloc(void *, size_t);
void *pen_realloc(void *p, size_t n) {
  void *q = realloc(p, n);
  if (!q)
    error("Can't realloc %ld bytes", (long)n);
  return q;
}


x86 assembly (clang, -O0):
<pen_realloc>:
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)
cmpq   $0x0,-0x18(%rbp)
jne    115c <pen_realloc+0x3c>
mov    -0x10(%rbp),%rsi
lea    0xea9(%rip),%rdi
call   1040 <error@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pen_realloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1030 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <pen_realloc+0x23>
lea    0xec5(%rip),%rdi
mov    %r14,%rsi
call   1040 <error@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Can't realloc %ld bytes\00"
define i8* @pen_realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %14, label %11
11: ; preds = %2
%12 = load i64, i64* %4
%13 = call i32 @error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i64 %12)
br label %14
14: ; preds = %11, %2
%15 = load i8*, i8** %5
ret i8* %15
}

LLVM IR (-O2):
@.str = [24 x i8] c"Can't realloc %ld bytes\00"
define noalias i8* @pen_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i64 %1)
br label %7
7: ; preds = %5, %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  int i = 7;
  char *s = "Hello World!\n";
  printf(s);
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [13 x i8] c"Hello World!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void print_arg_err() {
  fprintf(stderr, "ERROR:\tWrong combination of arguments.\n");
  return;
}


x86 assembly (clang, -O0):
<print_arg_err>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_arg_err>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [40 x i8] c"ERROR:\09Wrong combination of arguments.\0A\00"
define void @print_arg_err() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [40 x i8] c"ERROR:\09Wrong combination of arguments.\0A\00"
define void @print_arg_err() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
ret void
}
char *locv(longint)
long longint;
{
  static char locvbuf[12];
  return sprintf(locvbuf, "%ld", longint);
}


x86 assembly (clang, -O0):
<locv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
lea    0x2f02(%rip),%rdi
lea    0xed2(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<locv>:
push   %rax
mov    %rdi,%rdx
lea    0x2f0e(%rip),%rdi
lea    0xede(%rip),%rsi
xor    %eax,%eax
call   1030 <sprintf@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
@locv.locvbuf = internal global [12 x i8] zeroinitializer
@.str = [4 x i8] c"%ld\00"
define i8* @locv(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @locv.locvbuf, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %3)
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
ret i8* %6
}

LLVM IR (-O2):
@locv.locvbuf = internal global [12 x i8] zeroinitializer
@.str = [4 x i8] c"%ld\00"
define i8* @locv(i64 %0) {
%2 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @locv.locvbuf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %0)
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
char plugin_format() { return 's'; }


x86 assembly (clang, -O0):
<plugin_format>:
push   %rbp
mov    %rsp,%rbp
mov    $0x73,%al
movsbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i8 @plugin_format() {
ret i8 115
}

LLVM IR (-O2):
define signext i8 @plugin_format() {
ret i8 115
}
/* Variables and functions */
int _isnan(double);
int igraph_is_nan(double x) { return _isnan(x); }


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

x86 assembly (clang, -O2):
<igraph_is_nan>:
jmp    1030 <_isnan@plt>

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

LLVM IR (-O2):
define i32 @igraph_is_nan(double %0) {
%2 = tail call i32 @_isnan(double %0)
ret i32 %2
}
/* Variables and functions */
int check_arg_count(int, int /*<<< orphan*/);
int /*<<< orphan*/ noraw();
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_return(int /*<<< orphan*/);
void cmd_noraw(int nargs, char **args) {
  if (check_arg_count(nargs, 0) == 1)
    return;
  report_count(1);
  report_return(noraw());
}


x86 assembly (clang, -O0):
<cmd_noraw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1050 <check_arg_count@plt>
cmp    $0x1,%eax
jne    1167 <cmd_noraw+0x27>
jmp    117f <cmd_noraw+0x3f>
mov    $0x1,%edi
call   1060 <report_count@plt>
mov    $0x0,%al
call   1040 <noraw@plt>
mov    %eax,%edi
call   1030 <report_return@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_noraw>:
push   %rax
xor    %esi,%esi
call   1050 <check_arg_count@plt>
cmp    $0x1,%eax
jne    114f <cmd_noraw+0xf>
pop    %rax
ret
mov    $0x1,%edi
call   1060 <report_count@plt>
xor    %eax,%eax
call   1040 <noraw@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <report_return@plt>

LLVM IR (-O0):
define void @cmd_noraw(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 = call i32 @check_arg_count(i32 %5, i32 0)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %2
br label %13
9: ; preds = %2
%10 = call i32 @report_count(i32 1)
%11 = call i32 (...) @noraw()
%12 = call i32 @report_return(i32 %11)
br label %13
13: ; preds = %9, %8
ret void
}

LLVM IR (-O2):
define void @cmd_noraw(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @check_arg_count(i32 %0, i32 0)
%4 = icmp eq i32 %3, 1
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = tail call i32 @report_count(i32 1)
%7 = tail call i32 (...) @noraw()
%8 = tail call i32 @report_return(i32 %7)
br label %9
9: ; preds = %2, %5
ret void
}
int execute_spu_create() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_spu_create() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ localtime(int /*<<< orphan*/ *);
void uninitvar_localtime(void) {
  time_t *tp;
  (void)localtime(tp);
}


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

x86 assembly (clang, -O2):
<uninitvar_localtime>:
jmp    1030 <localtime@plt>

LLVM IR (-O0):
define void @uninitvar_localtime() {
%1 = alloca i32*
%2 = load i32*, i32** %1
%3 = call i32 @localtime(i32* %2)
ret void
}

LLVM IR (-O2):
define void @uninitvar_localtime() {
%1 = tail call i32 @localtime(i32* undef)
ret void
}
/* Variables and functions */
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int checkPasswd() {
  int isRight = 0;
  char passBuff[4];
  strcpy(passBuff, "overwrite the ret");
  if (strcmp(passBuff, "p") == 0)
    isRight = 1;
  return isRight;
}


x86 assembly (clang, -O0):
<checkPasswd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
lea    0xec6(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x8(%rbp),%rdi
lea    0xec8(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1160 <checkPasswd+0x40>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkPasswd>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rsi
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xed2(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [18 x i8] c"overwrite the ret\00"
@.str.1 = [2 x i8] c"p\00"
define i32 @checkPasswd() {
%1 = alloca [4 x i8]
%2 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void MyCallback(void) { printf("I am callback function from main()\n"); }


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

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

LLVM IR (-O0):
@.str = [36 x i8] c"I am callback function from main()\0A\00"
define void @MyCallback() {
%1 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [35 x i8] c"I am callback function from main()\00"
define void @MyCallback() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void Free(char **ptr) {
  if (*ptr) {
    free(*ptr);
    *ptr = NULL;
  }
}


x86 assembly (clang, -O0):
<Free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1141 <Free+0x31>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Free>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1128 <Free+0x18>
call   1030 <free@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @Free(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i8**, i8*** %2
%8 = load i8*, i8** %7
%9 = call i32 @free(i8* %8)
%10 = load i8**, i8*** %2
store i8* null, i8** %10
br label %11
11: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
define void @Free(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @free(i8* %2)
store i8* null, i8** %0
br label %6
6: ; preds = %4, %1
ret void
}
int fun222() { return 222; }


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

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

LLVM IR (-O0):
define i32 @fun222() {
ret i32 222
}

LLVM IR (-O2):
define i32 @fun222() {
ret i32 222
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
int /*<<< orphan*/ sleep(int);
void procA(int *inpA) {
  int i;
  int j;
  int x;
  for (i = 0; i < 4; ++i) {
    printf("procA\n");
    sleep(1);
  }
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<procA>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    1171 <procA+0x41>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1143 <procA+0x13>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<procA>:
push   %rbx
lea    0xec8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
xor    %edi,%edi
pop    %rbx
jmp    1040 <pthread_exit@plt>

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

LLVM IR (-O2):
@str = [6 x i8] c"procA\00"
define void @procA(i32* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @sleep(i32 1)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @sleep(i32 1)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @sleep(i32 1)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 @sleep(i32 1)
%10 = tail call i32 @pthread_exit(i32* null)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_semaphore_free() {
  printf("NOT IMPLEMENTED:"
         "pa_semaphore_free"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [35 x i8] c"NOT IMPLEMENTED:pa_semaphore_free\0A\00"
define i32 @pa_semaphore_free() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [34 x i8] c"NOT IMPLEMENTED:pa_semaphore_free\00"
define i32 @pa_semaphore_free() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ prefetchw(void const *);
__attribute__((always_)) void spin_lock_prefetch(const void *x) {
  prefetchw(x);
}


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

x86 assembly (clang, -O2):
<spin_lock_prefetch>:
jmp    1030 <prefetchw@plt>

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

LLVM IR (-O2):
define void @spin_lock_prefetch(i8* %0) {
%2 = tail call i32 @prefetchw(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ TALLOC_FREE(void *);
void free_sd_common(void **ptr) { TALLOC_FREE(*ptr); }


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

x86 assembly (clang, -O2):
<free_sd_common>:
mov    (%rdi),%rdi
jmp    1030 <TALLOC_FREE@plt>

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

LLVM IR (-O2):
define void @free_sd_common(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @TALLOC_FREE(i8* %2)
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ chatClient();
int main(int argc, char *argv[]) {
  chatClient();
  return EXIT_SUCCESS;
}


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

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

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

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @chatClient()
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}
void func(void) {
  int a;
  a = 1;
  a = 2;
}


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

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

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

LLVM IR (-O2):
define void @func() {
ret void
}
/* Type definitions */
struct __test_metadata {
  int dummy;
};
struct __fixture_variant_metadata {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ epoll55(struct __test_metadata *);
void wrapper_epoll55(struct __test_metadata *_metadata,
                     struct __fixture_variant_metadata *variant) {
  epoll55(_metadata);
}


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

x86 assembly (clang, -O2):
<wrapper_epoll55>:
jmp    1030 <epoll55@plt>

LLVM IR (-O0):
%struct.__test_metadata = type { i32 }
%struct.__fixture_variant_metadata = type { i32 }
define void @wrapper_epoll55(%struct.__test_metadata* %0, %struct.__fixture_variant_metadata* %1) {
%3 = alloca %struct.__test_metadata*
%4 = alloca %struct.__fixture_variant_metadata*
store %struct.__test_metadata* %0, %struct.__test_metadata** %3
store %struct.__fixture_variant_metadata* %1, %struct.__fixture_variant_metadata** %4
%5 = load %struct.__test_metadata*, %struct.__test_metadata** %3
%6 = call i32 @epoll55(%struct.__test_metadata* %5)
ret void
}

LLVM IR (-O2):
%struct.__test_metadata = type { i32 }
%struct.__fixture_variant_metadata = type { i32 }
define void @wrapper_epoll55(%struct.__test_metadata* %0, %struct.__fixture_variant_metadata* nocapture readnone %1) {
%3 = tail call i32 @epoll55(%struct.__test_metadata* %0)
ret void
}
int test_imm_AAuint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0xAA << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_AAuint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 16
%6 = and i64 %5, 170
%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_AAuint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 11141120
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
main() {
  struct {
    unsigned b1 : 1;
    unsigned b2 : 1;
    unsigned b3 : 1;
    unsigned b4 : 1;
  } a;
  *(char *)&a = 0;
  a.b1 = 1;
  a.b2 = 0;
  a.b3 = 0;
  a.b4 = 1;
  char i = *(char *)&a;
  return i;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%al
and    $0xfe,%al
or     $0x1,%al
mov    %al,-0x8(%rbp)
mov    -0x8(%rbp),%al
and    $0xfd,%al
or     $0x0,%al
mov    %al,-0x8(%rbp)
mov    -0x8(%rbp),%al
and    $0xfb,%al
or     $0x0,%al
mov    %al,-0x8(%rbp)
mov    -0x8(%rbp),%al
and    $0xf7,%al
or     $0x8,%al
mov    %al,-0x8(%rbp)
mov    -0x8(%rbp),%al
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.anon = type { i8, [3 x i8] }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.anon
%3 = alloca i8
store i32 0, i32* %1
%4 = bitcast %struct.anon* %2 to i8*
store i8 0, i8* %4
%5 = bitcast %struct.anon* %2 to i8*
%6 = load i8, i8* %5
%7 = and i8 %6, -2
%8 = or i8 %7, 1
store i8 %8, i8* %5
%9 = bitcast %struct.anon* %2 to i8*
%10 = load i8, i8* %9
%11 = and i8 %10, -3
%12 = or i8 %11, 0
store i8 %12, i8* %9
%13 = bitcast %struct.anon* %2 to i8*
%14 = load i8, i8* %13
%15 = and i8 %14, -5
%16 = or i8 %15, 0
store i8 %16, i8* %13
%17 = bitcast %struct.anon* %2 to i8*
%18 = load i8, i8* %17
%19 = and i8 %18, -9
%20 = or i8 %19, 8
store i8 %20, i8* %17
%21 = bitcast %struct.anon* %2 to i8*
%22 = load i8, i8* %21
store i8 %22, i8* %3
%23 = load i8, i8* %3
%24 = sext i8 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
define i32 @main() {
ret i32 9
}
unsigned long numbytes_from_numbits(unsigned long numbits) {
  return numbits / 8 + (numbits % 8 ? 1 : 0);
}


x86 assembly (clang, -O0):
<numbytes_from_numbits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x3,%rax
mov    -0x8(%rbp),%rsi
and    $0x7,%rsi
xor    %ecx,%ecx
mov    $0x1,%edx
cmp    $0x0,%rsi
cmovne %edx,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<numbytes_from_numbits>:
mov    %rdi,%rax
shr    $0x3,%rax
and    $0x7,%edi
cmp    $0x1,%rdi
sbb    $0xffffffffffffffff,%rax
ret

LLVM IR (-O0):
define i64 @numbytes_from_numbits(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = udiv i64 %3, 8
%5 = load i64, i64* %2
%6 = urem i64 %5, 8
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 1, i32 0
%10 = sext i32 %9 to i64
%11 = add i64 %4, %10
ret i64 %11
}

LLVM IR (-O2):
define i64 @numbytes_from_numbits(i64 %0) {
%2 = lshr i64 %0, 3
%3 = and i64 %0, 7
%4 = icmp ne i64 %3, 0
%5 = zext i1 %4 to i64
%6 = add nuw nsw i64 %2, %5
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
scalar_t__ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
void setreuseaddr(int fd) {
  int val = 1;
  if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(int)) < 0) {
    perror("setsockopt");
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<setreuseaddr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e9c(%rip),%rax
mov    (%rax),%esi
mov    0x2e7b(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0x0,%rax
jge    118a <setreuseaddr+0x5a>
lea    0xe89(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e55(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setreuseaddr>:
push   %rax
movl   $0x1,0x4(%rsp)
mov    0x2ea8(%rip),%rax
mov    (%rax),%esi
mov    0x2e87(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
test   %rax,%rax
js     1162 <setreuseaddr+0x32>
pop    %rax
ret
lea    0xe97(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str = [11 x i8] c"setsockopt\00"
@EXIT_FAILURE = global i32 0
define void @setreuseaddr(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* @SOL_SOCKET
%6 = load i32, i32* @SO_REUSEADDR
%7 = call i64 @setsockopt(i32 %4, i32 %5, i32 %6, i32* %3, i32 4)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @exit(i32 %11)
unreachable
13: ; preds = %1
ret void
}

LLVM IR (-O2):
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str = [11 x i8] c"setsockopt\00"
@EXIT_FAILURE = global i32 0
define void @setreuseaddr(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%4 = load i32, i32* @SOL_SOCKET
%5 = load i32, i32* @SO_REUSEADDR
%6 = call i64 @setsockopt(i32 %0, i32 %4, i32 %5, i32* %2, i32 4)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
12: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void search_rooms() { printf("Szukanie pokoju\n"); }


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"Szukanie pokoju\0A\00"
define void @search_rooms() {
%1 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [16 x i8] c"Szukanie pokoju\00"
define void @search_rooms() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret void
}
int foo26() { return 26; }


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

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

LLVM IR (-O0):
define i32 @foo26() {
ret i32 26
}

LLVM IR (-O2):
define i32 @foo26() {
ret i32 26
}
/* Type definitions */
typedef int u_int64_t;
typedef int u_int32_t;

/* Variables and functions */
void bitvector_set(u_int32_t *b, u_int64_t n, u_int32_t c) {
  if (c)
    b[n >> 5] |= (1 << (n & 31));
  else
    b[n >> 5] &= ~(1 << (n & 31));
}


x86 assembly (clang, -O0):
<bitvector_set>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     113d <bitvector_set+0x3d>
mov    -0xc(%rbp),%ecx
and    $0x1f,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sar    $0x5,%ecx
movslq %ecx,%rcx
or     (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
jmp    1160 <bitvector_set+0x60>
mov    -0xc(%rbp),%ecx
and    $0x1f,%ecx
mov    $0x1,%edx
shl    %cl,%edx
xor    $0xffffffff,%edx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sar    $0x5,%ecx
movslq %ecx,%rcx
and    (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitvector_set>:
mov    %esi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
test   %edx,%edx
je     1117 <bitvector_set+0x17>
sar    $0x5,%ecx
movslq %ecx,%rcx
or     %eax,(%rdi,%rcx,4)
ret
not    %eax
sar    $0x5,%ecx
movslq %ecx,%rcx
and    %eax,(%rdi,%rcx,4)
ret

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

LLVM IR (-O2):
define void @bitvector_set(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
%5 = and i32 %1, 31
%6 = shl nuw i32 1, %5
br i1 %4, label %13, label %7
7: ; preds = %3
%8 = ashr i32 %1, 5
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = load i32, i32* %10
%12 = or i32 %11, %6
store i32 %12, i32* %10
br label %20
13: ; preds = %3
%14 = xor i32 %6, -1
%15 = ashr i32 %1, 5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %0, i64 %16
%18 = load i32, i32* %17
%19 = and i32 %18, %14
store i32 %19, i32* %17
br label %20
20: ; preds = %13, %7
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit_test(int);
int /*<<< orphan*/ print_error(char *, char const *const, int const);
void _fail(const char *const file, const int line) {
  print_error("                "
              "ERROR: "
              "%s:%d"
              " Failure!\n",
              file, line);
  exit_test(1);
}


x86 assembly (clang, -O0):
<_fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xec3(%rip),%rdi
call   1030 <print_error@plt>
mov    $0x1,%edi
call   1040 <exit_test@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_fail>:
push   %rax
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xed3(%rip),%rdi
call   1030 <print_error@plt>
mov    $0x1,%edi
pop    %rax
jmp    1040 <exit_test@plt>

LLVM IR (-O0):
@.str = [39 x i8] c" ERROR: %s:%d Failure!\0A\00"
define void @_fail(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @print_error(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6)
%8 = call i32 @exit_test(i32 1)
ret void
}

LLVM IR (-O2):
@.str = [39 x i8] c" ERROR: %s:%d Failure!\0A\00"
define void @_fail(i8* %0, i32 %1) {
%3 = tail call i32 @print_error(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
%4 = tail call i32 @exit_test(i32 1)
ret void
}
/* Variables and functions */
double DSlater_1S_4S(double, double, double);
double DSlater_4S_1S(double rij, double xii, double xij) {
  return DSlater_1S_4S(rij, xij, xii);
}


x86 assembly (clang, -O0):
<DSlater_4S_1S>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
call   1030 <DSlater_1S_4S@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DSlater_4S_1S>:
movaps %xmm1,%xmm3
movaps %xmm2,%xmm1
movaps %xmm3,%xmm2
jmp    1030 <DSlater_1S_4S@plt>

LLVM IR (-O0):
define double @DSlater_4S_1S(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %6
%9 = load double, double* %5
%10 = call double @DSlater_1S_4S(double %7, double %8, double %9)
ret double %10
}

LLVM IR (-O2):
define double @DSlater_4S_1S(double %0, double %1, double %2) {
%4 = tail call double @DSlater_1S_4S(double %0, double %2, double %1)
ret double %4
}
int test_imm_02int32_mem(int *val) {
  return ((*val) & (0x02 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_02int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 2
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void platform_free(void *ptr) { free(ptr); }


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

x86 assembly (clang, -O2):
<platform_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @platform_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void pfree(void *ptr) {
  if (ptr)
    free(ptr);
}


x86 assembly (clang, -O0):
<pfree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <pfree+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pfree>:
test   %rdi,%rdi
je     111a <pfree+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @pfree(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @free(i8* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @pfree(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Type definitions */
typedef scalar_t__ uint64_t;
struct timeval {
  unsigned int tv_sec;
  scalar_t__ tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
uint64_t time_micros(void) {
  struct timeval now;
  gettimeofday(&now, NULL);
  return (now.tv_sec * 1000000U + now.tv_usec);
}


x86 assembly (clang, -O0):
<time_micros>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
imul   $0xf4240,-0x10(%rbp),%eax
mov    %eax,%eax
add    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_micros>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0xf4240,0x8(%rsp),%eax
add    0x10(%rsp),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
define i64 @time_micros() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i32, i32* %3
%5 = mul i32 %4, 1000000
%6 = zext i32 %5 to i64
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%8 = load i64, i64* %7
%9 = add nsw i64 %6, %8
ret i64 %9
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define i64 @time_micros() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = mul i32 %5, 1000000
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%9 = load i64, i64* %8
%10 = add nsw i64 %9, %7
ret i64 %10
}
/* Variables and functions */
unsigned short app_usb_file_diskcopy(char *, char *, unsigned short);
unsigned short Usb_diskcopy(char *srcfile, char *dstfile,
                            unsigned short src_index) {
  return app_usb_file_diskcopy(srcfile, dstfile, src_index);
}


x86 assembly (clang, -O0):
<Usb_diskcopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dx,%ax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %ax,-0x12(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movzwl -0x12(%rbp),%edx
call   1030 <app_usb_file_diskcopy@plt>
movzwl %ax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Usb_diskcopy>:
jmp    1030 <app_usb_file_diskcopy@plt>

LLVM IR (-O0):
define zeroext i16 @Usb_diskcopy(i8* %0, i8* %1, i16 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i16
store i8* %0, i8** %4
store i8* %1, i8** %5
store i16 %2, i16* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i16, i16* %6
%10 = call zeroext i16 @app_usb_file_diskcopy(i8* %7, i8* %8, i16 zeroext %9)
ret i16 %10
}

LLVM IR (-O2):
define zeroext i16 @Usb_diskcopy(i8* %0, i8* %1, i16 zeroext %2) {
%4 = tail call zeroext i16 @app_usb_file_diskcopy(i8* %0, i8* %1, i16 zeroext %2)
ret i16 %4
}
/* Variables and functions */
int /*<<< orphan*/ fork();
int /*<<< orphan*/ printf(char *);
main() {
  printf("hello\n");
  fork();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <fork@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [7 x i8] c"hello\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @fork()
ret i32 0
}

LLVM IR (-O2):
@str = [6 x i8] c"hello\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @fork()
ret i32 0
}
/* Variables and functions */
float sinf(float);
float m_sin_f(float rad) { return sinf(rad); }


x86 assembly (clang, -O0):
<m_sin_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <sinf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_sin_f>:
jmp    1030 <sinf@plt>

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

LLVM IR (-O2):
define float @m_sin_f(float %0) {
%2 = tail call float @sinf(float %0)
ret float %2
}