xunge/DecIR huggingface dataset:
int main() {
  int x, y, z;
  while (1) {
    if (x) {
      z = z + x;
      x *= 2;
      y = (y - 1) / 2;
    } else {
      x *= 2;
      y = y / 2;
      z = z;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     113d <main+0x3d>
mov    -0x10(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
jmp    115a <main+0x5a>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    110b <main+0xb>

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

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

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
br label %1
}
unsigned long long getticks(void) {
  unsigned a, d;
  asm volatile("rdtsc" : "=a"(a), "=d"(d));
  return ((unsigned long long)a) | (((unsigned long long)d) << 32);
}


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

x86 assembly (clang, -O2):
<getticks>:
rdtsc
mov    %eax,%eax
shl    $0x20,%rdx
or     %rdx,%rax
ret

LLVM IR (-O0):
define i64 @getticks() {
%1 = alloca i32
%2 = alloca i32
%3 = call { i32, i32 } asm sideeffect "rdtsc", "={ax},={dx},~{dirflag},~{fpsr},~{flags}"()
%4 = extractvalue { i32, i32 } %3, 0
%5 = extractvalue { i32, i32 } %3, 1
store i32 %4, i32* %1
store i32 %5, i32* %2
%6 = load i32, i32* %1
%7 = zext i32 %6 to i64
%8 = load i32, i32* %2
%9 = zext i32 %8 to i64
%10 = shl i64 %9, 32
%11 = or i64 %7, %10
ret i64 %11
}

LLVM IR (-O2):
define i64 @getticks() {
%1 = tail call { i32, i32 } asm sideeffect "rdtsc", "={ax},={dx},~{dirflag},~{fpsr},~{flags}"()
%2 = extractvalue { i32, i32 } %1, 0
%3 = extractvalue { i32, i32 } %1, 1
%4 = zext i32 %2 to i64
%5 = zext i32 %3 to i64
%6 = shl nuw i64 %5, 32
%7 = or i64 %6, %4
ret i64 %7
}
/* Type definitions */
struct sockaddr_in {
  int dummy;
};
typedef int sa_family_t;

/* Variables and functions */
#define AF_INET 128
int __libc_sa_len(sa_family_t af) {
  switch (af) {
  case AF_INET:
    return sizeof(struct sockaddr_in);
  }
  return 0;
}


x86 assembly (clang, -O0):
<__libc_sa_len>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x80,%eax
jne    1126 <__libc_sa_len+0x26>
jmp    111a <__libc_sa_len+0x1a>
movl   $0x4,-0x4(%rbp)
jmp    112d <__libc_sa_len+0x2d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__libc_sa_len>:
xor    %eax,%eax
cmp    $0x80,%edi
sete   %al
shl    $0x2,%eax
ret

LLVM IR (-O0):
define i32 @__libc_sa_len(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %6 [
i32 128, label %5
]
5: ; preds = %1
store i32 4, i32* %2
br label %7
6: ; preds = %1
store i32 0, i32* %2
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
define i32 @__libc_sa_len(i32 %0) {
%2 = icmp eq i32 %0, 128
%3 = select i1 %2, i32 4, i32 0
ret i32 %3
}
unsigned long psi_get_uint32_le(const void *buf, unsigned idx) {
  unsigned long val;
  const unsigned char *tmp;
  tmp = (const unsigned char *)buf + idx;
  val = tmp[3] & 0xff;
  val = (val << 8) | (tmp[2] & 0xff);
  val = (val << 8) | (tmp[1] & 0xff);
  val = (val << 8) | (tmp[0] & 0xff);
  return (val);
}


x86 assembly (clang, -O0):
<psi_get_uint32_le>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movzbl 0x3(%rax),%eax
and    $0xff,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x8,%rax
mov    -0x20(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
and    $0xff,%ecx
movslq %ecx,%rcx
or     %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x8,%rax
mov    -0x20(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
and    $0xff,%ecx
movslq %ecx,%rcx
or     %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x8,%rax
mov    -0x20(%rbp),%rcx
movzbl (%rcx),%ecx
and    $0xff,%ecx
movslq %ecx,%rcx
or     %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<psi_get_uint32_le>:
mov    %esi,%eax
mov    (%rdi,%rax,1),%eax
ret

LLVM IR (-O0):
define i64 @psi_get_uint32_le(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i8*, i8** %3
%8 = load i32, i32* %4
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %7, i64 %9
store i8* %10, i8** %6
%11 = load i8*, i8** %6
%12 = getelementptr inbounds i8, i8* %11, i64 3
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = and i32 %14, 255
%16 = sext i32 %15 to i64
store i64 %16, i64* %5
%17 = load i64, i64* %5
%18 = shl i64 %17, 8
%19 = load i8*, i8** %6
%20 = getelementptr inbounds i8, i8* %19, i64 2
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = and i32 %22, 255
%24 = sext i32 %23 to i64
%25 = or i64 %18, %24
store i64 %25, i64* %5
%26 = load i64, i64* %5
%27 = shl i64 %26, 8
%28 = load i8*, i8** %6
%29 = getelementptr inbounds i8, i8* %28, i64 1
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = and i32 %31, 255
%33 = sext i32 %32 to i64
%34 = or i64 %27, %33
store i64 %34, i64* %5
%35 = load i64, i64* %5
%36 = shl i64 %35, 8
%37 = load i8*, i8** %6
%38 = getelementptr inbounds i8, i8* %37, i64 0
%39 = load i8, i8* %38
%40 = zext i8 %39 to i32
%41 = and i32 %40, 255
%42 = sext i32 %41 to i64
%43 = or i64 %36, %42
store i64 %43, i64* %5
%44 = load i64, i64* %5
ret i64 %44
}

LLVM IR (-O2):
define i64 @psi_get_uint32_le(i8* nocapture %0, i32 %1) {
%3 = zext i32 %1 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = getelementptr inbounds i8, i8* %4, i64 3
%6 = load i8, i8* %5
%7 = zext i8 %6 to i64
%8 = getelementptr inbounds i8, i8* %4, i64 2
%9 = load i8, i8* %8
%10 = zext i8 %9 to i64
%11 = shl nuw nsw i64 %7, 16
%12 = shl nuw nsw i64 %10, 8
%13 = or i64 %12, %11
%14 = getelementptr inbounds i8, i8* %4, i64 1
%15 = load i8, i8* %14
%16 = zext i8 %15 to i64
%17 = or i64 %13, %16
%18 = shl nuw nsw i64 %17, 8
%19 = load i8, i8* %4
%20 = zext i8 %19 to i64
%21 = or i64 %18, %20
ret i64 %21
}
void RTSemEventAddSignaller(void) {}


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

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

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

LLVM IR (-O2):
define void @RTSemEventAddSignaller() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EVP_sha1();
int PKCS1_MGF1(unsigned char *, long, unsigned char const *, long,
               int /*<<< orphan*/);
int MGF1(unsigned char *mask, long len, const unsigned char *seed,
         long seedlen) {
  return PKCS1_MGF1(mask, len, seed, seedlen, EVP_sha1());
}


x86 assembly (clang, -O0):
<MGF1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1030 <EVP_sha1@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    %eax,%r8d
call   1040 <PKCS1_MGF1@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MGF1>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <EVP_sha1@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
mov    %eax,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <PKCS1_MGF1@plt>

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

LLVM IR (-O2):
define i32 @MGF1(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = tail call i32 (...) @EVP_sha1()
%6 = tail call i32 @PKCS1_MGF1(i8* %0, i64 %1, i8* %2, i64 %3, i32 %5)
ret i32 %6
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t decode_u16le(uint8_t **cursor) {
  uint8_t *p = *cursor;
  *cursor += 2;
  return (p[1] << 8) | p[0];
}


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

x86 assembly (clang, -O2):
<decode_u16le>:
mov    (%rdi),%rcx
lea    0x8(%rcx),%rax
mov    %rax,(%rdi)
mov    0x4(%rcx),%eax
shl    $0x8,%eax
or     (%rcx),%eax
ret

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

LLVM IR (-O2):
define i32 @decode_u16le(i32** nocapture %0) {
%2 = load i32*, i32** %0
%3 = getelementptr inbounds i32, i32* %2, i64 2
store i32* %3, i32** %0
%4 = getelementptr inbounds i32, i32* %2, i64 1
%5 = load i32, i32* %4
%6 = shl i32 %5, 8
%7 = load i32, i32* %2
%8 = or i32 %6, %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
char *xmemdup0(char const *, int /*<<< orphan*/);
char *xstrdup(const char *s) { return xmemdup0(s, strlen(s)); }


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
call   1040 <xmemdup0@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <xmemdup0@plt>

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

LLVM IR (-O2):
define i8* @xstrdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i8* @xmemdup0(i8* %0, i32 %2)
ret i8* %3
}
/* Type definitions */
struct node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ d2_list_add_head(struct node *, struct node *);
void d2_stack_push(struct node *node, struct node *stack) {
  d2_list_add_head(node, stack);
}


x86 assembly (clang, -O0):
<d2_stack_push>:
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 <d2_list_add_head@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d2_stack_push>:
jmp    1030 <d2_list_add_head@plt>

LLVM IR (-O0):
%struct.node = type { i32 }
define void @d2_stack_push(%struct.node* %0, %struct.node* %1) {
%3 = alloca %struct.node*
%4 = alloca %struct.node*
store %struct.node* %0, %struct.node** %3
store %struct.node* %1, %struct.node** %4
%5 = load %struct.node*, %struct.node** %3
%6 = load %struct.node*, %struct.node** %4
%7 = call i32 @d2_list_add_head(%struct.node* %5, %struct.node* %6)
ret void
}

LLVM IR (-O2):
%struct.node = type { i32 }
define void @d2_stack_push(%struct.node* %0, %struct.node* %1) {
%3 = tail call i32 @d2_list_add_head(%struct.node* %0, %struct.node* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
extern void MyFree(void *x) {
  if (x != NULL)
    free(x);
}


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

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

LLVM IR (-O0):
define void @MyFree(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 @MyFree(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
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ state;
};
typedef TYPE_1__ XKeyReleasedEvent;

/* Variables and functions */
unsigned get_XKeyReleasedEvent_state(void *_p) {
  return (unsigned)((XKeyReleasedEvent *)_p)->state;
}


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

x86 assembly (clang, -O2):
<get_XKeyReleasedEvent_state>:
mov    (%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @get_XKeyReleasedEvent_state(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
int get_base_prime(char base) {
  switch (base) {
  case 'A':
    return 2;
  case 'C':
    return 3;
  case 'G':
    return 5;
  case 'T':
    return 7;
  case 'N':
    return 11;
  case '-':
    return 13;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<get_base_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xffffffd3,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x27,%eax
ja     117c <get_base_prime+0x7c>
mov    -0x10(%rbp),%rax
lea    0xed5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x2,-0x4(%rbp)
jmp    1183 <get_base_prime+0x83>
movl   $0x3,-0x4(%rbp)
jmp    1183 <get_base_prime+0x83>
movl   $0x5,-0x4(%rbp)
jmp    1183 <get_base_prime+0x83>
movl   $0x7,-0x4(%rbp)
jmp    1183 <get_base_prime+0x83>
movl   $0xb,-0x4(%rbp)
jmp    1183 <get_base_prime+0x83>
movl   $0xd,-0x4(%rbp)
jmp    1183 <get_base_prime+0x83>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_base_prime>:
add    $0xffffffd3,%edi
cmp    $0x27,%edi
ja     1123 <get_base_prime+0x23>
mov    $0x2,%eax
lea    0xeec(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    $0xd,%eax
ret
xor    %eax,%eax
ret
mov    $0x3,%eax
ret
mov    $0x5,%eax
ret
mov    $0xb,%eax
ret
mov    $0x7,%eax
ret

LLVM IR (-O0):
define i32 @get_base_prime(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %12 [
i32 65, label %6
i32 67, label %7
i32 71, label %8
i32 84, label %9
i32 78, label %10
i32 45, label %11
]
6: ; preds = %1
store i32 2, i32* %2
br label %13
7: ; preds = %1
store i32 3, i32* %2
br label %13
8: ; preds = %1
store i32 5, i32* %2
br label %13
9: ; preds = %1
store i32 7, i32* %2
br label %13
10: ; preds = %1
store i32 11, i32* %2
br label %13
11: ; preds = %1
store i32 13, i32* %2
br label %13
12: ; preds = %1
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11, %10, %9, %8, %7, %6
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @get_base_prime(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %8 [
i32 65, label %9
i32 67, label %3
i32 71, label %4
i32 84, label %5
i32 78, label %6
i32 45, label %7
]
3: ; preds = %1
br label %9
4: ; preds = %1
br label %9
5: ; preds = %1
br label %9
6: ; preds = %1
br label %9
7: ; preds = %1
br label %9
8: ; preds = %1
br label %9
9: ; preds = %1, %8, %7, %6, %5, %4, %3
%10 = phi i32 [ 0, %8 ], [ 13, %7 ], [ 11, %6 ], [ 7, %5 ], [ 5, %4 ], [ 3, %3 ], [ 2, %1 ]
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ __NR_gettid;
int /*<<< orphan*/ syscall(int /*<<< orphan*/);
pid_t __gettid(void) { return syscall(__NR_gettid); }


x86 assembly (clang, -O0):
<__gettid>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <syscall@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<__gettid>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
@__NR_gettid = global i32 0
define i32 @__gettid() {
%1 = load i32, i32* @__NR_gettid
%2 = call i32 @syscall(i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@__NR_gettid = global i32 0
define i32 @__gettid() {
%1 = load i32, i32* @__NR_gettid
%2 = tail call i32 @syscall(i32 %1)
ret i32 %2
}
int searchR(int *array, int tam, int target) {
  if (!tam)
    return 0;
  if (array[0] == target)
    return 0;
  return 1 + searchR(array + 1, tam - 1, target);
}


x86 assembly (clang, -O0):
<searchR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1138 <searchR+0x28>
movl   $0x0,-0x4(%rbp)
jmp    116f <searchR+0x5f>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
cmp    -0x18(%rbp),%eax
jne    1153 <searchR+0x43>
movl   $0x0,-0x4(%rbp)
jmp    116f <searchR+0x5f>
mov    -0x10(%rbp),%rdi
add    $0x4,%rdi
mov    -0x14(%rbp),%esi
sub    $0x1,%esi
mov    -0x18(%rbp),%edx
call   1030 <searchR@plt>
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<searchR>:
test   %esi,%esi
je     111e <searchR+0x1e>
mov    %esi,%eax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
cmp    %edx,(%rdi,%rcx,4)
je     1121 <searchR+0x21>
add    $0x1,%rcx
cmp    %ecx,%eax
jne    1110 <searchR+0x10>
ret
xor    %eax,%eax
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @searchR(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %16, label %5
5: ; preds = %3, %11
%6 = phi i32 [ %13, %11 ], [ %1, %3 ]
%7 = phi i32* [ %12, %11 ], [ %0, %3 ]
%8 = phi i32 [ %14, %11 ], [ 0, %3 ]
%9 = load i32, i32* %7
%10 = icmp eq i32 %9, %2
br i1 %10, label %16, label %11
11: ; preds = %5
%12 = getelementptr inbounds i32, i32* %7, i64 1
%13 = add nsw i32 %6, -1
%14 = add nuw nsw i32 %8, 1
%15 = icmp eq i32 %13, 0
br i1 %15, label %16, label %5
16: ; preds = %11, %5, %3
%17 = phi i32 [ 0, %3 ], [ %8, %5 ], [ %1, %11 ]
ret i32 %17
}
double sub(double a, double b) { return a - b; }


x86 assembly (clang, -O0):
<sub>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub>:
subsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @sub(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fsub double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @sub(double %0, double %1) {
%3 = fsub double %0, %1
ret double %3
}
void put_bits(unsigned char value, unsigned bit, unsigned nr_bits,
              unsigned long long *result) {
  *result +=
      ((unsigned long long)(value & ((unsigned char)((1 << nr_bits) - 1))))
      << bit;
}


x86 assembly (clang, -O0):
<put_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
movzbl -0x1(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
sub    $0x1,%ecx
movzbl %cl,%ecx
and    %ecx,%eax
cltq
mov    -0x8(%rbp),%ecx
shl    %cl,%rax
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_bits>:
mov    %rcx,%rax
mov    %edx,%ecx
mov    $0xffffffff,%edx
shl    %cl,%edx
not    %edx
and    %edi,%edx
mov    %esi,%ecx
shl    %cl,%rdx
add    %rdx,(%rax)
ret

LLVM IR (-O0):
define void @put_bits(i8 zeroext %0, i32 %1, i32 %2, i64* %3) {
%5 = alloca i8
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64*
store i8 %0, i8* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i64* %3, i64** %8
%9 = load i8, i8* %5
%10 = zext i8 %9 to i32
%11 = load i32, i32* %7
%12 = shl i32 1, %11
%13 = sub nsw i32 %12, 1
%14 = trunc i32 %13 to i8
%15 = zext i8 %14 to i32
%16 = and i32 %10, %15
%17 = sext i32 %16 to i64
%18 = load i32, i32* %6
%19 = zext i32 %18 to i64
%20 = shl i64 %17, %19
%21 = load i64*, i64** %8
%22 = load i64, i64* %21
%23 = add i64 %22, %20
store i64 %23, i64* %21
ret void
}

LLVM IR (-O2):
define void @put_bits(i8 zeroext %0, i32 %1, i32 %2, i64* nocapture %3) {
%5 = zext i8 %0 to i32
%6 = shl nsw i32 -1, %2
%7 = xor i32 %6, -1
%8 = and i32 %7, %5
%9 = zext i32 %8 to i64
%10 = zext i32 %1 to i64
%11 = shl i64 %9, %10
%12 = load i64, i64* %3
%13 = add i64 %12, %11
store i64 %13, i64* %3
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ test_case;

/* Variables and functions */
int /*<<< orphan*/ assert_test(int, char **, char **);
void t_big_nums(void *context) {
  char *test_case[] = {"10-a", "2-b"};
  char *expected[] = {"2-b", "10-a"};
  assert_test(sizeof(test_case) / sizeof(char *), test_case, expected);
}


x86 assembly (clang, -O0):
<t_big_nums>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2cdd(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cda(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2cd7(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cd4(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x20(%rbp),%rsi
lea    -0x30(%rbp),%rdx
mov    $0x2,%edi
call   1030 <assert_test@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_big_nums>:
sub    $0x28,%rsp
movaps 0x2ce5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0x2ce9(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x10(%rsp),%rsi
mov    %rsp,%rdx
mov    $0x2,%edi
call   1030 <assert_test@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"10-a\00"
@.str.1 = [4 x i8] c"2-b\00"
@__const.t_big_nums.test_case = [2 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0)]
@__const.t_big_nums.expected = [2 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0)]
define void @t_big_nums(i8* %0) {
%2 = alloca i8*
%3 = alloca [2 x i8*]
%4 = alloca [2 x i8*]
store i8* %0, i8** %2
%5 = bitcast [2 x i8*]* %3 to i8*
%6 = bitcast [2 x i8*]* %4 to i8*
%7 = getelementptr inbounds [2 x i8*], [2 x i8*]* %3, i64 0, i64 0
%8 = getelementptr inbounds [2 x i8*], [2 x i8*]* %4, i64 0, i64 0
%9 = call i32 @assert_test(i32 2, i8** %7, i8** %8)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"10-a\00"
@.str.1 = [4 x i8] c"2-b\00"
@__const.t_big_nums.test_case = [2 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0)]
@__const.t_big_nums.expected = [2 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0)]
define void @t_big_nums(i8* nocapture readnone %0) {
%2 = alloca [2 x i8*]
%3 = alloca [2 x i8*]
%4 = bitcast [2 x i8*]* %2 to i8*
%5 = bitcast [2 x i8*]* %3 to i8*
%6 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 0
%7 = getelementptr inbounds [2 x i8*], [2 x i8*]* %3, i64 0, i64 0
%8 = call i32 @assert_test(i32 2, i8** %6, i8** %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SetStateErrorRecovery();
void PolicyErrorRecovery(void) { SetStateErrorRecovery(); }


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

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

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

LLVM IR (-O2):
define void @PolicyErrorRecovery() {
%1 = tail call i32 (...) @SetStateErrorRecovery()
ret void
}
/* Variables and functions */
double cblas_dasum(int const, double const *, int const);
double c_dasum(const int N, const double *X, const int stride) {
  return cblas_dasum(N, X, stride);
}


x86 assembly (clang, -O0):
<c_dasum>:
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 <cblas_dasum@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_dasum>:
jmp    1030 <cblas_dasum@plt>

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

LLVM IR (-O2):
define double @c_dasum(i32 %0, double* %1, i32 %2) {
%4 = tail call double @cblas_dasum(i32 %0, double* %1, i32 %2)
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char const *, char *);
char *strerror(int /*<<< orphan*/);
void perror_exit(const char *str, int code) {
  printf("%s: %s\n", str, strerror(errno));
  exit(code);
}


x86 assembly (clang, -O0):
<perror_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x18(%rbp),%rsi
mov    %rax,%rdx
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<perror_exit>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xeb3(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1030 <printf@plt>
mov    %ebp,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"%s: %s\0A\00"
@errno = global i32 0
define void @perror_exit(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* @errno
%7 = call i8* @strerror(i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %7)
%9 = load i32, i32* %4
%10 = call i32 @exit(i32 %9)
unreachable
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s: %s\0A\00"
@errno = global i32 0
define void @perror_exit(i8* %0, i32 %1) {
%3 = load i32, i32* @errno
%4 = tail call i8* @strerror(i32 %3)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %4)
%6 = tail call i32 @exit(i32 %1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  (void)fprintf(stderr, "usage: find [-H | -L | -P] [-dEhsXx] [-f file] file "
                        "[file ...] [expression]\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [77 x i8] c"usage: find [-H | -L | -P] [-dEhsXx] [-f file] file [file ...] [expression]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [77 x i8] c"usage: find [-H | -L | -P] [-dEhsXx] [-f file] file [file ...] [expression]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ SIGINT;
int /*<<< orphan*/ SIG_DFL;
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ signal(int /*<<< orphan*/, int /*<<< orphan*/);
void signal_handler(int sig) {
  printf("Signal Handler is called %d\n", sig);
  (void)signal(SIGINT, SIG_DFL);
}


x86 assembly (clang, -O0):
<signal_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
mov    0x2e8e(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signal_handler>:
push   %rax
mov    %edi,%esi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
pop    %rax
jmp    1040 <signal@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"Signal Handler is called %d\0A\00"
@SIGINT = global i32 0
@SIG_DFL = global i32 0
define void @signal_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @SIGINT
%6 = load i32, i32* @SIG_DFL
%7 = call i32 @signal(i32 %5, i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"Signal Handler is called %d\0A\00"
@SIGINT = global i32 0
@SIG_DFL = global i32 0
define void @signal_handler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = load i32, i32* @SIGINT
%4 = load i32, i32* @SIG_DFL
%5 = tail call i32 @signal(i32 %3, i32 %4)
ret void
}
long powi(int base, int exp) {
  long result = 1;
  int i;
  for (i = exp; i >= 1; i--) {
    result *= base;
  }
  return result;
}


x86 assembly (clang, -O0):
<powi>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movq   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jl     113d <powi+0x3d>
movslq -0x4(%rbp),%rax
imul   -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1118 <powi+0x18>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<powi>:
test   %esi,%esi
jle    111b <powi+0x1b>
movslq %edi,%rcx
lea    -0x1(%rsi),%eax
mov    %esi,%edx
and    $0x7,%edx
cmp    $0x7,%eax
jae    1121 <powi+0x21>
mov    $0x1,%eax
jmp    1155 <powi+0x55>
mov    $0x1,%eax
ret
and    $0xfffffff8,%esi
mov    $0x1,%eax
nopl   0x0(%rax)
imul   %rcx,%rax
imul   %rcx,%rax
imul   %rcx,%rax
imul   %rcx,%rax
imul   %rcx,%rax
imul   %rcx,%rax
imul   %rcx,%rax
imul   %rcx,%rax
add    $0xfffffff8,%esi
jne    1130 <powi+0x30>
test   %edx,%edx
je     1169 <powi+0x69>
nopl   0x0(%rax)
imul   %rcx,%rax
add    $0xffffffff,%edx
jne    1160 <powi+0x60>
ret

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

LLVM IR (-O2):
define i64 @powi(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %34
4: ; preds = %2
%5 = sext i32 %0 to i64
%6 = add i32 %1, -1
%7 = and i32 %1, 7
%8 = icmp ult i32 %6, 7
br i1 %8, label %24, label %9
9: ; preds = %4
%10 = and i32 %1, -8
br label %11
11: ; preds = %11, %9
%12 = phi i64 [ 1, %9 ], [ %21, %11 ]
%13 = phi i32 [ 0, %9 ], [ %22, %11 ]
%14 = mul nsw i64 %12, %5
%15 = mul nsw i64 %14, %5
%16 = mul nsw i64 %15, %5
%17 = mul nsw i64 %16, %5
%18 = mul nsw i64 %17, %5
%19 = mul nsw i64 %18, %5
%20 = mul nsw i64 %19, %5
%21 = mul nsw i64 %20, %5
%22 = add i32 %13, 8
%23 = icmp eq i32 %22, %10
br i1 %23, label %24, label %11
24: ; preds = %11, %4
%25 = phi i64 [ undef, %4 ], [ %21, %11 ]
%26 = phi i64 [ 1, %4 ], [ %21, %11 ]
%27 = icmp eq i32 %7, 0
br i1 %27, label %34, label %28
28: ; preds = %24, %28
%29 = phi i64 [ %31, %28 ], [ %26, %24 ]
%30 = phi i32 [ %32, %28 ], [ 0, %24 ]
%31 = mul nsw i64 %29, %5
%32 = add i32 %30, 1
%33 = icmp eq i32 %32, %7
br i1 %33, label %34, label %28
34: ; preds = %24, %28, %2
%35 = phi i64 [ 1, %2 ], [ %25, %24 ], [ %31, %28 ]
ret i64 %35
}
/* Variables and functions */
int /*<<< orphan*/ SHUT_RDWR;
int shutdown(int, int /*<<< orphan*/);
int sock_shutdown(int *fd) { return shutdown((*fd), SHUT_RDWR); }


x86 assembly (clang, -O0):
<sock_shutdown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    0x2ec7(%rip),%rax
mov    (%rax),%esi
call   1030 <shutdown@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sock_shutdown>:
mov    (%rdi),%edi
mov    0x2ed7(%rip),%rax
mov    (%rax),%esi
jmp    1030 <shutdown@plt>

LLVM IR (-O0):
@SHUT_RDWR = global i32 0
define i32 @sock_shutdown(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = load i32, i32* @SHUT_RDWR
%6 = call i32 @shutdown(i32 %4, i32 %5)
ret i32 %6
}

LLVM IR (-O2):
@SHUT_RDWR = global i32 0
define i32 @sock_shutdown(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = load i32, i32* @SHUT_RDWR
%4 = tail call i32 @shutdown(i32 %2, i32 %3)
ret i32 %4
}
void g_key_file_free() {}


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

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

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

LLVM IR (-O2):
define void @g_key_file_free() {
ret void
}
/* Variables and functions */
int from_gps(int);
int ch_carrier_DCO_phase(int ch) { return (from_gps((ch << 3) + 0x3)); }


x86 assembly (clang, -O0):
<ch_carrier_DCO_phase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
shl    $0x3,%edi
add    $0x3,%edi
call   1030 <from_gps@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ch_carrier_DCO_phase>:
lea    0x3(,%rdi,8),%edi
jmp    1030 <from_gps@plt>

LLVM IR (-O0):
define i32 @ch_carrier_DCO_phase(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 3
%5 = add nsw i32 %4, 3
%6 = call i32 @from_gps(i32 %5)
ret i32 %6
}

LLVM IR (-O2):
define i32 @ch_carrier_DCO_phase(i32 %0) {
%2 = shl i32 %0, 3
%3 = or i32 %2, 3
%4 = tail call i32 @from_gps(i32 %3)
ret i32 %4
}
char *assert_msg_fail() {
  do {
    if (!(0 == 1))
      return "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/marshall/mintest/refs/heads/master/"
             "tests/test_json.c"
             ":"
             "19"
             ": "
             "should_fail";
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<assert_msg_fail>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_msg_fail>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [159 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/marshall/mintest/refs/heads/master/tests/test_json.c:19: should_fail\00"
define i8* @assert_msg_fail() {
%1 = alloca i8*
br label %2
2: ; preds = %0
store i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str, i64 0, i64 0), i8** %1
br label %4
3: ; No predecessors!
store i8* null, i8** %1
br label %4
4: ; preds = %3, %2
%5 = load i8*, i8** %1
ret i8* %5
}

LLVM IR (-O2):
@.str = [159 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/marshall/mintest/refs/heads/master/tests/test_json.c:19: should_fail\00"
define i8* @assert_msg_fail() {
ret i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
char const *calloc(int, int);
const char *string_empty(void) { return calloc(1, 1); }


x86 assembly (clang, -O0):
<string_empty>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%esi
mov    %esi,%edi
call   1030 <calloc@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_empty>:
mov    $0x1,%edi
mov    $0x1,%esi
jmp    1030 <calloc@plt>

LLVM IR (-O0):
define i8* @string_empty() {
%1 = call i8* @calloc(i32 1, i32 1)
ret i8* %1
}

LLVM IR (-O2):
define noalias i8* @string_empty() {
%1 = tail call dereferenceable_or_null(1) i8* @calloc(i32 1, i32 1)
ret i8* %1
}
void get_vec_xyz(const double *x, const double *v, double *vxyz) {
  vxyz[0] = v[0];
  vxyz[1] = v[1];
  vxyz[2] = v[2];
}


x86 assembly (clang, -O0):
<get_vec_xyz>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_vec_xyz>:
movsd  (%rsi),%xmm0
movsd  %xmm0,(%rdx)
movsd  0x8(%rsi),%xmm0
movsd  %xmm0,0x8(%rdx)
movsd  0x10(%rsi),%xmm0
movsd  %xmm0,0x10(%rdx)
ret

LLVM IR (-O0):
define void @get_vec_xyz(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** %5
%8 = getelementptr inbounds double, double* %7, i64 0
%9 = load double, double* %8
%10 = load double*, double** %6
%11 = getelementptr inbounds double, double* %10, i64 0
store double %9, double* %11
%12 = load double*, double** %5
%13 = getelementptr inbounds double, double* %12, i64 1
%14 = load double, double* %13
%15 = load double*, double** %6
%16 = getelementptr inbounds double, double* %15, i64 1
store double %14, double* %16
%17 = load double*, double** %5
%18 = getelementptr inbounds double, double* %17, i64 2
%19 = load double, double* %18
%20 = load double*, double** %6
%21 = getelementptr inbounds double, double* %20, i64 2
store double %19, double* %21
ret void
}

LLVM IR (-O2):
define void @get_vec_xyz(double* nocapture readnone %0, double* nocapture %1, double* nocapture writeonly %2) {
%4 = load double, double* %1
store double %4, double* %2
%5 = getelementptr inbounds double, double* %1, i64 1
%6 = load double, double* %5
%7 = getelementptr inbounds double, double* %2, i64 1
store double %6, double* %7
%8 = getelementptr inbounds double, double* %1, i64 2
%9 = load double, double* %8
%10 = getelementptr inbounds double, double* %2, i64 2
store double %9, double* %10
ret void
}
int nvram_set(const char *name, const char *value) { return 0; }


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

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

LLVM IR (-O0):
define i32 @nvram_set(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret i32 0
}

LLVM IR (-O2):
define i32 @nvram_set(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
void testClosureFFrV(void (*closure)(float, float), float a1, float a2) {
  (*closure)(a1, a2);
}


x86 assembly (clang, -O0):
<testClosureFFrV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testClosureFFrV>:
jmp    *%rdi

LLVM IR (-O0):
define void @testClosureFFrV(void (float, float)* %0, float %1, float %2) {
%4 = alloca void (float, float)*
%5 = alloca float
%6 = alloca float
store void (float, float)* %0, void (float, float)** %4
store float %1, float* %5
store float %2, float* %6
%7 = load void (float, float)*, void (float, float)** %4
%8 = load float, float* %5
%9 = load float, float* %6
ret void
}

LLVM IR (-O2):
define void @testClosureFFrV(void (float, float)* nocapture %0, float %1, float %2) {
tail call void %0(float %1, float %2)
ret void
}
/* Variables and functions */
int mvscanw(int, int, char *, long *);
int l_mvscanw(int y, int x, char *fmt, long *i) {
  return (mvscanw(y, x, fmt, i));
}


x86 assembly (clang, -O0):
<l_mvscanw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1030 <mvscanw@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<l_mvscanw>:
jmp    1030 <mvscanw@plt>

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

LLVM IR (-O2):
define i32 @l_mvscanw(i32 %0, i32 %1, i8* %2, i64* %3) {
%5 = tail call i32 @mvscanw(i32 %0, i32 %1, i8* %2, i64* %3)
ret i32 %5
}
/* Variables and functions */
int toupper(int);
int alphaHash(int ch) {
  ch = toupper(ch);
  if (ch == 'J')
    ch = 'I';
  return ch - 'A';
}


x86 assembly (clang, -O0):
<alphaHash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <toupper@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x4a,-0x4(%rbp)
jne    1137 <alphaHash+0x27>
movl   $0x49,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x41,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alphaHash>:
push   %rax
call   1030 <toupper@plt>
lea    -0x41(%rax),%ecx
cmp    $0x4a,%eax
mov    $0x8,%eax
cmovne %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @alphaHash(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @toupper(i32 %3)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 74
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 73, i32* %2
br label %8
8: ; preds = %7, %1
%9 = load i32, i32* %2
%10 = sub nsw i32 %9, 65
ret i32 %10
}

LLVM IR (-O2):
define i32 @alphaHash(i32 %0) {
%2 = tail call i32 @toupper(i32 %0)
%3 = icmp eq i32 %2, 74
%4 = add nsw i32 %2, -65
%5 = select i1 %3, i32 8, i32 %4
ret i32 %5
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
scalar_t__ stat(char const *, struct stat *);
bool file_exists(const char *path) {
  struct stat statbuf;
  return stat(path, &statbuf) == 0;
}


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

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

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @file_exists(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @stat(i8* %4, %struct.stat* %3)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @file_exists(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
void foo486() {}


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

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

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

LLVM IR (-O2):
define void @foo486() {
ret void
}
int test_imm_2Eint8_reg(signed char val) {
  return ((val) & (0x2E << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_2Eint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0x2e,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_2Eint8_reg>:
test   $0x2e,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_2Eint8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, 46
%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_2Eint8_reg(i8 signext %0) {
%2 = and i8 %0, 46
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}