xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint8_t uint32_encode(uint32_t value, uint8_t *p_encoded_data) {
  p_encoded_data[0] = (uint8_t)((value & 0x000000FF) >> 0);
  p_encoded_data[1] = (uint8_t)((value & 0x0000FF00) >> 8);
  p_encoded_data[2] = (uint8_t)((value & 0x00FF0000) >> 16);
  p_encoded_data[3] = (uint8_t)((value & 0xFF000000) >> 24);
  return sizeof(uint32_t);
}


x86 assembly (clang, -O0):
<uint32_encode>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
sar    $0x0,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x4(%rbp),%ecx
and    $0xff0000,%ecx
sar    $0x10,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x4(%rbp),%ecx
and    $0xff000000,%ecx
shr    $0x18,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    $0x4,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uint32_encode>:
mov    %edi,%eax
movzbl %al,%ecx
mov    %ecx,(%rsi)
movzbl %ah,%ecx
mov    %ecx,0x4(%rsi)
mov    %edi,%ecx
shr    $0x10,%ecx
movzbl %cl,%ecx
mov    %ecx,0x8(%rsi)
shr    $0x18,%eax
mov    %eax,0xc(%rsi)
mov    $0x4,%eax
ret

LLVM IR (-O0):
define i32 @uint32_encode(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 = and i32 %5, 255
%7 = ashr i32 %6, 0
%8 = load i32*, i32** %4
%9 = getelementptr inbounds i32, i32* %8, i64 0
store i32 %7, i32* %9
%10 = load i32, i32* %3
%11 = and i32 %10, 65280
%12 = ashr i32 %11, 8
%13 = load i32*, i32** %4
%14 = getelementptr inbounds i32, i32* %13, i64 1
store i32 %12, i32* %14
%15 = load i32, i32* %3
%16 = and i32 %15, 16711680
%17 = ashr i32 %16, 16
%18 = load i32*, i32** %4
%19 = getelementptr inbounds i32, i32* %18, i64 2
store i32 %17, i32* %19
%20 = load i32, i32* %3
%21 = and i32 %20, -16777216
%22 = lshr i32 %21, 24
%23 = load i32*, i32** %4
%24 = getelementptr inbounds i32, i32* %23, i64 3
store i32 %22, i32* %24
ret i32 4
}

LLVM IR (-O2):
define i32 @uint32_encode(i32 %0, i32* nocapture writeonly %1) {
%3 = and i32 %0, 255
store i32 %3, i32* %1
%4 = lshr i32 %0, 8
%5 = and i32 %4, 255
%6 = getelementptr inbounds i32, i32* %1, i64 1
store i32 %5, i32* %6
%7 = lshr i32 %0, 16
%8 = and i32 %7, 255
%9 = getelementptr inbounds i32, i32* %1, i64 2
store i32 %8, i32* %9
%10 = lshr i32 %0, 24
%11 = getelementptr inbounds i32, i32* %1, i64 3
store i32 %10, i32* %11
ret i32 4
}
/* Variables and functions */
int back_width();
unsigned front_width(void) { return back_width(); }


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

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

LLVM IR (-O0):
define i32 @front_width() {
%1 = call i32 (...) @back_width()
ret i32 %1
}

LLVM IR (-O2):
define i32 @front_width() {
%1 = tail call i32 (...) @back_width()
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
size_t kjg_geno_IO_num_ind(FILE *stream) {
  fseek(stream, 0, 0);
  size_t n = 0;
  char c;
  while (1) {
    fscanf(stream, "%c", &c);
    if (c == '\n')
      break;
    n++;
  }
  return (n);
}


x86 assembly (clang, -O0):
<kjg_geno_IO_num_ind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1040 <fseek@plt>
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb4(%rip),%rsi
lea    -0x11(%rbp),%rdx
call   1030 <fscanf@plt>
movsbl -0x11(%rbp),%eax
cmp    $0xa,%eax
jne    1167 <kjg_geno_IO_num_ind+0x47>
jmp    1178 <kjg_geno_IO_num_ind+0x58>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1141 <kjg_geno_IO_num_ind+0x21>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kjg_geno_IO_num_ind>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %esi,%esi
xor    %edx,%edx
call   1040 <fseek@plt>
mov    $0xffffffffffffffff,%rbx
lea    0xebe(%rip),%r15
lea    0x7(%rsp),%r12
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <fscanf@plt>
add    $0x1,%rbx
cmpb   $0xa,0x7(%rsp)
jne    1150 <kjg_geno_IO_num_ind+0x30>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
define i64 @kjg_geno_IO_num_ind(i32* %0) {
%2 = alloca i32*
%3 = alloca i64
%4 = alloca i8
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = call i32 @fseek(i32* %5, i32 0, i32 0)
store i64 0, i64* %3
br label %7
7: ; preds = %1, %14
%8 = load i32*, i32** %2
%9 = call i32 @fscanf(i32* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%10 = load i8, i8* %4
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 10
br i1 %12, label %13, label %14
13: ; preds = %7
br label %17
14: ; preds = %7
%15 = load i64, i64* %3
%16 = add i64 %15, 1
store i64 %16, i64* %3
br label %7
17: ; preds = %13
%18 = load i64, i64* %3
ret i64 %18
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define i64 @kjg_geno_IO_num_ind(i32* nocapture %0) {
%2 = alloca i8
%3 = tail call i32 @fseek(i32* %0, i32 0, i32 0)
br label %4
4: ; preds = %4, %1
%5 = phi i64 [ 0, %1 ], [ %9, %4 ]
%6 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%7 = load i8, i8* %2
%8 = icmp eq i8 %7, 10
%9 = add i64 %5, 1
br i1 %8, label %10, label %4
10: ; preds = %4
ret i64 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ stdout;
int vfwprintf(int /*<<< orphan*/, int /*<<< orphan*/ const *,
              int /*<<< orphan*/);
int vwprintf(const wchar_t *fmt, va_list ap) {
  return vfwprintf(stdout, fmt, ap);
}


x86 assembly (clang, -O0):
<vwprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <vfwprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vwprintf>:
mov    %esi,%edx
mov    %rdi,%rsi
mov    0x2ec4(%rip),%rax
mov    (%rax),%edi
jmp    1030 <vfwprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
define i32 @vwprintf(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* @stdout
%6 = load i32*, i32** %3
%7 = load i32, i32* %4
%8 = call i32 @vfwprintf(i32 %5, i32* %6, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
@stdout = global i32 0
define i32 @vwprintf(i32* %0, i32 %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 @vfwprintf(i32 %3, i32* %0, i32 %1)
ret i32 %4
}
/* Variables and functions */
unsigned int hash_block(unsigned char *, int);
int strlen(void const *);
unsigned int charptr_hash(const void *o) {
  if (!o)
    return 0;
  int l = strlen(o);
  return hash_block((unsigned char *)o, l);
}


x86 assembly (clang, -O0):
<charptr_hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1143 <charptr_hash+0x23>
movl   $0x0,-0x4(%rbp)
jmp    115e <charptr_hash+0x3e>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <hash_block@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<charptr_hash>:
test   %rdi,%rdi
je     1139 <charptr_hash+0x19>
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <hash_block@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @charptr_hash(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = tail call i32 @hash_block(i8* %0, i32 %4)
br label %6
6: ; preds = %1, %3
%7 = phi i32 [ %5, %3 ], [ 0, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ bar();
void foo(int x) {
  if (x == 43 || x == 76 || x == 44 || x == 78 || x == 49 || x == 77 ||
      x == 46 || x == 75 || x == 45 || x == 82)
    bar();
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x2b,-0x4(%rbp)
je     117f <foo+0x6f>
cmpl   $0x4c,-0x4(%rbp)
je     117f <foo+0x6f>
cmpl   $0x2c,-0x4(%rbp)
je     117f <foo+0x6f>
cmpl   $0x4e,-0x4(%rbp)
je     117f <foo+0x6f>
cmpl   $0x31,-0x4(%rbp)
je     117f <foo+0x6f>
cmpl   $0x4d,-0x4(%rbp)
je     117f <foo+0x6f>
cmpl   $0x2e,-0x4(%rbp)
je     117f <foo+0x6f>
cmpl   $0x4b,-0x4(%rbp)
je     117f <foo+0x6f>
cmpl   $0x2d,-0x4(%rbp)
je     117f <foo+0x6f>
cmpl   $0x52,-0x4(%rbp)
jne    1186 <foo+0x76>
mov    $0x0,%al
call   1030 <bar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
add    $0xffffffd5,%edi
cmp    $0x27,%edi
ja     112f <foo+0x1f>
movabs $0x8f0000004f,%rax
bt     %rdi,%rax
jae    112f <foo+0x1f>
xor    %eax,%eax
jmp    1030 <bar@plt>
ret

LLVM IR (-O0):
define void @foo(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 43
br i1 %4, label %32, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 76
br i1 %7, label %32, label %8
8: ; preds = %5
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 44
br i1 %10, label %32, label %11
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 78
br i1 %13, label %32, label %14
14: ; preds = %11
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 49
br i1 %16, label %32, label %17
17: ; preds = %14
%18 = load i32, i32* %2
%19 = icmp eq i32 %18, 77
br i1 %19, label %32, label %20
20: ; preds = %17
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 46
br i1 %22, label %32, label %23
23: ; preds = %20
%24 = load i32, i32* %2
%25 = icmp eq i32 %24, 75
br i1 %25, label %32, label %26
26: ; preds = %23
%27 = load i32, i32* %2
%28 = icmp eq i32 %27, 45
br i1 %28, label %32, label %29
29: ; preds = %26
%30 = load i32, i32* %2
%31 = icmp eq i32 %30, 82
br i1 %31, label %32, label %34
32: ; preds = %29, %26, %23, %20, %17, %14, %11, %8, %5, %1
%33 = call i32 (...) @bar()
br label %34
34: ; preds = %32, %29
ret void
}

LLVM IR (-O2):
define void @foo(i32 %0) {
switch i32 %0, label %4 [
i32 82, label %2
i32 78, label %2
i32 77, label %2
i32 76, label %2
i32 75, label %2
i32 49, label %2
i32 46, label %2
i32 45, label %2
i32 44, label %2
i32 43, label %2
]
2: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1, %1
%3 = tail call i32 (...) @bar()
br label %4
4: ; preds = %1, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, long);
void sosc_port_itos(char *dest, long int port) {
  if (port)
    snprintf(dest, sizeof(char) * 6, "%ld", port);
  else
    *dest = '\0';
}


x86 assembly (clang, -O0):
<sosc_port_itos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1149 <sosc_port_itos+0x39>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x6,%esi
lea    0xec1(%rip),%rdx
call   1030 <snprintf@plt>
jmp    1150 <sosc_port_itos+0x40>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sosc_port_itos>:
test   %rsi,%rsi
je     1129 <sosc_port_itos+0x19>
mov    %rsi,%rcx
lea    0xee1(%rip),%rdx
mov    $0x6,%esi
jmp    1030 <snprintf@plt>
movb   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%ld\00"
define void @sosc_port_itos(i8* %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @snprintf(i8* %0, i32 6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %1)
br label %7
6: ; preds = %2
store i8 0, i8* %0
br label %7
7: ; preds = %6, %4
ret void
}
/* Variables and functions */
void *bar(void *);
int /*<<< orphan*/ foo();
void *thread_second(void *arg) {
  foo();
  return bar(arg);
}


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

x86 assembly (clang, -O2):
<thread_second>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <foo@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <bar@plt>

LLVM IR (-O0):
define i8* @thread_second(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @foo()
%4 = load i8*, i8** %2
%5 = call i8* @bar(i8* %4)
ret i8* %5
}

LLVM IR (-O2):
define i8* @thread_second(i8* %0) {
%2 = tail call i32 (...) @foo()
%3 = tail call i8* @bar(i8* %0)
ret i8* %3
}
float stepf(float x0, float x) { return (x < x0) ? 0 : 1; }


x86 assembly (clang, -O0):
<stepf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0x4(%rbp),%xmm0
mov    $0x1,%eax
xor    %ecx,%ecx
ucomiss %xmm1,%xmm0
cmova  %ecx,%eax
cvtsi2ss %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<stepf>:
cmpnltss %xmm0,%xmm1
movss  0xef3(%rip),%xmm0
andps  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @stepf(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %4
%6 = load float, float* %3
%7 = fcmp olt float %5, %6
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 0, i32 1
%10 = sitofp i32 %9 to float
ret float %10
}

LLVM IR (-O2):
define float @stepf(float %0, float %1) {
%3 = fcmp uge float %1, %0
%4 = uitofp i1 %3 to float
ret float %4
}
__attribute__((hotpatch(0, 0, 0))) int main(void) { return 0; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int myStrlen(char *src) {
  int i = 0;
  while (*(src + i) != '\0') {
    i++;
  }
  return i;
}


x86 assembly (clang, -O0):
<myStrlen>:
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     1132 <myStrlen+0x32>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <myStrlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<myStrlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <myStrlen+0x10>
ret

LLVM IR (-O0):
define i32 @myStrlen(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %12, %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 %15
12: ; preds = %4
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %4
15: ; preds = %4
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @myStrlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
void print(char c) { printf("%c", c); }


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    0xedb(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @print(i8 signext %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ init_initial_rulset();
int /*<<< orphan*/ init_module_table();
int /*<<< orphan*/ init_ruleset_table();
int /*<<< orphan*/ init_system_rulset();
void init_rules() {
  init_ruleset_table();
  init_module_table();
  init_system_rulset();
  init_initial_rulset();
}


x86 assembly (clang, -O0):
<init_rules>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <init_ruleset_table@plt>
mov    $0x0,%al
call   1030 <init_module_table@plt>
mov    $0x0,%al
call   1040 <init_system_rulset@plt>
mov    $0x0,%al
call   1060 <init_initial_rulset@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_rules>:
push   %rax
xor    %eax,%eax
call   1050 <init_ruleset_table@plt>
xor    %eax,%eax
call   1030 <init_module_table@plt>
xor    %eax,%eax
call   1040 <init_system_rulset@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <init_initial_rulset@plt>

LLVM IR (-O0):
define void @init_rules() {
%1 = call i32 (...) @init_ruleset_table()
%2 = call i32 (...) @init_module_table()
%3 = call i32 (...) @init_system_rulset()
%4 = call i32 (...) @init_initial_rulset()
ret void
}

LLVM IR (-O2):
define void @init_rules() {
%1 = tail call i32 (...) @init_ruleset_table()
%2 = tail call i32 (...) @init_module_table()
%3 = tail call i32 (...) @init_system_rulset()
%4 = tail call i32 (...) @init_initial_rulset()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ShowInstruction();
int /*<<< orphan*/ ShowRegisters();
void TraceInstruction(void) {
  ShowRegisters();
  ShowInstruction();
}


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

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

LLVM IR (-O0):
define void @TraceInstruction() {
%1 = call i32 (...) @ShowRegisters()
%2 = call i32 (...) @ShowInstruction()
ret void
}

LLVM IR (-O2):
define void @TraceInstruction() {
%1 = tail call i32 (...) @ShowRegisters()
%2 = tail call i32 (...) @ShowInstruction()
ret void
}
void ccp_changedest(void) {}


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

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

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

LLVM IR (-O2):
define void @ccp_changedest() {
ret void
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef size_t c;
struct TYPE_3__ {
  scalar_t__ meth_data;
};
typedef TYPE_1__ CONF;

/* Variables and functions */
int def_is_number(const CONF *conf, char c) {
  return (((unsigned short *)((conf)->meth_data))[(c)&0xff] & 1);
}


x86 assembly (clang, -O0):
<def_is_number>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl -0x9(%rbp),%ecx
and    $0xff,%ecx
movslq %ecx,%rcx
movzwl (%rax,%rcx,2),%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<def_is_number>:
mov    (%rdi),%rax
movzbl %sil,%ecx
movzwl (%rax,%rcx,2),%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i64 }
define i32 @def_is_number(%struct.TYPE_3__* %0, i8 signext %1) {
%3 = alloca %struct.TYPE_3__*
%4 = alloca i8
store %struct.TYPE_3__* %0, %struct.TYPE_3__** %3
store i8 %1, i8* %4
%5 = load %struct.TYPE_3__*, %struct.TYPE_3__** %3
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 0
%7 = load i64, i64* %6
%8 = inttoptr i64 %7 to i16*
%9 = load i8, i8* %4
%10 = sext i8 %9 to i32
%11 = and i32 %10, 255
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i16, i16* %8, i64 %12
%14 = load i16, i16* %13
%15 = zext i16 %14 to i32
%16 = and i32 %15, 1
ret i32 %16
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i64 }
define i32 @def_is_number(%struct.TYPE_3__* nocapture %0, i8 signext %1) {
%3 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 0
%4 = load i64, i64* %3
%5 = inttoptr i64 %4 to i16*
%6 = zext i8 %1 to i64
%7 = getelementptr inbounds i16, i16* %5, i64 %6
%8 = load i16, i16* %7
%9 = and i16 %8, 1
%10 = zext i16 %9 to i32
ret i32 %10
}
/* Variables and functions */
scalar_t__ pow(int, int);
void linfo_ue(int len, int info, int *value1, int *dummy) {
  *value1 = (int)pow(2, (len / 2)) + info - 1;
}


x86 assembly (clang, -O0):
<linfo_ue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    $0x2,%edi
call   1030 <pow@plt>
mov    %eax,%ecx
add    -0x8(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<linfo_ue>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%ebx
mov    %edi,%esi
shr    $0x1f,%esi
add    %edi,%esi
sar    %esi
mov    $0x2,%edi
call   1030 <pow@plt>
add    %ebx,%eax
add    $0xffffffff,%eax
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @linfo_ue(i32 %0, i32 %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%9 = load i32, i32* %5
%10 = sdiv i32 %9, 2
%11 = call i64 @pow(i32 2, i32 %10)
%12 = trunc i64 %11 to i32
%13 = load i32, i32* %6
%14 = add nsw i32 %12, %13
%15 = sub nsw i32 %14, 1
%16 = load i32*, i32** %7
store i32 %15, i32* %16
ret void
}

LLVM IR (-O2):
define void @linfo_ue(i32 %0, i32 %1, i32* nocapture writeonly %2, i32* nocapture readnone %3) {
%5 = sdiv i32 %0, 2
%6 = tail call i64 @pow(i32 2, i32 %5)
%7 = trunc i64 %6 to i32
%8 = add i32 %1, -1
%9 = add i32 %8, %7
store i32 %9, i32* %2
ret void
}
/* Variables and functions */
scalar_t__ VpuReadReg(int);
int vpu_IsBusy() { return VpuReadReg(0x160) != 0; }


x86 assembly (clang, -O0):
<vpu_IsBusy>:
push   %rbp
mov    %rsp,%rbp
mov    $0x160,%edi
call   1030 <VpuReadReg@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vpu_IsBusy>:
push   %rax
mov    $0x160,%edi
call   1030 <VpuReadReg@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @vpu_IsBusy() {
%1 = call i64 @VpuReadReg(i32 352)
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i32
ret i32 %3
}

LLVM IR (-O2):
define i32 @vpu_IsBusy() {
%1 = tail call i64 @VpuReadReg(i32 352)
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
int main() { return 0.0; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int foo2(void) {
  printf("Foo2\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [5 x i8] c"Foo2\00"
define i32 @foo2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int test_imm_38int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x38 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_38int64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 16
%6 = and i64 %5, 56
%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_38int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 3670016
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int waking_non_zero_interruptible(struct semaphore *sem,
                                  struct task_struct *tsk) {
  long ret, tmp;
  return ret;
}


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

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

LLVM IR (-O0):
%struct.semaphore = type opaque
%struct.task_struct = type opaque
define i32 @waking_non_zero_interruptible(%struct.semaphore* %0, %struct.task_struct* %1) {
%3 = alloca %struct.semaphore*
%4 = alloca %struct.task_struct*
%5 = alloca i64
%6 = alloca i64
store %struct.semaphore* %0, %struct.semaphore** %3
store %struct.task_struct* %1, %struct.task_struct** %4
%7 = load i64, i64* %5
%8 = trunc i64 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
%struct.semaphore = type opaque
%struct.task_struct = type opaque
define i32 @waking_non_zero_interruptible(%struct.semaphore* nocapture readnone %0, %struct.task_struct* nocapture readnone %1) {
ret i32 undef
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
char osmo_bcd2char(uint8_t bcd) {
  if (bcd < 0xa)
    return '0' + bcd;
  else
    return 'A' + (bcd - 0xa);
}


x86 assembly (clang, -O0):
<osmo_bcd2char>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    111f <osmo_bcd2char+0x1f>
mov    -0x8(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x1(%rbp)
jmp    112b <osmo_bcd2char+0x2b>
mov    -0x8(%rbp),%eax
sub    $0xa,%eax
add    $0x41,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<osmo_bcd2char>:
cmp    $0xa,%edi
mov    $0x30,%ecx
mov    $0x37,%eax
cmovl  %ecx,%eax
add    %dil,%al
ret

LLVM IR (-O0):
define signext i8 @osmo_bcd2char(i32 %0) {
%2 = alloca i8
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 10
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %3
%8 = add nsw i32 48, %7
%9 = trunc i32 %8 to i8
store i8 %9, i8* %2
br label %15
10: ; preds = %1
%11 = load i32, i32* %3
%12 = sub nsw i32 %11, 10
%13 = add nsw i32 65, %12
%14 = trunc i32 %13 to i8
store i8 %14, i8* %2
br label %15
15: ; preds = %10, %6
%16 = load i8, i8* %2
ret i8 %16
}

LLVM IR (-O2):
define signext i8 @osmo_bcd2char(i32 %0) {
%2 = icmp slt i32 %0, 10
%3 = trunc i32 %0 to i8
%4 = select i1 %2, i8 48, i8 55
%5 = add i8 %4, %3
ret i8 %5
}
int diff(const int *p, const int *q) {
  int n = p - q;
  return n;
}


x86 assembly (clang, -O0):
<diff>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<diff>:
mov    %rdi,%rax
sub    %rsi,%rax
shr    $0x2,%rax
ret

LLVM IR (-O0):
define i32 @diff(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
%7 = load i32*, i32** %4
%8 = ptrtoint i32* %6 to i64
%9 = ptrtoint i32* %7 to i64
%10 = sub i64 %8, %9
%11 = sdiv exact i64 %10, 4
%12 = trunc i64 %11 to i32
store i32 %12, i32* %5
%13 = load i32, i32* %5
ret i32 %13
}

LLVM IR (-O2):
define i32 @diff(i32* %0, i32* %1) {
%3 = ptrtoint i32* %0 to i64
%4 = ptrtoint i32* %1 to i64
%5 = sub i64 %3, %4
%6 = lshr exact i64 %5, 2
%7 = trunc i64 %6 to i32
ret i32 %7
}
void _XMP_threads_finalize(void) { return; }


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

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

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

LLVM IR (-O2):
define void @_XMP_threads_finalize() {
ret void
}
/* Variables and functions */
scalar_t__ streq(char const *, char const *);
bool xstreq(const char *a, const char *b) {
  return (a == b) || (a && b && streq(a, b));
}


x86 assembly (clang, -O0):
<xstreq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
mov    $0x1,%al
cmp    -0x10(%rbp),%rcx
mov    %al,-0x11(%rbp)
je     1170 <xstreq+0x60>
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x12(%rbp)
je     116a <xstreq+0x5a>
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x12(%rbp)
je     116a <xstreq+0x5a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <streq@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%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):
<xstreq>:
cmp    %rsi,%rdi
je     1137 <xstreq+0x27>
xor    %eax,%eax
test   %rdi,%rdi
je     1136 <xstreq+0x26>
test   %rsi,%rsi
je     1136 <xstreq+0x26>
push   %rax
call   1030 <streq@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
add    $0x8,%rsp
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @xstreq(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 = icmp eq i8* %5, %6
br i1 %7, label %21, label %8
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %19
11: ; preds = %8
%12 = load i8*, i8** %4
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %19
14: ; preds = %11
%15 = load i8*, i8** %3
%16 = load i8*, i8** %4
%17 = call i64 @streq(i8* %15, i8* %16)
%18 = icmp ne i64 %17, 0
br label %19
19: ; preds = %14, %11, %8
%20 = phi i1 [ false, %11 ], [ false, %8 ], [ %18, %14 ]
br label %21
21: ; preds = %19, %2
%22 = phi i1 [ true, %2 ], [ %20, %19 ]
%23 = zext i1 %22 to i32
ret i32 %23
}

LLVM IR (-O2):
define i32 @xstreq(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, %1
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = icmp ne i8* %0, null
%6 = icmp ne i8* %1, null
%7 = and i1 %5, %6
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = tail call i64 @streq(i8* %0, i8* %1)
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %4, %8, %2
%13 = phi i32 [ 1, %2 ], [ 0, %4 ], [ %11, %8 ]
ret i32 %13
}
double mult2_3(double a, double b) { return a * b; }


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

x86 assembly (clang, -O2):
<mult2_3>:
mulsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @mult2_3(double %0, double %1) {
%3 = fmul double %0, %1
ret double %3
}
/* Type definitions */
struct arg_rex {
  int dummy;
};

/* Variables and functions */
struct arg_rex *arg_rexn(char const *, char const *, char const *, char const *,
                         int, int, int, char const *);
struct arg_rex *arg_rex1(const char *shortopts, const char *longopts,
                         const char *pattern, const char *datatype, int flags,
                         const char *glossary) {
  return arg_rexn(shortopts, longopts, pattern, datatype, 1, 1, flags,
                  glossary);
}


x86 assembly (clang, -O0):
<arg_rex1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r10d
mov    -0x30(%rbp),%rax
mov    $0x1,%r9d
mov    %r9d,%r8d
mov    %r10d,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <arg_rexn@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arg_rex1>:
push   %rax
mov    %r9,%rax
mov    %r8d,%r10d
mov    $0x1,%r8d
mov    $0x1,%r9d
push   %rax
push   %r10
call   1030 <arg_rexn@plt>
add    $0x10,%rsp
pop    %rcx
ret

LLVM IR (-O0):
%struct.arg_rex = type { i32 }
define %struct.arg_rex* @arg_rex1(i8* %0, i8* %1, i8* %2, i8* %3, i32 %4, i8* %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i8*
store i8* %0, i8** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i32 %4, i32* %11
store i8* %5, i8** %12
%13 = load i8*, i8** %7
%14 = load i8*, i8** %8
%15 = load i8*, i8** %9
%16 = load i8*, i8** %10
%17 = load i32, i32* %11
%18 = load i8*, i8** %12
%19 = call %struct.arg_rex* @arg_rexn(i8* %13, i8* %14, i8* %15, i8* %16, i32 1, i32 1, i32 %17, i8* %18)
ret %struct.arg_rex* %19
}

LLVM IR (-O2):
%struct.arg_rex = type { i32 }
define %struct.arg_rex* @arg_rex1(i8* %0, i8* %1, i8* %2, i8* %3, i32 %4, i8* %5) {
%7 = tail call %struct.arg_rex* @arg_rexn(i8* %0, i8* %1, i8* %2, i8* %3, i32 1, i32 1, i32 %4, i8* %5)
ret %struct.arg_rex* %7
}
int ev_get_input(int fd, short revents, struct input_event *ev) { return -1; }


x86 assembly (clang, -O0):
<ev_get_input>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %edi,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
mov    %rdx,-0x10(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.input_event = type opaque
define i32 @ev_get_input(i32 %0, i16 signext %1, %struct.input_event* %2) {
%4 = alloca i32
%5 = alloca i16
%6 = alloca %struct.input_event*
store i32 %0, i32* %4
store i16 %1, i16* %5
store %struct.input_event* %2, %struct.input_event** %6
ret i32 -1
}

LLVM IR (-O2):
%struct.input_event = type opaque
define i32 @ev_get_input(i32 %0, i16 signext %1, %struct.input_event* nocapture readnone %2) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ __NR_close;
int syscall(int /*<<< orphan*/, int);
__attribute__((always_)) int _syscall_close(int fd) {
  return syscall(__NR_close, fd);
}


x86 assembly (clang, -O0):
<_syscall_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@__NR_close = global i32 0
define i32 @_syscall_close(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @__NR_close
%4 = load i32, i32* %2
%5 = call i32 @syscall(i32 %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
@__NR_close = global i32 0
define i32 @_syscall_close(i32 %0) {
%2 = load i32, i32* @__NR_close
%3 = tail call i32 @syscall(i32 %2, i32 %0)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
main() { printf("%s", "kiran"); }


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [6 x i8] c"kiran\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int stb__compare(void *, void *);
int stb__dupe_compare(const void *a, const void *b) {
  void *p = *(void **)a;
  void *q = *(void **)b;
  return stb__compare(p, q);
}


x86 assembly (clang, -O0):
<stb__dupe_compare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
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),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <stb__compare@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stb__dupe_compare>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <stb__compare@plt>

LLVM IR (-O0):
define i32 @stb__dupe_compare(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i8**
%9 = load i8*, i8** %8
store i8* %9, i8** %5
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i8**
%12 = load i8*, i8** %11
store i8* %12, i8** %6
%13 = load i8*, i8** %5
%14 = load i8*, i8** %6
%15 = call i32 @stb__compare(i8* %13, i8* %14)
ret i32 %15
}

LLVM IR (-O2):
define i32 @stb__dupe_compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @stb__compare(i8* %4, i8* %6)
ret i32 %7
}
/* Type definitions */
struct flock {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ F_SETLKW;
int /*<<< orphan*/ err(int, char *);
int fcntl(int, int /*<<< orphan*/, struct flock *);
void set_lock(int fd, struct flock lck) {
  int res = fcntl(fd, F_SETLKW, &lck);
  if (res == -1)
    err(1, "lock failed on destination file.");
}


x86 assembly (clang, -O0):
<set_lock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %esi,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdx
call   1030 <fcntl@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0xffffffff,-0x10(%rbp)
jne    1161 <set_lock+0x41>
mov    $0x1,%edi
lea    0xea4(%rip),%rsi
call   1040 <err@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_lock>:
push   %rax
mov    %esi,(%rsp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
call   1030 <fcntl@plt>
cmp    $0xffffffff,%eax
je     113c <set_lock+0x1c>
pop    %rax
ret
lea    0xebd(%rip),%rsi
mov    $0x1,%edi
call   1040 <err@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.flock = type { i32 }
@F_SETLKW = global i32 0
@.str = [33 x i8] c"lock failed on destination file.\00"
define void @set_lock(i32 %0, i32 %1) {
%3 = alloca %struct.flock
%4 = alloca i32
%5 = alloca i32
%6 = getelementptr inbounds %struct.flock, %struct.flock* %3, i32 0, i32 0
store i32 %1, i32* %6
store i32 %0, i32* %4
%7 = load i32, i32* %4
%8 = load i32, i32* @F_SETLKW
%9 = call i32 @fcntl(i32 %7, i32 %8, %struct.flock* %3)
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @err(i32 1, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %2
ret void
}

LLVM IR (-O2):
%struct.flock = type { i32 }
@F_SETLKW = global i32 0
@.str = [33 x i8] c"lock failed on destination file.\00"
define void @set_lock(i32 %0, i32 %1) {
%3 = alloca %struct.flock
%4 = getelementptr inbounds %struct.flock, %struct.flock* %3, i64 0, i32 0
store i32 %1, i32* %4
%5 = load i32, i32* @F_SETLKW
%6 = call i32 @fcntl(i32 %0, i32 %5, %struct.flock* %3)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @err(i32 1, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
ret void
}
int min3(int x, int y, int z) {
  int m;
  if (x < y) {
    m = x;
  } else {
    m = y;
  }
  if (z < m)
    m = z;
  return m;
}


x86 assembly (clang, -O0):
<min3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1124 <min3+0x24>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    112a <min3+0x2a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    113c <min3+0x3c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min3>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
cmp    %edx,%eax
cmovg  %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @min3(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, %1
%5 = select i1 %4, i32 %0, i32 %1
%6 = icmp sgt i32 %5, %2
%7 = select i1 %6, i32 %2, i32 %5
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int pipe(int *);
int /*<<< orphan*/ stderr;
void createPipe(int *pipe_fd) {
  int return_value = pipe(pipe_fd);
  if (return_value == -1) {
    fprintf(stderr, "Unable to create pipe");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<createPipe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <pipe@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1171 <createPipe+0x41>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
lea    0xe9e(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createPipe>:
push   %rax
call   1030 <pipe@plt>
cmp    $0xffffffff,%eax
je     113d <createPipe+0xd>
pop    %rax
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"Unable to create pipe\00"
define void @createPipe(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @pipe(i32* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %1
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"Unable to create pipe\00"
define void @createPipe(i32* %0) {
%2 = tail call i32 @pipe(i32* %0)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret void
}
int compute_tot(char *str) {
  const char comma = ',';
  int count = 0, iter;
  for (iter = 0; str[iter] != '\0'; iter++) {
    if (str[iter] == comma) {
      count++;
    }
  }
  return count++;
}


x86 assembly (clang, -O0):
<compute_tot>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movb   $0x2c,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1160 <compute_tot+0x60>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2c,%eax
jne    114d <compute_tot+0x4d>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1152 <compute_tot+0x52>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    111a <compute_tot+0x1a>
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_tot>:
xor    %eax,%eax
jmp    1117 <compute_tot+0x17>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%eax
add    $0x1,%rdi
movzbl (%rdi),%ecx
cmp    $0x2c,%cl
je     1110 <compute_tot+0x10>
test   %cl,%cl
jne    1113 <compute_tot+0x13>
ret

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

LLVM IR (-O2):
define i32 @compute_tot(i8* nocapture %0) {
br label %2
2: ; preds = %9, %1
%3 = phi i64 [ %11, %9 ], [ 0, %1 ]
%4 = phi i32 [ %10, %9 ], [ 0, %1 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %3
%6 = load i8, i8* %5
switch i8 %6, label %9 [
i8 0, label %12
i8 44, label %7
]
7: ; preds = %2
%8 = add nsw i32 %4, 1
br label %9
9: ; preds = %2, %7
%10 = phi i32 [ %8, %7 ], [ %4, %2 ]
%11 = add nuw i64 %3, 1
br label %2
12: ; preds = %2
ret i32 %4
}