xunge/DecIR huggingface dataset:
/* Type definitions */
typedef void internal;

/* Variables and functions */
struct internal *node(uintptr_t p) {
  return (void *)(p - 1);
}


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

x86 assembly (clang, -O2):
<node>:
lea    -0x1(%rdi),%rax
ret

LLVM IR (-O0):
%struct.internal = type opaque
define %struct.internal* @node(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = sub i64 %3, 1
%5 = inttoptr i64 %4 to i8*
%6 = bitcast i8* %5 to %struct.internal*
ret %struct.internal* %6
}

LLVM IR (-O2):
%struct.internal = type opaque
define %struct.internal* @node(i64 %0) {
%2 = add i64 %0, -1
%3 = inttoptr i64 %2 to %struct.internal*
ret %struct.internal* %3
}
int zero(long x) { return x == 0L; }


x86 assembly (clang, -O0):
<zero>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<zero>:
xor    %eax,%eax
test   %rdi,%rdi
sete   %al
ret

LLVM IR (-O0):
define i32 @zero(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @zero(i64 %0) {
%2 = icmp eq i64 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ fs__init();
void fs_init(void) { fs__init(); }


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

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

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

LLVM IR (-O2):
define void @fs_init() {
%1 = tail call i32 (...) @fs__init()
ret void
}
int f(int n) { return +-+13; }


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

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

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

LLVM IR (-O2):
define i32 @f(i32 %0) {
ret i32 -13
}
/* Type definitions */
struct packet_s {
  int dummy;
};

/* Variables and functions */
struct packet_s *genPack(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
struct packet_s *genCfgChng_Notifier(void) {
  struct packet_s *pack = NULL;
  pack = genPack(NULL, 0, 0);
  return pack;
}


x86 assembly (clang, -O0):
<genCfgChng_Notifier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
xor    %edx,%edx
mov    %edx,%esi
call   1030 <genPack@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<genCfgChng_Notifier>:
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <genPack@plt>

LLVM IR (-O0):
%struct.packet_s = type { i32 }
define %struct.packet_s* @genCfgChng_Notifier() {
%1 = alloca %struct.packet_s*
store %struct.packet_s* null, %struct.packet_s** %1
%2 = call %struct.packet_s* @genPack(i32* null, i32 0, i32 0)
store %struct.packet_s* %2, %struct.packet_s** %1
%3 = load %struct.packet_s*, %struct.packet_s** %1
ret %struct.packet_s* %3
}

LLVM IR (-O2):
%struct.packet_s = type { i32 }
define %struct.packet_s* @genCfgChng_Notifier() {
%1 = tail call %struct.packet_s* @genPack(i32* null, i32 0, i32 0)
ret %struct.packet_s* %1
}
/* Variables and functions */
int /*<<< orphan*/ reset_map_event_func();
int /*<<< orphan*/ reset_map_event_pos();
void reset_map_event(void) {
  reset_map_event_func();
  reset_map_event_pos();
}


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

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

LLVM IR (-O0):
define void @reset_map_event() {
%1 = call i32 (...) @reset_map_event_func()
%2 = call i32 (...) @reset_map_event_pos()
ret void
}

LLVM IR (-O2):
define void @reset_map_event() {
%1 = tail call i32 (...) @reset_map_event_func()
%2 = tail call i32 (...) @reset_map_event_pos()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void callee(int *p) {
  int temp;
  int diff = (p - &temp);
  printf("The stack in this machine grows %s\n",
         diff > 0 ? "downwards" : "upwards");
}


x86 assembly (clang, -O0):
<callee>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
lea    -0xc(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
lea    0xef6(%rip),%rsi
lea    0xee5(%rip),%rax
cmp    $0x0,%ecx
cmovg  %rax,%rsi
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<callee>:
push   %rax
lea    0x4(%rsp),%rax
sub    %rax,%rdi
shr    $0x2,%rdi
test   %edi,%edi
lea    0xefe(%rip),%rax
lea    0xf01(%rip),%rsi
cmovg  %rax,%rsi
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [36 x i8] c"The stack in this machine grows %s\0A\00"
@.str.1 = [10 x i8] c"downwards\00"
@.str.2 = [8 x i8] c"upwards\00"
define void @callee(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = ptrtoint i32* %5 to i64
%7 = ptrtoint i32* %3 to i64
%8 = sub i64 %6, %7
%9 = sdiv exact i64 %8, 4
%10 = trunc i64 %9 to i32
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 0
%13 = zext i1 %12 to i64
%14 = select i1 %12, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
%15 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %14)
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"The stack in this machine grows %s\0A\00"
@.str.1 = [10 x i8] c"downwards\00"
@.str.2 = [8 x i8] c"upwards\00"
define void @callee(i32* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = ptrtoint i32* %0 to i64
%5 = ptrtoint i32* %2 to i64
%6 = sub i64 %4, %5
%7 = lshr exact i64 %6, 2
%8 = trunc i64 %7 to i32
%9 = icmp sgt i32 %8, 0
%10 = select i1 %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
%11 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
scalar_t__ strdup(char *);
char *xstrdup(char *s) {
  char *cp;
  cp = (char *)strdup(s);
  if (cp == NULL) {
    fprintf(stderr, "xstrdup: out of virtual memory\n");
    exit(2);
  }
  return (cp);
}


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1173 <xstrdup+0x43>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %rax
call   1050 <strdup@plt>
test   %rax,%rax
je     113d <xstrdup+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"xstrdup: out of virtual memory\0A\00"
define i8* @xstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strdup(i8* %4)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 2)
unreachable
13: ; preds = %1
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"xstrdup: out of virtual memory\0A\00"
define i8* @xstrdup(i8* %0) {
%2 = tail call i64 @strdup(i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 2)
unreachable
8: ; preds = %1
%9 = inttoptr i64 %2 to i8*
ret i8* %9
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void hx4_xor_cookie_32(void *target, const void *cookie) {
  int i;
  for (i = 0; i < 4; i++) {
    ((uint8_t *)target)[i] ^= ((uint8_t *)cookie)[i];
  }
}


x86 assembly (clang, -O0):
<hx4_xor_cookie_32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    1144 <hx4_xor_cookie_32+0x44>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
xor    (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <hx4_xor_cookie_32+0x13>
pop    %rbp
ret

x86 assembly (clang, -O2):
<hx4_xor_cookie_32>:
mov    (%rsi),%eax
xor    %eax,(%rdi)
mov    0x4(%rsi),%eax
xor    %eax,0x4(%rdi)
mov    0x8(%rsi),%eax
xor    %eax,0x8(%rdi)
mov    0xc(%rsi),%eax
xor    %eax,0xc(%rdi)
ret

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

LLVM IR (-O2):
define void @hx4_xor_cookie_32(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = bitcast i8* %0 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = xor i32 %6, %5
store i32 %7, i32* %4
%8 = getelementptr inbounds i8, i8* %1, i64 4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = getelementptr inbounds i8, i8* %0, i64 4
%12 = bitcast i8* %11 to i32*
%13 = load i32, i32* %12
%14 = xor i32 %13, %10
store i32 %14, i32* %12
%15 = getelementptr inbounds i8, i8* %1, i64 8
%16 = bitcast i8* %15 to i32*
%17 = load i32, i32* %16
%18 = getelementptr inbounds i8, i8* %0, i64 8
%19 = bitcast i8* %18 to i32*
%20 = load i32, i32* %19
%21 = xor i32 %20, %17
store i32 %21, i32* %19
%22 = getelementptr inbounds i8, i8* %1, i64 12
%23 = bitcast i8* %22 to i32*
%24 = load i32, i32* %23
%25 = getelementptr inbounds i8, i8* %0, i64 12
%26 = bitcast i8* %25 to i32*
%27 = load i32, i32* %26
%28 = xor i32 %27, %24
store i32 %28, i32* %26
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dive(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  printf("Result: %llu\n", dive(0, 0, 17));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [14 x i8] c"Result: %llu\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @dive(i32 0, i32 0, i32 17)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ __assert_func(char *, int, int /*<<< orphan*/ *, char *);
void force_error() { __assert_func("testcase.h", 38, NULL, "forced"); }


x86 assembly (clang, -O0):
<force_error>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x26,%esi
xor    %eax,%eax
mov    %eax,%edx
lea    0xee0(%rip),%rcx
call   1030 <__assert_func@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<force_error>:
lea    0xee9(%rip),%rdi
lea    0xeed(%rip),%rcx
mov    $0x26,%esi
xor    %edx,%edx
jmp    1030 <__assert_func@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"testcase.h\00"
@.str.1 = [7 x i8] c"forced\00"
define void @force_error() {
%1 = call i32 @__assert_func(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 38, i32* null, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"testcase.h\00"
@.str.1 = [7 x i8] c"forced\00"
define void @force_error() {
%1 = tail call i32 @__assert_func(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 38, i32* null, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
void *malloc(size_t);
void *castle_alloc_maybe(size_t len, void *dst, size_t *dst_len) {
  if (!dst)
    return malloc(len);
  else if (dst_len && *dst_len >= len)
    return *dst_len = len, dst;
  else
    return NULL;
}


x86 assembly (clang, -O0):
<castle_alloc_maybe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1141 <castle_alloc_maybe+0x31>
mov    -0x10(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
jmp    117d <castle_alloc_maybe+0x6d>
cmpq   $0x0,-0x20(%rbp)
je     1175 <castle_alloc_maybe+0x65>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
cmp    -0x10(%rbp),%rax
jb     1175 <castle_alloc_maybe+0x65>
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    117d <castle_alloc_maybe+0x6d>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<castle_alloc_maybe>:
test   %rsi,%rsi
je     1125 <castle_alloc_maybe+0x15>
test   %rdx,%rdx
je     111f <castle_alloc_maybe+0xf>
cmp    %rdi,(%rdx)
jae    112a <castle_alloc_maybe+0x1a>
xor    %esi,%esi
mov    %rsi,%rax
ret
jmp    1030 <malloc@plt>
mov    %rdi,(%rdx)
mov    %rsi,%rax
ret

LLVM IR (-O0):
define i8* @castle_alloc_maybe(i64 %0, i8* %1, i64* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i64*
store i64 %0, i64* %5
store i8* %1, i8** %6
store i64* %2, i64** %7
%8 = load i8*, i8** %6
%9 = icmp ne i8* %8, null
br i1 %9, label %13, label %10
10: ; preds = %3
%11 = load i64, i64* %5
%12 = call i8* @malloc(i64 %11)
store i8* %12, i8** %4
br label %26
13: ; preds = %3
%14 = load i64*, i64** %7
%15 = icmp ne i64* %14, null
br i1 %15, label %16, label %25
16: ; preds = %13
%17 = load i64*, i64** %7
%18 = load i64, i64* %17
%19 = load i64, i64* %5
%20 = icmp uge i64 %18, %19
br i1 %20, label %21, label %25
21: ; preds = %16
%22 = load i64, i64* %5
%23 = load i64*, i64** %7
store i64 %22, i64* %23
%24 = load i8*, i8** %6
store i8* %24, i8** %4
br label %26
25: ; preds = %16, %13
store i8* null, i8** %4
br label %26
26: ; preds = %25, %21, %10
%27 = load i8*, i8** %4
ret i8* %27
}

LLVM IR (-O2):
define i8* @castle_alloc_maybe(i64 %0, i8* readnone %1, i64* %2) {
%4 = icmp eq i8* %1, null
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i8* @malloc(i64 %0)
br label %13
7: ; preds = %3
%8 = icmp eq i64* %2, null
br i1 %8, label %13, label %9
9: ; preds = %7
%10 = load i64, i64* %2
%11 = icmp ult i64 %10, %0
br i1 %11, label %13, label %12
12: ; preds = %9
store i64 %0, i64* %2
br label %13
13: ; preds = %7, %9, %12, %5
%14 = phi i8* [ %1, %12 ], [ %6, %5 ], [ null, %9 ], [ null, %7 ]
ret i8* %14
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int send_event;
};
typedef TYPE_1__ XKeyPressedEvent;

/* Variables and functions */
void set_XKeyPressedEvent_send_event(void *_p, int _v) {
  ((XKeyPressedEvent *)_p)->send_event = (int)_v;
}


x86 assembly (clang, -O0):
<set_XKeyPressedEvent_send_event>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XKeyPressedEvent_send_event>:
mov    %esi,(%rdi)
ret

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

LLVM IR (-O2):
define void @set_XKeyPressedEvent_send_event(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char s[100];
  printf("%s", s);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
sub    $0x68,%rsp
lea    0xee5(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int rand_num(unsigned int *);
int gpr_random_function(int *instruction_set, int no_of_instructions,
                        unsigned int *random_seed) {
  return instruction_set[rand_num(random_seed) % no_of_instructions];
}


x86 assembly (clang, -O0):
<gpr_random_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <rand_num@plt>
cltd
idivl  -0xc(%rbp)
mov    -0x20(%rbp),%rax
movslq %edx,%rcx
mov    (%rax,%rcx,4),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpr_random_function>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
mov    %rdx,%rdi
call   1030 <rand_num@plt>
cltd
idiv   %ebx
movslq %edx,%rax
mov    (%r14,%rax,4),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @gpr_random_function(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** %4
%8 = load i32*, i32** %6
%9 = call i32 @rand_num(i32* %8)
%10 = load i32, i32* %5
%11 = srem i32 %9, %10
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %7, i64 %12
%14 = load i32, i32* %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @gpr_random_function(i32* nocapture %0, i32 %1, i32* %2) {
%4 = tail call i32 @rand_num(i32* %2)
%5 = srem i32 %4, %1
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i32, i32* %0, i64 %6
%8 = load i32, i32* %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ pthread_exit(void *);
int write(int, char *, int);
int cwrite(int fd, char *buf, int n) {
  int nwrite;
  if ((nwrite = write(fd, buf, n)) < 0) {
    perror("Writing data");
    pthread_exit((void *)1);
  }
  return nwrite;
}


x86 assembly (clang, -O0):
<cwrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <write@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    1173 <cwrite+0x43>
lea    0xe9c(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1040 <pthread_exit@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cwrite>:
push   %rbx
call   1030 <write@plt>
mov    %eax,%ebx
test   %eax,%eax
js     1140 <cwrite+0x10>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xeb9(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1040 <pthread_exit@plt>
jmp    113c <cwrite+0xc>

LLVM IR (-O0):
@.str = [13 x i8] c"Writing data\00"
define i32 @cwrite(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i32 @write(i32 %8, i8* %9, i32 %10)
store i32 %11, i32* %7
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %3
%14 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @pthread_exit(i8* inttoptr (i64 1 to i8*))
br label %16
16: ; preds = %13, %3
%17 = load i32, i32* %7
ret i32 %17
}

LLVM IR (-O2):
@.str = [13 x i8] c"Writing data\00"
define i32 @cwrite(i32 %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %2)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @pthread_exit(i8* inttoptr (i64 1 to i8*))
br label %9
9: ; preds = %6, %3
ret i32 %4
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) { printf("test 1:%d\n", atoi(argv[1])); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,%esi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [11 x i8] c"test 1:%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atoi(i8* %4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ index_add_arg(char *);
void cm_cindex(void) { index_add_arg("cp"); }


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"cp\00"
define void @cm_cindex() {
%1 = tail call i32 @index_add_arg(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
double ShareRand(double, double);
void ShareRandVec(double *s, int n, double min, double max) {
  int i;
  for (i = 0; i < n; i++)
    s[i] = ShareRand(min, max);
  return;
}


x86 assembly (clang, -O0):
<ShareRandVec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1166 <ShareRandVec+0x56>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1030 <ShareRand@plt>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1130 <ShareRandVec+0x20>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ShareRandVec>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
test   %esi,%esi
jle    114f <ShareRandVec+0x3f>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1030 <ShareRand@plt>
movsd  %xmm0,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <ShareRandVec+0x20>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @ShareRandVec(double* nocapture writeonly %0, i32 %1, double %2, double %3) {
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %14
6: ; preds = %4
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %12, %8 ]
%10 = tail call double @ShareRand(double %2, double %3)
%11 = getelementptr inbounds double, double* %0, i64 %9
store double %10, double* %11
%12 = add nuw nsw i64 %9, 1
%13 = icmp eq i64 %12, %7
br i1 %13, label %14, label %8
14: ; preds = %8, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ UART_2_UartInit();
void UART_2_Init(void) { UART_2_UartInit(); }


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

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

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

LLVM IR (-O2):
define void @UART_2_Init() {
%1 = tail call i32 (...) @UART_2_UartInit()
ret void
}
void f22(a23, a24) int a23;
union file *a24;
{
}


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

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

LLVM IR (-O0):
%union.file = type opaque
define void @f22(i32 %0, %union.file* %1) {
%3 = alloca i32
%4 = alloca %union.file*
store i32 %0, i32* %3
store %union.file* %1, %union.file** %4
ret void
}

LLVM IR (-O2):
%union.file = type opaque
define void @f22(i32 %0, %union.file* nocapture %1) {
ret void
}
/* Variables and functions */
char *fun1();
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  printf("%s\n", fun1());
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = tail call i8* (...) @fun1()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ cpputest_free_location(void *, char *, int);
void freeAllocation(void *memory) {
  cpputest_free_location(
      memory,
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/List3nt0/CodeLibrary/refs/heads/master/COTS/"
      "CppUTest/2.4/tests/AllocationInCFile.c",
      22);
}


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

x86 assembly (clang, -O2):
<freeAllocation>:
lea    0xee9(%rip),%rsi
mov    $0x16,%edx
jmp    1030 <cpputest_free_location@plt>

LLVM IR (-O0):
@.str = [173 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/List3nt0/CodeLibrary/refs/heads/master/COTS/CppUTest/2.4/tests/AllocationInCFile.c\00"
define void @freeAllocation(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @cpputest_free_location(i8* %3, i8* getelementptr inbounds ([173 x i8], [173 x i8]* @.str, i64 0, i64 0), i32 22)
ret void
}

LLVM IR (-O2):
@.str = [173 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/List3nt0/CodeLibrary/refs/heads/master/COTS/CppUTest/2.4/tests/AllocationInCFile.c\00"
define void @freeAllocation(i8* %0) {
%2 = tail call i32 @cpputest_free_location(i8* %0, i8* getelementptr inbounds ([173 x i8], [173 x i8]* @.str, i64 0, i64 0), i32 22)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo1(int);
int /*<<< orphan*/ print_int(int);
int /*<<< orphan*/ print_string(char *);
void foo0(int d) {
  print_int(d);
  print_string("\n");
  foo1(d);
}


x86 assembly (clang, -O0):
<foo0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <print_int@plt>
lea    0xeb6(%rip),%rdi
call   1030 <print_string@plt>
mov    -0x4(%rbp),%edi
call   1050 <foo1@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo0>:
push   %rbx
mov    %edi,%ebx
call   1040 <print_int@plt>
lea    0xec1(%rip),%rdi
call   1030 <print_string@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1050 <foo1@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define void @foo0(i32 %0) {
%2 = tail call i32 @print_int(i32 %0)
%3 = tail call i32 @print_string(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @foo1(i32 %0)
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned long cursor;
};
typedef TYPE_1__ XSetWindowAttributes;

/* Variables and functions */
void set_XSetWindowAttributes_cursor(void *_p, unsigned long _v) {
  ((XSetWindowAttributes *)_p)->cursor = (unsigned long)_v;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define void @set_XSetWindowAttributes_cursor(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i64 %5, i64* %8
ret void
}

LLVM IR (-O2):
define void @set_XSetWindowAttributes_cursor(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
void free_node(struct node *x) {}


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

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

LLVM IR (-O0):
%struct.node = type opaque
define void @free_node(%struct.node* %0) {
%2 = alloca %struct.node*
store %struct.node* %0, %struct.node** %2
ret void
}

LLVM IR (-O2):
%struct.node = type opaque
define void @free_node(%struct.node* nocapture %0) {
ret void
}
int horasMin(int *hours, int *minutes) {
  *hours = *minutes / 60;
  *minutes %= 60;
  if (*hours >= 24) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<horasMin>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    (%rax),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%rax
mov    %edx,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0x18,(%rax)
jl     1153 <horasMin+0x53>
movl   $0x1,-0x4(%rbp)
jmp    115a <horasMin+0x5a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<horasMin>:
movslq (%rsi),%rax
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
sar    $0x5,%ecx
add    %eax,%ecx
mov    %ecx,(%rdi)
movslq (%rsi),%rax
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x5,%ecx
add    %edx,%ecx
imul   $0x3c,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,(%rsi)
xor    %eax,%eax
cmpl   $0x18,(%rdi)
setge  %al
ret

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

LLVM IR (-O2):
define i32 @horasMin(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = sdiv i32 %3, 60
store i32 %4, i32* %0
%5 = load i32, i32* %1
%6 = srem i32 %5, 60
store i32 %6, i32* %1
%7 = load i32, i32* %0
%8 = icmp sgt i32 %7, 23
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ onMsgPtr(char *, unsigned long);
void BLEOnMessage(char *data, unsigned long len) { onMsgPtr(data, len); }


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

x86 assembly (clang, -O2):
<BLEOnMessage>:
jmp    1030 <onMsgPtr@plt>

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

LLVM IR (-O2):
define void @BLEOnMessage(i8* %0, i64 %1) {
%3 = tail call i32 @onMsgPtr(i8* %0, i64 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ benchmark(char *, char *, char *, int);
void benchmark_file_download(char *tmpdir, int iter) {
  benchmark("File Download", "../clax -n -r . -l /dev/null > /dev/null",
            "GET /tree/benchmark.c\r\n\r\n", iter);
}


x86 assembly (clang, -O0):
<benchmark_file_download>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
lea    0xed7(%rip),%rdi
lea    0xede(%rip),%rsi
lea    0xf00(%rip),%rdx
call   1030 <benchmark@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<benchmark_file_download>:
mov    %esi,%ecx
lea    0xee7(%rip),%rdi
lea    0xeee(%rip),%rsi
lea    0xf10(%rip),%rdx
jmp    1030 <benchmark@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"File Download\00"
@.str.1 = [41 x i8] c"../clax -n -r . -l /dev/null > /dev/null\00"
@.str.2 = [26 x i8] c"GET /tree/benchmark.c\0D\0A\0D\0A\00"
define void @benchmark_file_download(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = call i32 @benchmark(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"File Download\00"
@.str.1 = [41 x i8] c"../clax -n -r . -l /dev/null > /dev/null\00"
@.str.2 = [26 x i8] c"GET /tree/benchmark.c\0D\0A\0D\0A\00"
define void @benchmark_file_download(i8* nocapture readnone %0, i32 %1) {
%3 = tail call i32 @benchmark(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int sqrt(int);
main() {
  int y;
  y = ((-9 < 0) ? sqrt(- -9) : sqrt(-9));
  printf("%d", y);
}


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

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

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = call i32 @sqrt(i32 9)
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @sqrt(i32 9)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
extern void shmem_long_wait_until(long *ivar, int cmp, long cmp_value) {
  printf("\nOpenSHMEM Analyzer\n");
}


x86 assembly (clang, -O0):
<shmem_long_wait_until>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [21 x i8] c"\0AOpenSHMEM Analyzer\0A\00"
define void @shmem_long_wait_until(i64* %0, i32 %1, i64 %2) {
%4 = alloca i64*
%5 = alloca i32
%6 = alloca i64
store i64* %0, i64** %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%7 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [20 x i8] c"\0AOpenSHMEM Analyzer\00"
define void @shmem_long_wait_until(i64* nocapture readnone %0, i32 %1, i64 %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ add_dest_to_comm_schedule(int **, int, int);
void add_pair_to_comm_schedule(int **sched, int pe1, int pe2) {
  add_dest_to_comm_schedule(sched, pe1, pe2);
  if (pe1 != pe2)
    add_dest_to_comm_schedule(sched, pe2, pe1);
}


x86 assembly (clang, -O0):
<add_pair_to_comm_schedule>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <add_dest_to_comm_schedule@plt>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     114c <add_pair_to_comm_schedule+0x3c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <add_dest_to_comm_schedule@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_pair_to_comm_schedule>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %esi,%ebx
mov    %rdi,%r14
call   1030 <add_dest_to_comm_schedule@plt>
cmp    %ebp,%ebx
jne    1129 <add_pair_to_comm_schedule+0x19>
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <add_dest_to_comm_schedule@plt>

LLVM IR (-O0):
define void @add_pair_to_comm_schedule(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*** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @add_dest_to_comm_schedule(i32** %7, i32 %8, i32 %9)
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %19
14: ; preds = %3
%15 = load i32**, i32*** %4
%16 = load i32, i32* %6
%17 = load i32, i32* %5
%18 = call i32 @add_dest_to_comm_schedule(i32** %15, i32 %16, i32 %17)
br label %19
19: ; preds = %14, %3
ret void
}

LLVM IR (-O2):
define void @add_pair_to_comm_schedule(i32** %0, i32 %1, i32 %2) {
%4 = tail call i32 @add_dest_to_comm_schedule(i32** %0, i32 %1, i32 %2)
%5 = icmp eq i32 %1, %2
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @add_dest_to_comm_schedule(i32** %0, i32 %2, i32 %1)
br label %8
8: ; preds = %6, %3
ret void
}
/* Variables and functions */
size_t base16hex_len(size_t len) { return 2 * len; }


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

x86 assembly (clang, -O2):
<base16hex_len>:
lea    (%rdi,%rdi,1),%rax
ret

LLVM IR (-O0):
define i64 @base16hex_len(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = mul i64 2, %3
ret i64 %4
}

LLVM IR (-O2):
define i64 @base16hex_len(i64 %0) {
%2 = shl i64 %0, 1
ret i64 %2
}
void unsigned_char_sub_signed_char_signed_int(unsigned char *LHS,
                                              signed int RHS) {
  (*LHS) -= RHS;
}


x86 assembly (clang, -O0):
<unsigned_char_sub_signed_char_signed_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
movzbl (%rax),%ecx
sub    %edx,%ecx
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<unsigned_char_sub_signed_char_signed_int>:
sub    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @unsigned_char_sub_signed_char_signed_int(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = sub nsw i32 %8, %5
%10 = trunc i32 %9 to i8
store i8 %10, i8* %6
ret void
}

LLVM IR (-O2):
define void @unsigned_char_sub_signed_char_signed_int(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = trunc i32 %1 to i8
%5 = sub i8 %3, %4
store i8 %5, i8* %0
ret void
}
/* Variables and functions */
void *test_demo(void *count) { return NULL; }


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

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

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

LLVM IR (-O2):
define noalias i8* @test_demo(i8* nocapture readnone %0) {
ret i8* null
}
void TimerMatchSet(unsigned long ulBase, unsigned long ulTimer,
                   unsigned long ulValue) {
  ;

  ;
  if (ulTimer & 0x000000ff) {
    (*((volatile unsigned long *)(ulBase + 0x00000030))) = ulValue;
  }
  if (ulTimer & 0x0000ff00) {
    (*((volatile unsigned long *)(ulBase + 0x00000034))) = ulValue;
  }
}


x86 assembly (clang, -O0):
<TimerMatchSet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
and    $0xff,%rax
cmp    $0x0,%rax
je     1130 <TimerMatchSet+0x30>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x30(%rax)
mov    -0x10(%rbp),%rax
and    $0xff00,%rax
cmp    $0x0,%rax
je     1150 <TimerMatchSet+0x50>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x34(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerMatchSet>:
test   %sil,%sil
je     1109 <TimerMatchSet+0x9>
mov    %rdx,0x30(%rdi)
test   $0xff00,%esi
je     1115 <TimerMatchSet+0x15>
mov    %rdx,0x34(%rdi)
ret

LLVM IR (-O0):
define void @TimerMatchSet(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %5
%8 = and i64 %7, 255
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %3
%11 = load i64, i64* %6
%12 = load i64, i64* %4
%13 = add i64 %12, 48
%14 = inttoptr i64 %13 to i64*
store volatile i64 %11, i64* %14
br label %15
15: ; preds = %10, %3
%16 = load i64, i64* %5
%17 = and i64 %16, 65280
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %15
%20 = load i64, i64* %6
%21 = load i64, i64* %4
%22 = add i64 %21, 52
%23 = inttoptr i64 %22 to i64*
store volatile i64 %20, i64* %23
br label %24
24: ; preds = %19, %15
ret void
}

LLVM IR (-O2):
define void @TimerMatchSet(i64 %0, i64 %1, i64 %2) {
%4 = and i64 %1, 255
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = add i64 %0, 48
%8 = inttoptr i64 %7 to i64*
store volatile i64 %2, i64* %8
br label %9
9: ; preds = %6, %3
%10 = and i64 %1, 65280
%11 = icmp eq i64 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = add i64 %0, 52
%14 = inttoptr i64 %13 to i64*
store volatile i64 %2, i64* %14
br label %15
15: ; preds = %12, %9
ret void
}