xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char const *);
void usage(const char *msg) {
  printf("usage: %s", msg);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@.str = [10 x i8] c"usage: %s\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [10 x i8] c"usage: %s\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
unsigned long get_sp(void) {
  __asm__("movl %esp,%eax\n\t"
          "and $0xff000000, %eax");
}


x86 assembly (clang, -O0):
<get_sp>:
push   %rbp
mov    %rsp,%rbp
mov    %esp,%eax
and    $0xff000000,%eax
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_sp>:
mov    %esp,%eax
and    $0xff000000,%eax
ret

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

LLVM IR (-O2):
define i64 @get_sp() {
tail call void asm sideeffect "movl %esp,%eax\0A\09and $$0xff000000, %eax", "~{dirflag},~{fpsr},~{flags}"()
ret i64 undef
}
int isalnum(int ch) {
  return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') ||
         (ch >= '0' && ch <= '9');
}


x86 assembly (clang, -O0):
<isalnum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x41,-0x4(%rbp)
jl     1120 <isalnum+0x20>
mov    $0x1,%al
cmpl   $0x5a,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    1158 <isalnum+0x58>
cmpl   $0x61,-0x4(%rbp)
jl     1139 <isalnum+0x39>
mov    $0x1,%al
cmpl   $0x7a,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    1158 <isalnum+0x58>
xor    %eax,%eax
cmpl   $0x30,-0x4(%rbp)
mov    %al,-0x6(%rbp)
jl     1152 <isalnum+0x52>
cmpl   $0x39,-0x4(%rbp)
setle  %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isalnum>:
mov    %edi,%eax
and    $0xffffffdf,%eax
add    $0xffffffbf,%eax
cmp    $0x1a,%eax
setb   %al
add    $0xffffffd0,%edi
cmp    $0xa,%edi
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @isalnum(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 65
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 90
br i1 %7, label %22, label %8
8: ; preds = %5, %1
%9 = load i32, i32* %2
%10 = icmp sge i32 %9, 97
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp sle i32 %12, 122
br i1 %13, label %22, label %14
14: ; preds = %11, %8
%15 = load i32, i32* %2
%16 = icmp sge i32 %15, 48
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* %2
%19 = icmp sle i32 %18, 57
br label %20
20: ; preds = %17, %14
%21 = phi i1 [ false, %14 ], [ %19, %17 ]
br label %22
22: ; preds = %20, %11, %5
%23 = phi i1 [ true, %11 ], [ true, %5 ], [ %21, %20 ]
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
define i32 @isalnum(i32 %0) {
%2 = and i32 %0, -33
%3 = add i32 %2, -65
%4 = icmp ult i32 %3, 26
%5 = add i32 %0, -48
%6 = icmp ult i32 %5, 10
%7 = or i1 %6, %4
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t rand32(uint32_t *seed) {
  *seed = *seed * 1103515243 + 12345;
  return *seed & 0x7ffffffff;
}


x86 assembly (clang, -O0):
<rand32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x41c64e6b,(%rax),%ecx
add    $0x3039,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
movslq (%rax),%rax
movabs $0x7ffffffff,%rcx
and    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand32>:
imul   $0x41c64e6b,(%rdi),%eax
add    $0x3039,%eax
mov    %eax,(%rdi)
ret

LLVM IR (-O0):
define i32 @rand32(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = mul nsw i32 %4, 1103515243
%6 = add nsw i32 %5, 12345
%7 = load i32*, i32** %2
store i32 %6, i32* %7
%8 = load i32*, i32** %2
%9 = load i32, i32* %8
%10 = sext i32 %9 to i64
%11 = and i64 %10, 34359738367
%12 = trunc i64 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @rand32(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = mul nsw i32 %2, 1103515243
%4 = add nsw i32 %3, 12345
store i32 %4, i32* %0
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ VIM_USER_MemCpy(unsigned char *, unsigned char const *,
                                   unsigned long);
void Avi_MemCpy(unsigned char *pbDest, const unsigned char *pbSrc,
                unsigned long dCount) {
  VIM_USER_MemCpy(pbDest, pbSrc, dCount);
}


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

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

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

LLVM IR (-O2):
define void @Avi_MemCpy(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @VIM_USER_MemCpy(i8* %0, i8* %1, i64 %2)
ret void
}
int decrypt_byte(unsigned long *pkeys, const unsigned long *pcrc_32_tab) {
  unsigned temp;
  temp = ((unsigned)(*(pkeys + 2)) & 0xffff) | 2;
  return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
}


x86 assembly (clang, -O0):
<decrypt_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
and    $0xffff,%eax
or     $0x2,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x14(%rbp),%ecx
xor    $0x1,%ecx
imul   %ecx,%eax
shr    $0x8,%eax
and    $0xff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decrypt_byte>:
mov    $0xfffd,%eax
and    0x10(%rdi),%eax
lea    0x2(%rax),%ecx
xor    $0x3,%eax
imul   %ecx,%eax
movzbl %ah,%eax
ret

LLVM IR (-O0):
define i32 @decrypt_byte(i64* %0, i64* %1) {
%3 = alloca i64*
%4 = alloca i64*
%5 = alloca i32
store i64* %0, i64** %3
store i64* %1, i64** %4
%6 = load i64*, i64** %3
%7 = getelementptr inbounds i64, i64* %6, i64 2
%8 = load i64, i64* %7
%9 = trunc i64 %8 to i32
%10 = and i32 %9, 65535
%11 = or i32 %10, 2
store i32 %11, i32* %5
%12 = load i32, i32* %5
%13 = load i32, i32* %5
%14 = xor i32 %13, 1
%15 = mul i32 %12, %14
%16 = lshr i32 %15, 8
%17 = and i32 %16, 255
ret i32 %17
}

LLVM IR (-O2):
define i32 @decrypt_byte(i64* nocapture %0, i64* nocapture readnone %1) {
%3 = getelementptr inbounds i64, i64* %0, i64 2
%4 = load i64, i64* %3
%5 = trunc i64 %4 to i32
%6 = and i32 %5, 65533
%7 = or i32 %6, 2
%8 = xor i32 %6, 3
%9 = mul nuw i32 %7, %8
%10 = lshr i32 %9, 8
%11 = and i32 %10, 255
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void os_Sleep(int millis) { usleep(millis * 1000); }


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

x86 assembly (clang, -O2):
<os_Sleep>:
imul   $0x3e8,%edi,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @os_Sleep(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 1000
%5 = call i32 @usleep(i32 %4)
ret void
}

LLVM IR (-O2):
define void @os_Sleep(i32 %0) {
%2 = mul nsw i32 %0, 1000
%3 = tail call i32 @usleep(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *malloc(size_t);
scalar_t__ mlock(char *, size_t);
char *alloc_workbuf(size_t size) {
  char *ptr;
  ptr = malloc(size);
  if (ptr == NULL)
    return NULL;
  if (mlock(ptr, size)) {
    free(ptr);
    return NULL;
  }
  return ptr;
}


x86 assembly (clang, -O0):
<alloc_workbuf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1161 <alloc_workbuf+0x31>
movq   $0x0,-0x8(%rbp)
jmp    1196 <alloc_workbuf+0x66>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <mlock@plt>
cmp    $0x0,%rax
je     118e <alloc_workbuf+0x5e>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
jmp    1196 <alloc_workbuf+0x66>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_workbuf>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <malloc@plt>
test   %rax,%rax
je     115c <alloc_workbuf+0x2c>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <mlock@plt>
test   %rax,%rax
je     115e <alloc_workbuf+0x2e>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @alloc_workbuf(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = tail call i64 @mlock(i8* %2, i64 %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @free(i8* %2)
br label %9
9: ; preds = %4, %1, %7
%10 = phi i8* [ null, %7 ], [ null, %1 ], [ %2, %4 ]
ret i8* %10
}
/* Variables and functions */
int /*<<< orphan*/ _fail_eno(int);
void *_ensure_p(int line, void *p) {
  if (p == NULL)
    _fail_eno(line);
  return p;
}


x86 assembly (clang, -O0):
<_ensure_p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1132 <_ensure_p+0x22>
mov    -0x4(%rbp),%edi
call   1030 <_fail_eno@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ensure_p>:
push   %rbx
mov    %rsi,%rbx
test   %rsi,%rsi
jne    111e <_ensure_p+0xe>
call   1030 <_fail_eno@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @_ensure_p(i32 %0, i8* readnone returned %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @_fail_eno(i32 %0)
br label %6
6: ; preds = %4, %2
ret i8* %1
}
/* Variables and functions */
unsigned int __builtin_aarch64_get_fpcr();
void fpcr_getter(void) { unsigned int fpcr = __builtin_aarch64_get_fpcr(); }


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

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

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

LLVM IR (-O2):
define void @fpcr_getter() {
%1 = tail call i32 (...) @__builtin_aarch64_get_fpcr()
ret void
}
int scramble_mbf(char *mbf) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @scramble_mbf(i8* nocapture readnone %0) {
ret i32 0
}
OP(dd, a7) { op_a7(); }


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 <op_a7@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OP>:
xor    %eax,%eax
jmp    1030 <op_a7@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 (...) @op_a7()
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @op_a7()
ret i32 undef
}
int test(int foo) {
  static void *dummy[] = {&&a, &&b};
  goto *((char *)&&b - 2 * (foo < 0));
a:
b:
  return 0;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1f,%eax
mov    %eax,%ecx
add    %rcx,%rcx
lea    0x11(%rip),%rax
sub    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    112e <test+0x2e>
jmp    112a <test+0x2a>
xor    %eax,%eax
pop    %rbp
ret
mov    -0x10(%rbp),%rax
jmp    *%rax

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

LLVM IR (-O0):
@test.dummy = internal global [2 x i8*] [i8* blockaddress(@test, %10), i8* blockaddress(@test, %11)]
define i32 @test(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
%5 = zext i1 %4 to i32
%6 = mul nsw i32 2, %5
%7 = sext i32 %6 to i64
%8 = sub i64 0, %7
%9 = getelementptr inbounds i8, i8* blockaddress(@test, %11), i64 %8
br label %12
10: ; preds = %12
br label %11
11: ; preds = %10, %12, %12
ret i32 0
12: ; preds = %1
%13 = phi i8* [ %9, %1 ]
indirectbr i8* %13, [label %10, label %11, label %11]
}

LLVM IR (-O2):
define i32 @test(i32 %0) {
ret i32 0
}
adr0indreg1(r0, r1, x0, x1, p0, p1) signed char r0, r1;
signed char *p0, *p1;
{
  if ((*((signed char *)10000000)) <= (*p1))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<adr0indreg1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %dil,%sil
mov    %sil,-0x5(%rbp)
mov    %al,-0x6(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    $0x989680,%eax
movsbl (%rax),%eax
mov    -0x20(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jg     1141 <adr0indreg1+0x41>
movl   $0x1,-0x4(%rbp)
jmp    1148 <adr0indreg1+0x48>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adr0indreg1>:
mov    0x989680,%cl
xor    %eax,%eax
cmp    (%r9),%cl
setle  %al
ret

LLVM IR (-O0):
define i32 @adr0indreg1(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4, i8* %5) {
%7 = alloca i32
%8 = alloca i8
%9 = alloca i8
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8*
%14 = trunc i32 %0 to i8
%15 = trunc i32 %1 to i8
store i8 %14, i8* %8
store i8 %15, i8* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i8* %4, i8** %12
store i8* %5, i8** %13
%16 = load i8, i8* inttoptr (i64 10000000 to i8*)
%17 = sext i8 %16 to i32
%18 = load i8*, i8** %13
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp sle i32 %17, %20
br i1 %21, label %22, label %23
22: ; preds = %6
store i32 1, i32* %7
br label %24
23: ; preds = %6
store i32 0, i32* %7
br label %24
24: ; preds = %23, %22
%25 = load i32, i32* %7
ret i32 %25
}

LLVM IR (-O2):
define i32 @adr0indreg1(i32 %0, i32 %1, i32 %2, i32 %3, i8* nocapture readnone %4, i8* nocapture %5) {
%7 = load i8, i8* inttoptr (i64 10000000 to i8*)
%8 = load i8, i8* %5
%9 = icmp sle i8 %7, %8
%10 = zext i1 %9 to i32
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ write(int, unsigned char *, int);
void ft_putchar(char c) { write(1, (unsigned char *)&c, 1); }


x86 assembly (clang, -O0):
<ft_putchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x1,%edx
lea    -0x1(%rbp),%rsi
mov    %edx,%edi
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putchar>:
push   %rax
mov    %dil,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
call   1030 <write@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @ft_putchar(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @write(i32 1, i8* %2, i32 1)
ret void
}

LLVM IR (-O2):
define void @ft_putchar(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @write(i32 1, i8* %2, i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ obsolete();
void seg_create(void) { obsolete(); }


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

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

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

LLVM IR (-O2):
define void @seg_create() {
%1 = tail call i32 (...) @obsolete()
ret void
}
double LAMBDA(double Mu, double alpha) { return -Mu * (2.0 / 3.0 - alpha); }


x86 assembly (clang, -O0):
<LAMBDA>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xece(%rip),%xmm1
subsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<LAMBDA>:
xorpd  0xef8(%rip),%xmm0
movsd  0xf00(%rip),%xmm2
subsd  %xmm1,%xmm2
mulsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @LAMBDA(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 = fneg double %5
%7 = load double, double* %4
%8 = fsub double 0x3FE5555555555555, %7
%9 = fmul double %6, %8
ret double %9
}

LLVM IR (-O2):
define double @LAMBDA(double %0, double %1) {
%3 = fneg double %0
%4 = fsub double 0x3FE5555555555555, %1
%5 = fmul double %4, %3
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void dump(unsigned char *arr, int len) {
  int i;
  for (i = 0; i < len; i++)
    printf("%02x ", arr[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115a <dump+0x4a>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <dump+0x16>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1158 <dump+0x38>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movzbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <dump+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"%02x \00"
define void @dump(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
%15 = tail call i32 @putchar(i32 10)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int find_smallest(int *, int, int);
int /*<<< orphan*/ printf(char *, int);
void main() {
  int a[] = {1, 4, 45, 6, 10, 19};
  int len = sizeof(a) / sizeof(a[0]);
  printf("min len is %d\n", find_smallest(a, len, 51));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x6,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    $0x33,%edx
call   1040 <find_smallest@plt>
mov    %eax,%esi
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xee5(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x6,%esi
mov    $0x33,%edx
call   1040 <find_smallest@plt>
lea    0xec4(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [6 x i32] [i32 1, i32 4, i32 45, i32 6, i32 10, i32 19]
@.str = [15 x i8] c"min len is %d\0A\00"
define void @main() {
%1 = alloca [6 x i32]
%2 = alloca i32
%3 = bitcast [6 x i32]* %1 to i8*
store i32 6, i32* %2
%4 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @find_smallest(i32* %4, i32 %5, i32 51)
%7 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}

LLVM IR (-O2):
@__const.main.a = [6 x i32] [i32 1, i32 4, i32 45, i32 6, i32 10, i32 19]
@.str = [15 x i8] c"min len is %d\0A\00"
define void @main() {
%1 = alloca [6 x i32]
%2 = bitcast [6 x i32]* %1 to i8*
%3 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%4 = call i32 @find_smallest(i32* %3, i32 6, i32 51)
%5 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}
char *rewrite_target(char *target) {
  int i;
  for (i = 0; target[i] != '\0'; ++i) {
    if (target[i] == '?') {
      target[i] = '\0';
    }
  }
  return target;
}


x86 assembly (clang, -O0):
<rewrite_target>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1158 <rewrite_target+0x58>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3f,%eax
jne    1145 <rewrite_target+0x45>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    114a <rewrite_target+0x4a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <rewrite_target+0xf>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rewrite_target>:
mov    %rdi,%rax
mov    %rdi,%rcx
jmp    1117 <rewrite_target+0x17>
nopl   0x0(%rax,%rax,1)
movb   $0x0,(%rcx)
add    $0x1,%rcx
movzbl (%rcx),%edx
cmp    $0x3f,%dl
je     1110 <rewrite_target+0x10>
test   %dl,%dl
jne    1113 <rewrite_target+0x13>
ret

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

LLVM IR (-O2):
define i8* @rewrite_target(i8* returned %0) {
br label %2
2: ; preds = %7, %1
%3 = phi i64 [ %8, %7 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
switch i8 %5, label %7 [
i8 0, label %9
i8 63, label %6
]
6: ; preds = %2
store i8 0, i8* %4
br label %7
7: ; preds = %2, %6
%8 = add nuw i64 %3, 1
br label %2
9: ; preds = %2
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ chronometer_reset();
int /*<<< orphan*/ chronometer_stop();
int /*<<< orphan*/ consolemanager_println(char *);
void shell_program_chrono_stop(int argc __attribute__((__unused__)),
                               char *argv[] __attribute__((__unused__))) {
  chronometer_stop();
  chronometer_reset();
  consolemanager_println("Chronometer stopped and reseted to zero !");
}


x86 assembly (clang, -O0):
<shell_program_chrono_stop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <chronometer_stop@plt>
mov    $0x0,%al
call   1050 <chronometer_reset@plt>
lea    0xeac(%rip),%rdi
call   1030 <consolemanager_println@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shell_program_chrono_stop>:
push   %rax
xor    %eax,%eax
call   1040 <chronometer_stop@plt>
xor    %eax,%eax
call   1050 <chronometer_reset@plt>
lea    0xeba(%rip),%rdi
pop    %rax
jmp    1030 <consolemanager_println@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"Chronometer stopped and reseted to zero !\00"
define void @shell_program_chrono_stop(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (...) @chronometer_stop()
%6 = call i32 (...) @chronometer_reset()
%7 = call i32 @consolemanager_println(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"Chronometer stopped and reseted to zero !\00"
define void @shell_program_chrono_stop(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @chronometer_stop()
%4 = tail call i32 (...) @chronometer_reset()
%5 = tail call i32 @consolemanager_println(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ c;

/* Variables and functions */
scalar_t__ read(int, unsigned char *, int);
int fdgetc(int fd) {
  unsigned char c;
  if (read(fd, &c, sizeof(c)) <= 0)
    return -1;
  return (int)c;
}


x86 assembly (clang, -O0):
<fdgetc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x9(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
cmp    $0x0,%rax
jg     1142 <fdgetc+0x32>
movl   $0xffffffff,-0x4(%rbp)
jmp    1149 <fdgetc+0x39>
movzbl -0x9(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fdgetc>:
push   %rax
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
test   %rax,%rax
movzbl 0x7(%rsp),%ecx
mov    $0xffffffff,%eax
cmovg  %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @fdgetc(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i64 @read(i32 %5, i8* %4, i32 1)
%7 = icmp sle i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 -1, i32* %2
br label %12
9: ; preds = %1
%10 = load i8, i8* %4
%11 = zext i8 %10 to i32
store i32 %11, i32* %2
br label %12
12: ; preds = %9, %8
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @fdgetc(i32 %0) {
%2 = alloca i8
%3 = call i64 @read(i32 %0, i8* %2, i32 1)
%4 = icmp slt i64 %3, 1
%5 = load i8, i8* %2
%6 = zext i8 %5 to i32
%7 = select i1 %4, i32 -1, i32 %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ etchostname();
int /*<<< orphan*/ login();
int /*<<< orphan*/ mount_a();
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  mount_a();
  etchostname();
  printf("Simple Init (s.init) v1 by Sreehari\n");
  login();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <mount_a@plt>
mov    $0x0,%al
call   1060 <etchostname@plt>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <login@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <mount_a@plt>
xor    %eax,%eax
call   1060 <etchostname@plt>
lea    0xeaa(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <login@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Simple Init (s.init) v1 by Sreehari\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (...) @mount_a()
%6 = call i32 (...) @etchostname()
%7 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (...) @login()
ret i32 0
}

LLVM IR (-O2):
@str = [36 x i8] c"Simple Init (s.init) v1 by Sreehari\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @mount_a()
%4 = tail call i32 (...) @etchostname()
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (...) @login()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ IFNAMSIZ;
int /*<<< orphan*/ R_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int is_bridge(char *if_name) {
  char path[32 + IFNAMSIZ];
  sprintf(path, "/sys/class/net/%s/bridge", if_name);
  return (access(path, R_OK) == 0);
}


x86 assembly (clang, -O0):
<is_bridge>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%eax
add    $0x20,%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x20(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdx
lea    0xe9a(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x20(%rbp),%rdi
mov    0x2e62(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_bridge>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
push   %rax
mov    %rdi,%rdx
mov    0x2eb0(%rip),%rax
mov    (%rax),%eax
add    $0x20,%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xeb3(%rip),%rsi
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1030 <access@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
lea    -0x8(%rbp),%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@IFNAMSIZ = global i32 0
@.str = [25 x i8] c"/sys/class/net/%s/bridge\00"
@R_OK = global i32 0
define i32 @is_bridge(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %2
%5 = load i32, i32* @IFNAMSIZ
%6 = add nsw i32 32, %5
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %3
%9 = alloca i8, i64 %7
store i64 %7, i64* %4
%10 = load i8*, i8** %2
%11 = call i32 @sprintf(i8* %9, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i32, i32* @R_OK
%13 = call i64 @access(i8* %9, i32 %12)
%14 = icmp eq i64 %13, 0
%15 = zext i1 %14 to i32
%16 = load i8*, i8** %3
ret i32 %15
}

LLVM IR (-O2):
@IFNAMSIZ = global i32 0
@.str = [25 x i8] c"/sys/class/net/%s/bridge\00"
@R_OK = global i32 0
define i32 @is_bridge(i8* %0) {
%2 = load i32, i32* @IFNAMSIZ
%3 = add nsw i32 %2, 32
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
%6 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %0)
%7 = load i32, i32* @R_OK
%8 = call i64 @access(i8* %5, i32 %7)
%9 = icmp eq i64 %8, 0
%10 = zext i1 %9 to i32
ret i32 %10
}
void *test_pointer_sub(void *a, void *b) { return (long)a - (long)b; }


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

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

LLVM IR (-O0):
define i8* @test_pointer_sub(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = ptrtoint i8* %5 to i64
%7 = load i8*, i8** %4
%8 = ptrtoint i8* %7 to i64
%9 = sub nsw i64 %6, %8
%10 = inttoptr i64 %9 to i8*
ret i8* %10
}

LLVM IR (-O2):
define i8* @test_pointer_sub(i8* %0, i8* %1) {
%3 = ptrtoint i8* %0 to i64
%4 = ptrtoint i8* %1 to i64
%5 = sub nsw i64 %3, %4
%6 = inttoptr i64 %5 to i8*
ret i8* %6
}
int ref1(void) { return 42; }


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

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

LLVM IR (-O0):
define i32 @ref1() {
ret i32 42
}

LLVM IR (-O2):
define i32 @ref1() {
ret i32 42
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
uint32_t CRCResultRead(uint32_t ui32Base, bool bPPResult) {
  ASSERT(ui32Base == 0x44030000);
  if (bPPResult) {
    return ((*((volatile uint32_t *)(ui32Base + 0x00000418))));
  } else {
    return ((*((volatile uint32_t *)(ui32Base + 0x00000410))));
  }
}


x86 assembly (clang, -O0):
<CRCResultRead>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x44030000,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
cmpl   $0x0,-0xc(%rbp)
je     1150 <CRCResultRead+0x40>
mov    -0x8(%rbp),%eax
add    $0x418,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    115f <CRCResultRead+0x4f>
mov    -0x8(%rbp),%eax
add    $0x410,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CRCResultRead>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
cmp    $0x44030000,%ebp
sete   %dil
call   1030 <ASSERT@plt>
xor    %eax,%eax
test   %ebx,%ebx
setne  %al
lea    0x410(,%rax,8),%eax
movslq %ebp,%rcx
mov    (%rax,%rcx,1),%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @CRCResultRead(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 1141047296
%8 = zext i1 %7 to i32
%9 = call i32 @ASSERT(i32 %8)
%10 = load i32, i32* %5
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i32, i32* %4
%14 = add nsw i32 %13, 1048
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i32*
%17 = load volatile i32, i32* %16
store i32 %17, i32* %3
br label %24
18: ; preds = %2
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1040
%21 = sext i32 %20 to i64
%22 = inttoptr i64 %21 to i32*
%23 = load volatile i32, i32* %22
store i32 %23, i32* %3
br label %24
24: ; preds = %18, %12
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @CRCResultRead(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 1141047296
%4 = zext i1 %3 to i32
%5 = tail call i32 @ASSERT(i32 %4)
%6 = icmp eq i32 %1, 0
%7 = select i1 %6, i32 1040, i32 1048
%8 = add nsw i32 %7, %0
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
%11 = load volatile i32, i32* %10
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ init_r(double *, int);
void init_v(double *v, int num) { init_r(v, num); }


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

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

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

LLVM IR (-O2):
define void @init_v(double* %0, i32 %1) {
%3 = tail call i32 @init_r(double* %0, i32 %1)
ret void
}
int Whole(int N) {
  int num;
  num = ((N / 10) * 10);
  return (num);
}


x86 assembly (clang, -O0):
<Whole>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
imul   $0xa,%eax,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Whole>:
movslq %edi,%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @Whole(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sdiv i32 %4, 10
%6 = mul nsw i32 %5, 10
store i32 %6, i32* %3
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
define i32 @Whole(i32 %0) {
%2 = srem i32 %0, 10
%3 = sub i32 %0, %2
ret i32 %3
}
void debugBreak(void) {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ FreeMixSegment(struct MixSegment *);
void free_mix(struct MixSegment *handle) { FreeMixSegment(handle); }


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

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

LLVM IR (-O0):
%struct.MixSegment = type { i32 }
define void @free_mix(%struct.MixSegment* %0) {
%2 = alloca %struct.MixSegment*
store %struct.MixSegment* %0, %struct.MixSegment** %2
%3 = load %struct.MixSegment*, %struct.MixSegment** %2
%4 = call i32 @FreeMixSegment(%struct.MixSegment* %3)
ret void
}

LLVM IR (-O2):
%struct.MixSegment = type { i32 }
define void @free_mix(%struct.MixSegment* %0) {
%2 = tail call i32 @FreeMixSegment(%struct.MixSegment* %0)
ret void
}
int test_imm_B5int64_midword_reg(long long val) {
  return ((val >> 16) & (0xB5 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_B5int64_midword_reg>:
test   $0xb50000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_B5int64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 16
%5 = and i64 %4, 181
%6 = icmp ne i64 %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_B5int64_midword_reg(i64 %0) {
%2 = and i64 %0, 11862016
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int test_span_id_compare(int /*<<< orphan*/, char const *, char const *);
int test_span_id_eq(const char *sa, const char *sb) {
  return test_span_id_compare(0, sa, sb);
}


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

x86 assembly (clang, -O2):
<test_span_id_eq>:
mov    %rsi,%rdx
mov    %rdi,%rsi
xor    %edi,%edi
jmp    1030 <test_span_id_compare@plt>

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

LLVM IR (-O2):
define i32 @test_span_id_eq(i8* %0, i8* %1) {
%3 = tail call i32 @test_span_id_compare(i32 0, i8* %0, i8* %1)
ret i32 %3
}
/* Variables and functions */
int sci_get_chip_id();
int soc_id_is_sc9830iv0(void) {
  return ((sci_get_chip_id() & (0xFFFFFFFF)) == ((0x6b4c5300) & (0xFFFFFFFF)));
}


x86 assembly (clang, -O0):
<soc_id_is_sc9830iv0>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <sci_get_chip_id@plt>
and    $0xffffffff,%eax
cmp    $0x6b4c5300,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<soc_id_is_sc9830iv0>:
push   %rax
xor    %eax,%eax
call   1030 <sci_get_chip_id@plt>
xor    %ecx,%ecx
cmp    $0x6b4c5300,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @soc_id_is_sc9830iv0() {
%1 = call i32 (...) @sci_get_chip_id()
%2 = and i32 %1, -1
%3 = icmp eq i32 %2, 1800164096
%4 = zext i1 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @soc_id_is_sc9830iv0() {
%1 = tail call i32 (...) @sci_get_chip_id()
%2 = icmp eq i32 %1, 1800164096
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *, char *);
void warning(char *line) { printf("%s%%%s : %s\n", "\e[31m", "\e[0m", line); }


x86 assembly (clang, -O0):
<warning>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
lea    0xed9(%rip),%rdi
lea    0xedf(%rip),%rsi
lea    0xede(%rip),%rdx
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [13 x i8] c"%s%%%s : %s\0A\00"
@.str.1 = [6 x i8] c"\1B[31m\00"
@.str.2 = [5 x i8] c"\1B[0m\00"
define void @warning(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ init_genrand(int);
int time(int /*<<< orphan*/ *);
void mtrand_init() {
  int seed = time(NULL);
  init_genrand(seed);
}


x86 assembly (clang, -O0):
<mtrand_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <init_genrand@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mtrand_init>:
push   %rax
xor    %edi,%edi
call   1030 <time@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <init_genrand@plt>

LLVM IR (-O0):
define void @mtrand_init() {
%1 = alloca i32
%2 = call i32 @time(i32* null)
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @init_genrand(i32 %3)
ret void
}

LLVM IR (-O2):
define void @mtrand_init() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @init_genrand(i32 %1)
ret void
}
void AmiSetQword64ToLe(void *pAddr_p, long long int qwQwordVal_p) {
  long long int *pqwDst;
  pqwDst = (long long int *)pAddr_p;
  *pqwDst = qwQwordVal_p;
}


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

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

LLVM IR (-O0):
define void @AmiSetQword64ToLe(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i64*
store i64* %7, i64** %5
%8 = load i64, i64* %4
%9 = load i64*, i64** %5
store i64 %8, i64* %9
ret void
}

LLVM IR (-O2):
define void @AmiSetQword64ToLe(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ errAbort(char *);
void htmlMemDeath() { errAbort("Out of memory."); }


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"Out of memory.\00"
define void @htmlMemDeath() {
%1 = call i32 @errAbort(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"Out of memory.\00"
define void @htmlMemDeath() {
%1 = tail call i32 @errAbort(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t bits_get_bit_n(uint8_t byte, uint8_t n) { return ((byte >> n) & 0b1); }


x86 assembly (clang, -O0):
<bits_get_bit_n>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bits_get_bit_n>:
mov    %esi,%ecx
mov    %edi,%eax
shr    %cl,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @bits_get_bit_n(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 = load i32, i32* %4
%7 = ashr i32 %5, %6
%8 = and i32 %7, 1
ret i32 %8
}

LLVM IR (-O2):
define i32 @bits_get_bit_n(i32 %0, i32 %1) {
%3 = lshr i32 %0, %1
%4 = and i32 %3, 1
ret i32 %4
}
int wait_for_acknowledgement() { return 100; }


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

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

LLVM IR (-O0):
define i32 @wait_for_acknowledgement() {
ret i32 100
}

LLVM IR (-O2):
define i32 @wait_for_acknowledgement() {
ret i32 100
}