xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void prtab(int nr_tab) {
  int i;
  for (i = 0; i < nr_tab; i++) {
    printf("\t");
  }
}


x86 assembly (clang, -O0):
<prtab>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1148 <prtab+0x38>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <prtab+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prtab>:
push   %rbx
test   %edi,%edi
jle    112f <prtab+0x1f>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x9,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <prtab+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @prtab(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = tail call i32 @putchar(i32 9)
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
int merc_get_type(int class_) {
  if (class_ >= 6017 && class_ <= 6026)
    return 0;
  if (class_ >= 6027 && class_ <= 6036)
    return 1;
  if (class_ >= 6037 && class_ <= 6046)
    return 2;
  return -1;
}


x86 assembly (clang, -O0):
<merc_get_type>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x1781,-0x8(%rbp)
jl     112d <merc_get_type+0x2d>
cmpl   $0x178a,-0x8(%rbp)
jg     112d <merc_get_type+0x2d>
movl   $0x0,-0x4(%rbp)
jmp    1180 <merc_get_type+0x80>
cmpl   $0x178b,-0x8(%rbp)
jl     1153 <merc_get_type+0x53>
cmpl   $0x1794,-0x8(%rbp)
jg     1153 <merc_get_type+0x53>
movl   $0x1,-0x4(%rbp)
jmp    1180 <merc_get_type+0x80>
cmpl   $0x1795,-0x8(%rbp)
jl     1179 <merc_get_type+0x79>
cmpl   $0x179e,-0x8(%rbp)
jg     1179 <merc_get_type+0x79>
movl   $0x2,-0x4(%rbp)
jmp    1180 <merc_get_type+0x80>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<merc_get_type>:
lea    -0x1781(%rdi),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
jb     1131 <merc_get_type+0x31>
lea    -0x178b(%rdi),%ecx
mov    $0x1,%eax
cmp    $0xa,%ecx
jb     1131 <merc_get_type+0x31>
add    $0xffffe86b,%edi
xor    %eax,%eax
cmp    $0xa,%edi
setb   %al
lea    (%rax,%rax,2),%eax
add    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @merc_get_type(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 6017
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 6026
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 0, i32* %2
br label %25
10: ; preds = %6, %1
%11 = load i32, i32* %3
%12 = icmp sge i32 %11, 6027
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = load i32, i32* %3
%15 = icmp sle i32 %14, 6036
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 1, i32* %2
br label %25
17: ; preds = %13, %10
%18 = load i32, i32* %3
%19 = icmp sge i32 %18, 6037
br i1 %19, label %20, label %24
20: ; preds = %17
%21 = load i32, i32* %3
%22 = icmp sle i32 %21, 6046
br i1 %22, label %23, label %24
23: ; preds = %20
store i32 2, i32* %2
br label %25
24: ; preds = %20, %17
store i32 -1, i32* %2
br label %25
25: ; preds = %24, %23, %16, %9
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
define i32 @merc_get_type(i32 %0) {
%2 = add i32 %0, -6017
%3 = icmp ult i32 %2, 10
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = add i32 %0, -6027
%6 = icmp ult i32 %5, 10
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = add i32 %0, -6037
%9 = icmp ult i32 %8, 10
%10 = select i1 %9, i32 2, i32 -1
br label %11
11: ; preds = %7, %4, %1
%12 = phi i32 [ 0, %1 ], [ 1, %4 ], [ %10, %7 ]
ret i32 %12
}
unsigned short t3(unsigned short x) { return --x; }


x86 assembly (clang, -O0):
<t3>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%ax
add    $0xffff,%ax
mov    %ax,-0x2(%rbp)
movzwl %ax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i16 @t3(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = add i16 %3, -1
store i16 %4, i16* %2
ret i16 %4
}

LLVM IR (-O2):
define zeroext i16 @t3(i16 zeroext %0) {
%2 = add i16 %0, -1
ret i16 %2
}
int cmd_up(int argc __attribute__((unused)),
           char **argv __attribute__((unused))) {
  return 4;
}


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

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

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

LLVM IR (-O2):
define i32 @cmd_up(i32 %0, i8** nocapture readnone %1) {
ret i32 4
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t load64(const unsigned char *x) {
  unsigned int i;
  uint64_t r = 0;
  for (i = 0; i < 8; ++i)
    r |= (uint64_t)x[i] << 8 * i;
  return r;
}


x86 assembly (clang, -O0):
<load64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jae    1147 <load64+0x47>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
movzbl (%rax,%rcx,1),%eax
mov    -0xc(%rbp),%ecx
shl    $0x3,%ecx
shl    %cl,%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <load64+0x16>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @load64(i8* nocapture %0) {
ret i32 poison
}
/* Type definitions */
struct rlimit {
  int dummy;
};

/* Variables and functions */
int setrlimit(int, struct rlimit const *);
__attribute__((__weak__, __always___)) int
softboundmpx_setrlimit(int resource, const struct rlimit *rlim) {
  return setrlimit(resource, rlim);
}


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

x86 assembly (clang, -O2):
<softboundmpx_setrlimit>:
jmp    1030 <setrlimit@plt>

LLVM IR (-O0):
%struct.rlimit = type { i32 }
define weak i32 @softboundmpx_setrlimit(i32 %0, %struct.rlimit* %1) {
%3 = alloca i32
%4 = alloca %struct.rlimit*
store i32 %0, i32* %3
store %struct.rlimit* %1, %struct.rlimit** %4
%5 = load i32, i32* %3
%6 = load %struct.rlimit*, %struct.rlimit** %4
%7 = call i32 @setrlimit(i32 %5, %struct.rlimit* %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.rlimit = type { i32 }
define weak i32 @softboundmpx_setrlimit(i32 %0, %struct.rlimit* %1) {
%3 = tail call i32 @setrlimit(i32 %0, %struct.rlimit* %1)
ret i32 %3
}
void instruc_24() {}


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

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

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

LLVM IR (-O2):
define void @instruc_24() {
ret void
}
void __set_bit(long nr, volatile unsigned long *addr) {
  asm volatile("bts %1,%0"
               : "+m"(*(volatile long *)(addr))
               : "Ir"(nr)
               : "memory");
}


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

x86 assembly (clang, -O2):
<__set_bit>:
bts    %rdi,(%rsi)
ret

LLVM IR (-O0):
define void @__set_bit(i64 %0, i64* %1) {
%3 = alloca i64
%4 = alloca i64*
store i64 %0, i64* %3
store i64* %1, i64** %4
%5 = load i64*, i64** %4
%6 = load i64, i64* %3
ret void
}

LLVM IR (-O2):
define void @__set_bit(i64 %0, i64* %1) {
tail call void asm sideeffect "bts $1,$0", "=*m,Ir,*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %1, i64 %0, i64* elementtype(i64) %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ __chk_fail();
scalar_t__ __glibc_unlikely(int);
scalar_t__ memcpy(char *, char *, size_t);
wchar_t *__wmemcpy_chk(wchar_t *s1, const wchar_t *s2, size_t n, size_t ns1) {
  if (__glibc_unlikely(ns1 < n))
    __chk_fail();
  return (wchar_t *)memcpy((char *)s1, (char *)s2, n * sizeof(wchar_t));
}


x86 assembly (clang, -O0):
<__wmemcpy_chk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
setb   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <__glibc_unlikely@plt>
cmp    $0x0,%rax
je     116e <__wmemcpy_chk+0x3e>
mov    $0x0,%al
call   1030 <__chk_fail@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
shl    $0x2,%rdx
call   1040 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__wmemcpy_chk>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %edi,%edi
cmp    %rdx,%rcx
setb   %dil
call   1050 <__glibc_unlikely@plt>
test   %rax,%rax
je     1158 <__wmemcpy_chk+0x28>
xor    %eax,%eax
call   1030 <__chk_fail@plt>
shl    $0x2,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <memcpy@plt>

LLVM IR (-O0):
define i32* @__wmemcpy_chk(i32* %0, i32* %1, i64 %2, i64 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i64
%8 = alloca i64
store i32* %0, i32** %5
store i32* %1, i32** %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%9 = load i64, i64* %8
%10 = load i64, i64* %7
%11 = icmp ult i64 %9, %10
%12 = zext i1 %11 to i32
%13 = call i64 @__glibc_unlikely(i32 %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %4
%16 = call i32 (...) @__chk_fail()
br label %17
17: ; preds = %15, %4
%18 = load i32*, i32** %5
%19 = bitcast i32* %18 to i8*
%20 = load i32*, i32** %6
%21 = bitcast i32* %20 to i8*
%22 = load i64, i64* %7
%23 = mul i64 %22, 4
%24 = call i64 @memcpy(i8* %19, i8* %21, i64 %23)
%25 = inttoptr i64 %24 to i32*
ret i32* %25
}

LLVM IR (-O2):
define i32* @__wmemcpy_chk(i32* %0, i32* %1, i64 %2, i64 %3) {
%5 = icmp ult i64 %3, %2
%6 = zext i1 %5 to i32
%7 = tail call i64 @__glibc_unlikely(i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %4
%10 = tail call i32 (...) @__chk_fail()
br label %11
11: ; preds = %9, %4
%12 = bitcast i32* %0 to i8*
%13 = bitcast i32* %1 to i8*
%14 = shl i64 %2, 2
%15 = tail call i64 @memcpy(i8* %12, i8* %13, i64 %14)
%16 = inttoptr i64 %15 to i32*
ret i32* %16
}
/* Variables and functions */
int testFuncStatementbool1(unsigned int, unsigned int);
int testFuncStatementbool2(unsigned int, unsigned int);
void testFuncCallBool(void) {
  int local1 = 0U;
  int local2 = 0U;
  local1 = testFuncStatementbool1(1U, 0U);
  local2 = testFuncStatementbool2(1U, 0U);
}


x86 assembly (clang, -O0):
<testFuncCallBool>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <testFuncStatementbool1@plt>
mov    %eax,-0x4(%rbp)
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <testFuncStatementbool2@plt>
mov    %eax,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testFuncCallBool>:
push   %rax
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <testFuncStatementbool1@plt>
mov    $0x1,%edi
xor    %esi,%esi
pop    %rax
jmp    1040 <testFuncStatementbool2@plt>

LLVM IR (-O0):
define void @testFuncCallBool() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 @testFuncStatementbool1(i32 1, i32 0)
store i32 %3, i32* %1
%4 = call i32 @testFuncStatementbool2(i32 1, i32 0)
store i32 %4, i32* %2
ret void
}

LLVM IR (-O2):
define void @testFuncCallBool() {
%1 = tail call i32 @testFuncStatementbool1(i32 1, i32 0)
%2 = tail call i32 @testFuncStatementbool2(i32 1, i32 0)
ret void
}
OP(fd, d9) {
  illegal_1();
  op_d9();
}


x86 assembly (clang, -O0):
<OP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <illegal_1@plt>
mov    $0x0,%al
call   1040 <op_d9@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @illegal_1()
%4 = tail call i32 (...) @op_d9()
ret i32 undef
}
/* Type definitions */
struct game_state {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ endwin();
void game_unload(struct game_state *state) { endwin(); }


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

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

LLVM IR (-O0):
%struct.game_state = type { i32 }
define void @game_unload(%struct.game_state* %0) {
%2 = alloca %struct.game_state*
store %struct.game_state* %0, %struct.game_state** %2
%3 = call i32 (...) @endwin()
ret void
}

LLVM IR (-O2):
%struct.game_state = type { i32 }
define void @game_unload(%struct.game_state* nocapture readnone %0) {
%2 = tail call i32 (...) @endwin()
ret void
}
__attribute__((no, noclone)) unsigned __int128 t102_3sub(unsigned short y) {
  unsigned __int128 r;
  if (__builtin_sub_overflow((signed char)(5), y, &r))
    bar();
  return r;
}


x86 assembly (clang, -O0):
<t102_3sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %di,%ax
mov    %ax,-0x12(%rbp)
movzwl -0x12(%rbp),%eax
xor    %ecx,%ecx
mov    %ecx,%r9d
mov    $0x5,%edx
sub    %rax,%rdx
mov    %r9,%rcx
sbb    %rcx,%rcx
mov    %r9,%r8
sbb    %r8,%r8
sbb    %r9,%r9
mov    %r8d,%eax
and    $0x1,%eax
mov    %eax,%esi
mov    %rsi,%rax
neg    %rax
mov    %rax,%rdi
xor    %r9,%rdi
xor    %r8,%rax
or     %rdi,%rax
or     %rsi,%rax
setne  %al
mov    %rdx,-0x30(%rbp)
mov    %rcx,-0x28(%rbp)
test   $0x1,%al
jne    1174 <t102_3sub+0x64>
jmp    117b <t102_3sub+0x6b>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t102_3sub>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%eax
xor    %r14d,%r14d
mov    $0x5,%ebx
sub    %rax,%rbx
sbb    %r14,%r14
cmp    $0x6,%di
jb     1131 <t102_3sub+0x21>
xor    %eax,%eax
call   1030 <bar@plt>
mov    %rbx,%rax
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define { i64, i64 } @t102_3sub(i16 zeroext %0) {
%2 = alloca i128
%3 = alloca i16
%4 = alloca i128
store i16 %0, i16* %3
%5 = load i16, i16* %3
%6 = zext i16 %5 to i129
%7 = call { i129, i1 } @llvm.ssub.with.overflow.i129(i129 5, i129 %6)
%8 = extractvalue { i129, i1 } %7, 1
%9 = extractvalue { i129, i1 } %7, 0
%10 = trunc i129 %9 to i128
%11 = zext i128 %10 to i129
%12 = icmp ne i129 %9, %11
%13 = or i1 %8, %12
store i128 %10, i128* %4
br i1 %13, label %14, label %16
14: ; preds = %1
%15 = call i32 (...) @bar()
br label %16
16: ; preds = %14, %1
%17 = load i128, i128* %4
store i128 %17, i128* %2
%18 = bitcast i128* %2 to { i64, i64 }*
%19 = load { i64, i64 }, { i64, i64 }* %18
ret { i64, i64 } %19
}

LLVM IR (-O2):
define { i64, i64 } @t102_3sub(i16 zeroext %0) {
%2 = zext i16 %0 to i129
%3 = sub nsw i129 5, %2
%4 = icmp ugt i16 %0, 5
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 (...) @bar()
br label %7
7: ; preds = %5, %1
%8 = trunc i129 %3 to i64
%9 = lshr i129 %3, 64
%10 = trunc i129 %9 to i64
%11 = insertvalue { i64, i64 } poison, i64 %8, 0
%12 = insertvalue { i64, i64 } %11, i64 %10, 1
ret { i64, i64 } %12
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_srli_si128(int /*<<< orphan*/, int);
__m128i __mm_srli_si128(__m128i A, int const I) { return _mm_srli_si128(A, 1); }


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

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

LLVM IR (-O0):
define i32 @__mm_srli_si128(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = call i32 @_mm_srli_si128(i32 %5, i32 1)
ret i32 %6
}

LLVM IR (-O2):
define i32 @__mm_srli_si128(i32 %0, i32 %1) {
%3 = tail call i32 @_mm_srli_si128(i32 %0, i32 1)
ret i32 %3
}
int roundint(double x) {
  x += (x >= 0.0 ? 0.5 : -0.5);
  return (int)x;
}


x86 assembly (clang, -O0):
<roundint>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  0xeea(%rip),%xmm3
movsd  0xeea(%rip),%xmm2
xorps  %xmm0,%xmm0
cmplesd %xmm1,%xmm0
movaps %xmm0,%xmm1
andpd  %xmm3,%xmm1
andnpd %xmm2,%xmm0
orpd   %xmm1,%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<roundint>:
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm0
setae  %al
lea    0xeec(%rip),%rcx
addsd  (%rcx,%rax,8),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @roundint(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp oge double %3, 0.000000e+00
%5 = zext i1 %4 to i64
%6 = select i1 %4, double 5.000000e-01, double -5.000000e-01
%7 = load double, double* %2
%8 = fadd double %7, %6
store double %8, double* %2
%9 = load double, double* %2
%10 = fptosi double %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @roundint(double %0) {
%2 = fcmp oge double %0, 0.000000e+00
%3 = select i1 %2, double 5.000000e-01, double -5.000000e-01
%4 = fadd double %3, %0
%5 = fptosi double %4 to i32
ret i32 %5
}
int test_imm_7Fuint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x7F << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_7Fuint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 8323072
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ get_string(char *);
int /*<<< orphan*/ hex2int(int /*<<< orphan*/, int);
int /*<<< orphan*/ l_askNbytes(int /*<<< orphan*/, char *, int /*<<< orphan*/,
                               int);
char *long2str(char *, int /*<<< orphan*/);
char *macjobstime(char *arg) {
  return long2str(arg, hex2int(l_askNbytes(get_string(arg), "59", 0, 8), 8));
}


x86 assembly (clang, -O0):
<macjobstime>:
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   1040 <get_string@plt>
mov    %eax,%edi
lea    0xe9a(%rip),%rsi
xor    %edx,%edx
mov    $0x8,%ecx
call   1030 <l_askNbytes@plt>
mov    %eax,%edi
mov    $0x8,%esi
call   1050 <hex2int@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
call   1060 <long2str@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<macjobstime>:
push   %rbx
mov    %rdi,%rbx
call   1040 <get_string@plt>
lea    0xeb0(%rip),%rsi
mov    %eax,%edi
xor    %edx,%edx
mov    $0x8,%ecx
call   1030 <l_askNbytes@plt>
mov    %eax,%edi
mov    $0x8,%esi
call   1050 <hex2int@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1060 <long2str@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"59\00"
define i8* @macjobstime(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @get_string(i8* %4)
%6 = call i32 @l_askNbytes(i32 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 0, i32 8)
%7 = call i32 @hex2int(i32 %6, i32 8)
%8 = call i8* @long2str(i8* %3, i32 %7)
ret i8* %8
}

LLVM IR (-O2):
@.str = [3 x i8] c"59\00"
define i8* @macjobstime(i8* %0) {
%2 = tail call i32 @get_string(i8* %0)
%3 = tail call i32 @l_askNbytes(i32 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 0, i32 8)
%4 = tail call i32 @hex2int(i32 %3, i32 8)
%5 = tail call i8* @long2str(i8* %0, i32 %4)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main(void) {
  puts(
      "Most good programmers do programming not because they expect to get "
      "paid or get adulation by the public, but because it is fun to program.");
  puts("- Linus Torvalds");
  return (98);
}


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

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

LLVM IR (-O0):
@.str = [139 x i8] c"Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.\00"
@.str.1 = [17 x i8] c"- Linus Torvalds\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @puts(i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
ret i32 98
}

LLVM IR (-O2):
@.str = [139 x i8] c"Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.\00"
@.str.1 = [17 x i8] c"- Linus Torvalds\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([139 x i8], [139 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
ret i32 98
}
/* Variables and functions */
void fill_array(void *dest, size_t len, unsigned char c, unsigned char term) {
  size_t i;
  unsigned char *chars;
  chars = (unsigned char *)dest;
  for (i = 0; i < (len - 1); ++i) {
    chars[i] = c;
  }
  chars[len - 1] = term;
}


x86 assembly (clang, -O0):
<fill_array>:
push   %rbp
mov    %rsp,%rbp
mov    %cl,%al
mov    %dl,%cl
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %cl,-0x11(%rbp)
mov    %al,-0x12(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jae    115a <fill_array+0x5a>
mov    -0x11(%rbp),%dl
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1126 <fill_array+0x26>
mov    -0x12(%rbp),%dl
mov    -0x28(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_array>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
add    $0xffffffffffffffff,%rbx
je     1131 <fill_array+0x21>
movzbl %dl,%esi
mov    %rbp,%rdi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    %r14b,0x0(%rbp,%rbx,1)
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @fill_array(i8* nocapture writeonly %0, i64 %1, i8 zeroext %2, i8 zeroext %3) {
%5 = add i64 %1, -1
%6 = icmp eq i64 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %4
br label %8
8: ; preds = %7, %4
%9 = getelementptr inbounds i8, i8* %0, i64 %5
store i8 %3, i8* %9
ret void
}
const char const *get_enum_value(const char **values, const int e) {
  return values[e];
}


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

x86 assembly (clang, -O2):
<get_enum_value>:
movslq %esi,%rax
mov    (%rdi,%rax,8),%rax
ret

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

LLVM IR (-O2):
define i8* @get_enum_value(i8** nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i8*, i8** %0, i64 %3
%5 = load i8*, i8** %4
ret i8* %5
}
int foo(int x) {
  long long y;
  y = x;
  return y;
}


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

x86 assembly (clang, -O2):
<foo>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
scalar_t__ writeUART(int, unsigned char *);
signed char temp_get(void) {
  return (signed char)writeUART(2, (unsigned char *)"\x080\x037");
}


x86 assembly (clang, -O0):
<temp_get>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
lea    0xee0(%rip),%rsi
call   1030 <writeUART@plt>
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<temp_get>:
push   %rax
lea    0xee8(%rip),%rsi
mov    $0x2,%edi
call   1030 <writeUART@plt>
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"\807\00"
define signext i8 @temp_get() {
%1 = call i64 @writeUART(i32 2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = trunc i64 %1 to i8
ret i8 %2
}

LLVM IR (-O2):
@.str = [3 x i8] c"\807\00"
define signext i8 @temp_get() {
%1 = tail call i64 @writeUART(i32 2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = trunc i64 %1 to i8
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ foo(int);
void quack() { foo(4); }


x86 assembly (clang, -O0):
<quack>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4,%edi
call   1030 <foo@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<quack>:
mov    $0x4,%edi
jmp    1030 <foo@plt>

LLVM IR (-O0):
define void @quack() {
%1 = call i32 @foo(i32 4)
ret void
}

LLVM IR (-O2):
define void @quack() {
%1 = tail call i32 @foo(i32 4)
ret void
}
/* Variables and functions */
char _jstime_isleapyear_since1900(int);
char jstime_isleapyear_since1900(int year) {
  return _jstime_isleapyear_since1900(year);
}


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

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

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

LLVM IR (-O2):
define signext i8 @jstime_isleapyear_since1900(i32 %0) {
%2 = tail call signext i8 @_jstime_isleapyear_since1900(i32 %0)
ret i8 %2
}
char *lltostr(long long value, char *endptr) {
  while (value) {
    *--endptr = '0' + (value % 10);
    value /= 10;
  }
  return endptr;
}


x86 assembly (clang, -O0):
<lltostr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1154 <lltostr+0x54>
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
add    $0x30,%rdx
mov    %dl,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,-0x1(%rax)
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
jmp    110c <lltostr+0xc>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lltostr>:
test   %rdi,%rdi
je     1145 <lltostr+0x45>
movabs $0x6666666666666667,%r8
66 66 66
nop
mov    %rdi,%rax
imul   %r8
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x2,%rdx
add    %rax,%rdx
lea    (%rdx,%rdx,1),%eax
lea    (%rax,%rax,4),%eax
mov    %edi,%ecx
sub    %eax,%ecx
add    $0x30,%cl
mov    %cl,-0x1(%rsi)
add    $0xffffffffffffffff,%rsi
add    $0x9,%rdi
cmp    $0x12,%rdi
mov    %rdx,%rdi
ja     1110 <lltostr+0x10>
mov    %rsi,%rax
ret

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

LLVM IR (-O2):
define i8* @lltostr(i64 %0, i8* writeonly %1) {
%3 = icmp eq i64 %0, 0
br i1 %3, label %14, label %4
4: ; preds = %2, %4
%5 = phi i8* [ %10, %4 ], [ %1, %2 ]
%6 = phi i64 [ %11, %4 ], [ %0, %2 ]
%7 = srem i64 %6, 10
%8 = trunc i64 %7 to i8
%9 = add nsw i8 %8, 48
%10 = getelementptr inbounds i8, i8* %5, i64 -1
store i8 %9, i8* %10
%11 = sdiv i64 %6, 10
%12 = add i64 %6, 9
%13 = icmp ult i64 %12, 19
br i1 %13, label %14, label %4
14: ; preds = %4, %2
%15 = phi i8* [ %1, %2 ], [ %10, %4 ]
ret i8* %15
}
unsigned char f7(unsigned char x, unsigned int y) {
  return (x << y) | (x >> ((-y) & (8 - 1)));
}


x86 assembly (clang, -O0):
<f7>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    %cl,%eax
movzbl -0x1(%rbp),%edx
xor    %ecx,%ecx
sub    -0x8(%rbp),%ecx
and    $0x7,%ecx
sar    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f7>:
mov    %esi,%ecx
mov    %edi,%eax
shl    %cl,%eax
neg    %cl
and    $0x7,%cl
shr    %cl,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define zeroext i8 @f7(i8 zeroext %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 = zext i8 %5 to i32
%7 = load i32, i32* %4
%8 = shl i32 %6, %7
%9 = load i8, i8* %3
%10 = zext i8 %9 to i32
%11 = load i32, i32* %4
%12 = sub i32 0, %11
%13 = and i32 %12, 7
%14 = ashr i32 %10, %13
%15 = or i32 %8, %14
%16 = trunc i32 %15 to i8
ret i8 %16
}

LLVM IR (-O2):
define zeroext i8 @f7(i8 zeroext %0, i32 %1) {
%3 = zext i8 %0 to i32
%4 = shl i32 %3, %1
%5 = sub i32 0, %1
%6 = and i32 %5, 7
%7 = lshr i32 %3, %6
%8 = or i32 %7, %4
%9 = trunc i32 %8 to i8
ret i8 %9
}
void thread_deinit(void) {}


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

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

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

LLVM IR (-O2):
define void @thread_deinit() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  (void)fprintf(stderr, "usage: primes [-dh] [start [stop]]\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 = [36 x i8] c"usage: primes [-dh] [start [stop]]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [36 x i8] c"usage: primes [-dh] [start [stop]]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ printNum(int /*<<< orphan*/, int, int);
char *itoa(uint32_t a) { printNum(a, 10, 10); }


x86 assembly (clang, -O0):
<itoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <printNum@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<itoa>:
mov    $0xa,%esi
mov    $0xa,%edx
jmp    1030 <printNum@plt>

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

LLVM IR (-O2):
define noalias i8* @itoa(i32 %0) {
%2 = tail call i32 @printNum(i32 %0, i32 10, i32 10)
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ default_isr();
__attribute__((weak)) void CRYPTO_Handler() { default_isr(); }


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

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

LLVM IR (-O0):
define weak void @CRYPTO_Handler() {
%1 = call i32 (...) @default_isr()
ret void
}

LLVM IR (-O2):
define weak void @CRYPTO_Handler() {
%1 = tail call i32 (...) @default_isr()
ret void
}
/* Variables and functions */
float rintf(float);
float __ocl_rint_float(float src) { return rintf(src); }


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

x86 assembly (clang, -O2):
<__ocl_rint_float>:
jmp    1030 <rintf@plt>

LLVM IR (-O0):
define float @__ocl_rint_float(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @llvm.rint.f32(float %3)
ret float %4
}

LLVM IR (-O2):
define float @__ocl_rint_float(float %0) {
%2 = tail call float @llvm.rint.f32(float %0)
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ puts(char *);
void zby_realmachine_notsuitable() {
  puts("\x1b[34m"
       "NOT SUITABLE FOR REALMACHINE"
       "\x1b[0m");
  exit(0);
}


x86 assembly (clang, -O0):
<zby_realmachine_notsuitable>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<zby_realmachine_notsuitable>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"\1B[34mNOT SUITABLE FOR REALMACHINE\1B[0m\00"
define void @zby_realmachine_notsuitable() {
%1 = call i32 @puts(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [38 x i8] c"\1B[34mNOT SUITABLE FOR REALMACHINE\1B[0m\00"
define void @zby_realmachine_notsuitable() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
void w_swap(void **a, void **b) {
  void *temp = *a;
  *a = *b;
  *b = temp;
}


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

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

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

LLVM IR (-O2):
define void @w_swap(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8*, i8** %1
store i8* %4, i8** %0
store i8* %3, i8** %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ kitsune_register_var(char *, char *, char *,
                                        int /*<<< orphan*/, char *, int, int);
int /*<<< orphan*/ printf(char *);
void __kitsune_register_symbols(void) {
  printf("pluginv2: inside kit_reg_symbols, calling kit_reg_var\n");
  kitsune_register_var("buf_num", "ObfuscateIpToText", "pluginv2.c", 0,
                       "pluginv2", 10, 1);
}


x86 assembly (clang, -O0):
<__kitsune_register_symbols>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xefc(%rip),%rdi
lea    0xefd(%rip),%rsi
lea    0xf08(%rip),%rdx
xor    %ecx,%ecx
lea    0xf0a(%rip),%r8
mov    $0xa,%r9d
movl   $0x1,(%rsp)
call   1040 <kitsune_register_var@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__kitsune_register_symbols>:
push   %rax
lea    0xf06(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,(%rsp)
lea    0xec5(%rip),%rdi
lea    0xec6(%rip),%rsi
lea    0xed1(%rip),%rdx
lea    0xed5(%rip),%r8
xor    %ecx,%ecx
mov    $0xa,%r9d
call   1040 <kitsune_register_var@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [55 x i8] c"pluginv2: inside kit_reg_symbols, calling kit_reg_var\0A\00"
@.str.1 = [8 x i8] c"buf_num\00"
@.str.2 = [18 x i8] c"ObfuscateIpToText\00"
@.str.3 = [11 x i8] c"pluginv2.c\00"
@.str.4 = [9 x i8] c"pluginv2\00"
define void @__kitsune_register_symbols() {
%1 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @kitsune_register_var(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 10, i32 1)
ret void
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"buf_num\00"
@.str.2 = [18 x i8] c"ObfuscateIpToText\00"
@.str.3 = [11 x i8] c"pluginv2.c\00"
@.str.4 = [9 x i8] c"pluginv2\00"
@str = [54 x i8] c"pluginv2: inside kit_reg_symbols, calling kit_reg_var\00"
define void @__kitsune_register_symbols() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @kitsune_register_var(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 10, i32 1)
ret void
}
/* Variables and functions */
void *malloc(size_t);
void *_tc_bufalloc(const char *file, int line, size_t size) {
  return malloc(size);
}


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

x86 assembly (clang, -O2):
<_tc_bufalloc>:
mov    %rdx,%rdi
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @_tc_bufalloc(i8* nocapture readnone %0, i32 %1, i64 %2) {
%4 = tail call i8* @malloc(i64 %2)
ret i8* %4
}
/* Variables and functions */
void *realloc(void *, size_t);
void *io_freerealloc(void *p, size_t size) { return realloc(p, size); }


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

x86 assembly (clang, -O2):
<io_freerealloc>:
jmp    1030 <realloc@plt>

LLVM IR (-O0):
define i8* @io_freerealloc(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 i8* @realloc(i8* %5, i64 %6)
ret i8* %7
}

LLVM IR (-O2):
define noalias i8* @io_freerealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
ret i8* %3
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
scalar_t__ S_ISDIR(int /*<<< orphan*/);
scalar_t__ stat(char const *, struct stat *);
int dir_exists(const char *dirname) {
  struct stat finfo;
  return (stat(dirname, &finfo) == 0) && S_ISDIR(finfo.st_mode);
}


x86 assembly (clang, -O0):
<dir_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
jne    115d <dir_exists+0x3d>
mov    -0x10(%rbp),%edi
call   1030 <S_ISDIR@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dir_exists>:
push   %rax
mov    %rsp,%rsi
call   1040 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1135 <dir_exists+0x15>
pop    %rcx
ret
mov    (%rsp),%edi
call   1030 <S_ISDIR@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @dir_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
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%9 = load i32, i32* %8
%10 = call i64 @S_ISDIR(i32 %9)
%11 = icmp ne i64 %10, 0
br label %12
12: ; preds = %7, %1
%13 = phi i1 [ false, %1 ], [ %11, %7 ]
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @dir_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
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = call i64 @S_ISDIR(i32 %8)
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %6, %1
%13 = phi i32 [ 0, %1 ], [ %11, %6 ]
ret i32 %13
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *,
                           char const *, char const *);
void ktest_version(FILE *out) {
  static const char prog_str[] = "ktest";
  static const char ver_str[] = "1.0";
  static const char author_str[] = "Paolo Rovelli";
  fprintf(out, "%s %s written by %s\n", prog_str, ver_str, author_str);
  fflush(out);
  return;
}


x86 assembly (clang, -O0):
<ktest_version>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xee1(%rip),%rsi
lea    0xec2(%rip),%rdx
lea    0xec1(%rip),%rcx
lea    0xebe(%rip),%r8
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ktest_version>:
push   %rbx
mov    %rdi,%rbx
lea    0xeed(%rip),%rsi
lea    0xece(%rip),%rdx
lea    0xecd(%rip),%rcx
lea    0xeca(%rip),%r8
call   1030 <fprintf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@ktest_version.prog_str = internal constant [6 x i8] c"ktest\00"
@ktest_version.ver_str = internal constant [4 x i8] c"1.0\00"
@ktest_version.author_str = internal constant [14 x i8] c"Paolo Rovelli\00"
@.str = [21 x i8] c"%s %s written by %s\0A\00"
define void @ktest_version(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @ktest_version.prog_str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @ktest_version.ver_str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @ktest_version.author_str, i64 0, i64 0))
%5 = load i32*, i32** %2
%6 = call i32 @fflush(i32* %5)
ret void
}

LLVM IR (-O2):
@ktest_version.prog_str = internal constant [6 x i8] c"ktest\00"
@ktest_version.ver_str = internal constant [4 x i8] c"1.0\00"
@ktest_version.author_str = internal constant [14 x i8] c"Paolo Rovelli\00"
@.str = [21 x i8] c"%s %s written by %s\0A\00"
define void @ktest_version(i32* nocapture %0) {
%2 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @ktest_version.prog_str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @ktest_version.ver_str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @ktest_version.author_str, i64 0, i64 0))
%3 = tail call i32 @fflush(i32* %0)
ret void
}