xunge/DecIR huggingface dataset:
char *my_copy(char *dst, const char *src) {
  char *d = dst;
  while (*src != '\0') {
    *d++ = *src++;
  }
  *d = '\0';
  return dst;
}


x86 assembly (clang, -O0):
<my_copy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     114b <my_copy+0x4b>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    1114 <my_copy+0x14>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_copy>:
mov    %rdi,%rax
mov    (%rsi),%cl
mov    %rdi,%rdx
test   %cl,%cl
je     1131 <my_copy+0x31>
add    $0x1,%rsi
mov    %rax,%rdx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %cl,(%rdx)
add    $0x1,%rdx
movzbl (%rsi),%ecx
add    $0x1,%rsi
test   %cl,%cl
jne    1120 <my_copy+0x20>
movb   $0x0,(%rdx)
ret

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

LLVM IR (-O2):
define i8* @my_copy(i8* returned writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %10, %5 ], [ %0, %2 ]
%8 = phi i8* [ %9, %5 ], [ %1, %2 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = getelementptr inbounds i8, i8* %7, i64 1
store i8 %6, i8* %7
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i8* [ %0, %2 ], [ %10, %5 ]
store i8 0, i8* %14
ret i8* %0
}
char *bar() {
  char *data = "hello";
  return data;
}


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"hello\00"
define i8* @bar() {
%1 = alloca i8*
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
ret i8* %2
}

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
define i8* @bar() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
void graphSize(double clientWidth, double clientHeight, double *graphWidth,
               double *graphHeight) {
  *graphWidth = clientWidth - 20 - 20;
  *graphHeight = clientHeight - 20 - 20;
}


x86 assembly (clang, -O0):
<graphSize>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xedd(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xed1(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x10(%rbp),%xmm0
movsd  0xeb8(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xeac(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<graphSize>:
movsd  0xef8(%rip),%xmm2
addsd  %xmm2,%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,(%rdi)
addsd  %xmm2,%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,(%rsi)
ret

LLVM IR (-O0):
define void @graphSize(double %0, double %1, double* %2, double* %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double*
%8 = alloca double*
store double %0, double* %5
store double %1, double* %6
store double* %2, double** %7
store double* %3, double** %8
%9 = load double, double* %5
%10 = fsub double %9, 2.000000e+01
%11 = fsub double %10, 2.000000e+01
%12 = load double*, double** %7
store double %11, double* %12
%13 = load double, double* %6
%14 = fsub double %13, 2.000000e+01
%15 = fsub double %14, 2.000000e+01
%16 = load double*, double** %8
store double %15, double* %16
ret void
}

LLVM IR (-O2):
define void @graphSize(double %0, double %1, double* nocapture writeonly %2, double* nocapture writeonly %3) {
%5 = fadd double %0, -2.000000e+01
%6 = fadd double %5, -2.000000e+01
store double %6, double* %2
%7 = fadd double %1, -2.000000e+01
%8 = fadd double %7, -2.000000e+01
store double %8, double* %3
ret void
}
void cleanup_cpu_mmu_context(void) {}


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

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

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

LLVM IR (-O2):
define void @cleanup_cpu_mmu_context() {
ret void
}
unsigned short imx_ssi_ac97_read(struct snd_ac97 *ac97, unsigned short reg) {}


x86 assembly (clang, -O0):
<imx_ssi_ac97_read>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %rdi,-0x10(%rbp)
mov    %ax,-0x12(%rbp)
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.snd_ac97 = type opaque
define zeroext i16 @imx_ssi_ac97_read(%struct.snd_ac97* %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca %struct.snd_ac97*
%5 = alloca i16
store %struct.snd_ac97* %0, %struct.snd_ac97** %4
store i16 %1, i16* %5
%6 = load i16, i16* %3
ret i16 %6
}

LLVM IR (-O2):
%struct.snd_ac97 = type opaque
define zeroext i16 @imx_ssi_ac97_read(%struct.snd_ac97* nocapture readnone %0, i16 zeroext %1) {
ret i16 undef
}
char firstchar(const char *string) {
  if (string)
    return (string[0]);
  else
    return ('\0');
}


x86 assembly (clang, -O0):
<firstchar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1121 <firstchar+0x21>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x1(%rbp)
jmp    1125 <firstchar+0x25>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<firstchar>:
test   %rdi,%rdi
je     1108 <firstchar+0x8>
mov    (%rdi),%al
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define signext i8 @firstchar(i8* %0) {
%2 = alloca i8
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
store i8 %9, i8* %2
br label %11
10: ; preds = %1
store i8 0, i8* %2
br label %11
11: ; preds = %10, %6
%12 = load i8, i8* %2
ret i8 %12
}

LLVM IR (-O2):
define signext i8 @firstchar(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = load i8, i8* %0
br label %5
5: ; preds = %1, %3
%6 = phi i8 [ %4, %3 ], [ 0, %1 ]
ret i8 %6
}
/* Variables and functions */
int /*<<< orphan*/ log_oom_and_exit();
char *strdup(char const *);
char *xstrdup(const char *s) {
  char *p;
  p = strdup(s);
  if (!p) {
    log_oom_and_exit();
  }
  return p;
}


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114b <xstrdup+0x2b>
mov    $0x0,%al
call   1030 <log_oom_and_exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %rbx
call   1040 <strdup@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1135 <xstrdup+0x15>
xor    %eax,%eax
call   1030 <log_oom_and_exit@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define noalias i8* @xstrdup(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @log_oom_and_exit()
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void disp_usage(void) {
  printf("Usage: client -s <server> -p <server port> -n <nr packets>\n"
         "              -i <nr iterations>\n");
  exit(EXIT_FAILURE);
}


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

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

LLVM IR (-O0):
@.str = [93 x i8] c"Usage: client -s <server> -p <server port> -n <nr packets>\0A -i <nr iterations>\0A\00"
@EXIT_FAILURE = global i32 0
define void @disp_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_FAILURE
%3 = call i32 @exit(i32 %2)
unreachable
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@str = [92 x i8] c"Usage: client -s <server> -p <server port> -n <nr packets>\0A -i <nr iterations>\00"
define void @disp_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([92 x i8], [92 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_FAILURE
%3 = tail call i32 @exit(i32 %2)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_tagstruct_put_volume() {
  printf("NOT IMPLEMENTED:"
         "pa_tagstruct_put_volume"
         "\n");
}


x86 assembly (clang, -O0):
<pa_tagstruct_put_volume>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [41 x i8] c"NOT IMPLEMENTED:pa_tagstruct_put_volume\0A\00"
define i32 @pa_tagstruct_put_volume() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [40 x i8] c"NOT IMPLEMENTED:pa_tagstruct_put_volume\00"
define i32 @pa_tagstruct_put_volume() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ emit_andimm(int, int, int);
int /*<<< orphan*/ emit_cmpimm(int, int /*<<< orphan*/);
int /*<<< orphan*/ emit_orrgt_imm(int, int, int);
void emit_cmppl(int s, int sr, int temp) {
  assert(temp >= 0);
  emit_andimm(sr, ~1, sr);
  emit_cmpimm(s, 0);
  emit_orrgt_imm(sr, 1, sr);
}


x86 assembly (clang, -O0):
<emit_cmppl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%edx
mov    $0xfffffffe,%esi
call   1050 <emit_andimm@plt>
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1030 <emit_cmpimm@plt>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%edx
mov    $0x1,%esi
call   1060 <emit_orrgt_imm@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_cmppl>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
not    %edx
shr    $0x1f,%edx
mov    %edx,%edi
call   1040 <assert@plt>
mov    %ebx,%edi
mov    $0xfffffffe,%esi
mov    %ebx,%edx
call   1050 <emit_andimm@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   1030 <emit_cmpimm@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <emit_orrgt_imm@plt>

LLVM IR (-O0):
define void @emit_cmppl(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = icmp sge i32 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i32, i32* %5
%12 = load i32, i32* %5
%13 = call i32 @emit_andimm(i32 %11, i32 -2, i32 %12)
%14 = load i32, i32* %4
%15 = call i32 @emit_cmpimm(i32 %14, i32 0)
%16 = load i32, i32* %5
%17 = load i32, i32* %5
%18 = call i32 @emit_orrgt_imm(i32 %16, i32 1, i32 %17)
ret void
}

LLVM IR (-O2):
define void @emit_cmppl(i32 %0, i32 %1, i32 %2) {
%4 = xor i32 %2, -1
%5 = lshr i32 %4, 31
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i32 @emit_andimm(i32 %1, i32 -2, i32 %1)
%8 = tail call i32 @emit_cmpimm(i32 %0, i32 0)
%9 = tail call i32 @emit_orrgt_imm(i32 %1, i32 1, i32 %1)
ret void
}
void hw_sound_mute() {}


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

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

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

LLVM IR (-O2):
define void @hw_sound_mute() {
ret void
}
_Bool chk(unsigned long addr, unsigned long limit, unsigned long size) {
  _Bool ret;
  if (0)
    ret = 0 != (!!(addr > limit - size));
  return 0;
}


x86 assembly (clang, -O0):
<chk>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i1 @chk(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i8
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
ret i1 false
}

LLVM IR (-O2):
define zeroext i1 @chk(i64 %0, i64 %1, i64 %2) {
ret i1 false
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ assume(int);
int main() {
  int i;
  int j;
  i = 0;
  j = 0;
  int n;
  assume(n >= 10000);
  assume(n <= 100000);
  while (i < n) {
    i = i + 1;
    j = j + 2;
  }
  assert(j == n * 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x2710,-0x10(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assume@plt>
cmpl   $0x186a0,-0x10(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assume@plt>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1188 <main+0x68>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    1165 <main+0x45>
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1040 <assume@plt>
mov    $0x1,%edi
call   1040 <assume@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%5 = load i32, i32* %4
%6 = icmp sge i32 %5, 10000
%7 = zext i1 %6 to i32
%8 = call i32 @assume(i32 %7)
%9 = load i32, i32* %4
%10 = icmp sle i32 %9, 100000
%11 = zext i1 %10 to i32
%12 = call i32 @assume(i32 %11)
br label %13
13: ; preds = %17, %0
%14 = load i32, i32* %2
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 2
store i32 %21, i32* %3
br label %13
22: ; preds = %13
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = mul nsw i32 %24, 2
%26 = icmp eq i32 %23, %25
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assume(i32 1)
%2 = tail call i32 @assume(i32 1)
%3 = tail call i32 @assert(i32 1)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ GLbitfield;

/* Variables and functions */
int /*<<< orphan*/ glPushAttrib(int /*<<< orphan*/);
void PushAttrib(GLbitfield mask) { glPushAttrib(mask); }


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

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

LLVM IR (-O0):
define void @PushAttrib(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @glPushAttrib(i32 %3)
ret void
}

LLVM IR (-O2):
define void @PushAttrib(i32 %0) {
%2 = tail call i32 @glPushAttrib(i32 %0)
ret void
}
void _exit(int val) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<_exit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
jmp    1107 <_exit+0x7>

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

LLVM IR (-O0):
define void @_exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %1, %3
br label %3
}

LLVM IR (-O2):
define void @_exit(i32 %0) {
br label %2
2: ; preds = %1, %2
br label %2
}
/* Type definitions */
typedef scalar_t__ int32_t;

/* Variables and functions */
int32_t imax(int32_t a, int32_t b) { return a > b ? a : b; }


x86 assembly (clang, -O0):
<imax>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jle    1127 <imax+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <imax+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<imax>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovg  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @imax(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp sgt i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64, i64* %3
br label %12
10: ; preds = %2
%11 = load i64, i64* %4
br label %12
12: ; preds = %10, %8
%13 = phi i64 [ %9, %8 ], [ %11, %10 ]
ret i64 %13
}

LLVM IR (-O2):
define i64 @imax(i64 %0, i64 %1) {
%3 = icmp sgt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void print_error(const char *reason) {
  fprintf(stderr, "\n    Return from NEWUOA because %s.\n", reason);
}


x86 assembly (clang, -O0):
<print_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_error>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [37 x i8] c"\0A Return from NEWUOA because %s.\0A\00"
define void @print_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [37 x i8] c"\0A Return from NEWUOA because %s.\0A\00"
define void @print_error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ puts(char *);
void usage(void) {
  puts("Usage: numtrie lookupfile number");
  exit(1);
}


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

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

LLVM IR (-O0):
@.str = [33 x i8] c"Usage: numtrie lookupfile number\00"
define void @usage() {
%1 = call i32 @puts(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [33 x i8] c"Usage: numtrie lookupfile number\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ Dispose();
int /*<<< orphan*/ Init();
int /*<<< orphan*/ Sender();
int main() {
  Init();
  Sender();
  Dispose();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <Init@plt>
mov    $0x0,%al
call   1050 <Sender@plt>
mov    $0x0,%al
call   1030 <Dispose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <Init@plt>
xor    %eax,%eax
call   1050 <Sender@plt>
xor    %eax,%eax
call   1030 <Dispose@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @Init()
%3 = call i32 (...) @Sender()
%4 = call i32 (...) @Dispose()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @Init()
%2 = tail call i32 (...) @Sender()
%3 = tail call i32 (...) @Dispose()
ret i32 0
}
main() {
  __label__ x;
  void *outer_x = &&x;
  int i = 0;
  {
  x:
    if (i++)
      return 0;
  }
  {
    __label__ x;
    goto x;
    {
    x:
      goto *outer_x;
    }
  }
  {
    __label__ y;
    goto y;
    {
    y:
      goto x;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
lea    0xb(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
je     113b <main+0x3b>
xor    %eax,%eax
pop    %rbp
ret
mov    -0x20(%rbp),%rax
jmp    *%rax
jmp    1140 <main+0x40>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1135 <main+0x35>

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
store i32 0, i32* %1
store i8* blockaddress(@main, %4), i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %14, %0, %9
%5 = load i32, i32* %3
%6 = add nsw i32 %5, 1
store i32 %6, i32* %3
%7 = icmp ne i32 %5, 0
br i1 %7, label %8, label %11
8: ; preds = %4
ret i32 0
9: ; preds = %12
%10 = phi i8* [ %13, %12 ]
indirectbr i8* %10, [label %4]
11: ; preds = %4
br label %12
12: ; preds = %11
%13 = load i8*, i8** %2
br label %9
14: ; No predecessors!
br label %4
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void ivory_serialize_pack_prim_2_be(uint8_t *dst, const uint8_t *src) {
  dst[0] = src[1];
  dst[1] = src[0];
}


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

x86 assembly (clang, -O2):
<ivory_serialize_pack_prim_2_be>:
mov    0x4(%rsi),%eax
mov    %eax,(%rdi)
mov    (%rsi),%eax
mov    %eax,0x4(%rdi)
ret

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

LLVM IR (-O2):
define void @ivory_serialize_pack_prim_2_be(i32* nocapture writeonly %0, i32* nocapture %1) {
%3 = getelementptr inbounds i32, i32* %1, i64 1
%4 = load i32, i32* %3
store i32 %4, i32* %0
%5 = load i32, i32* %1
%6 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %5, i32* %6
ret void
}
short *(wcheck_short_ptr)(short *to_check) { return to_check; }


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

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

LLVM IR (-O0):
define i16* @wcheck_short_ptr(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
ret i16* %3
}

LLVM IR (-O2):
define i16* @wcheck_short_ptr(i16* readnone returned %0) {
ret i16* %0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
struct list_head {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ clear_compression_mode_pg(struct list_head *);
uint8_t clear_3592_comp(struct list_head *m) {
  ;
  return clear_compression_mode_pg(m);
}


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

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

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

LLVM IR (-O2):
%struct.list_head = type { i32 }
define i32 @clear_3592_comp(%struct.list_head* %0) {
%2 = tail call i32 @clear_compression_mode_pg(%struct.list_head* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ factorial(unsigned int);
int /*<<< orphan*/ printf(char *, unsigned int, int /*<<< orphan*/);
void fig05_18() {
  unsigned int i;
  for (i = 0; i <= 21; ++i) {
    printf("%u! = %I64u\n", i, factorial(i));
  }
}


x86 assembly (clang, -O0):
<fig05_18>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x15,-0x4(%rbp)
ja     1166 <fig05_18+0x46>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <factorial@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <fig05_18+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fig05_18>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xed3(%rip),%r14
nopl   (%rax)
mov    %ebx,%edi
call   1030 <factorial@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    $0x16,%ebx
jne    1130 <fig05_18+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"%u! = %I64u\0A\00"
define void @fig05_18() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %5, %1 ]
%3 = tail call i32 @factorial(i32 %2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3)
%5 = add nuw nsw i32 %2, 1
%6 = icmp eq i32 %5, 22
br i1 %6, label %7, label %1
7: ; preds = %1
ret void
}
int clean(char *word, int size) {
  int i;
  for (i = 0; i < size; i++)
    word[i] = '\0';
  return 1;
}


x86 assembly (clang, -O0):
<clean>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1138 <clean+0x38>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <clean+0x12>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clean>:
test   %esi,%esi
jle    1122 <clean+0x12>
push   %rax
mov    %esi,%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @clean(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 = %15, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %18
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
store i8 0, i8* %14
br label %15
15: ; preds = %10
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 1
store i32 %17, i32* %5
br label %6
18: ; preds = %6
ret i32 1
}

LLVM IR (-O2):
define i32 @clean(i8* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %2
ret i32 1
}
/* Type definitions */
struct gsm0710_context {
  int dummy;
};

/* Variables and functions */
int is_channel_used(struct gsm0710_context *, int);
int gsm0710_is_channel_open(struct gsm0710_context *ctx, int channel) {
  if (channel <= 0 || channel > 63)
    return 0;
  return is_channel_used(ctx, channel);
}


x86 assembly (clang, -O0):
<gsm0710_is_channel_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1133 <gsm0710_is_channel_open+0x23>
cmpl   $0x3f,-0x14(%rbp)
jle    113f <gsm0710_is_channel_open+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    114e <gsm0710_is_channel_open+0x3e>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <is_channel_used@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gsm0710_is_channel_open>:
lea    -0x40(%rsi),%eax
cmp    $0xffffffc1,%eax
jae    111b <gsm0710_is_channel_open+0xb>
xor    %eax,%eax
ret
jmp    1030 <is_channel_used@plt>

LLVM IR (-O0):
%struct.gsm0710_context = type { i32 }
define i32 @gsm0710_is_channel_open(%struct.gsm0710_context* %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.gsm0710_context*
%5 = alloca i32
store %struct.gsm0710_context* %0, %struct.gsm0710_context** %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp sle i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i32, i32* %5
%10 = icmp sgt i32 %9, 63
br i1 %10, label %11, label %12
11: ; preds = %8, %2
store i32 0, i32* %3
br label %16
12: ; preds = %8
%13 = load %struct.gsm0710_context*, %struct.gsm0710_context** %4
%14 = load i32, i32* %5
%15 = call i32 @is_channel_used(%struct.gsm0710_context* %13, i32 %14)
store i32 %15, i32* %3
br label %16
16: ; preds = %12, %11
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
%struct.gsm0710_context = type { i32 }
define i32 @gsm0710_is_channel_open(%struct.gsm0710_context* %0, i32 %1) {
%3 = add i32 %1, -64
%4 = icmp ult i32 %3, -63
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @is_channel_used(%struct.gsm0710_context* %0, i32 %1)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ %6, %5 ], [ 0, %2 ]
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ read_be64(int /*<<< orphan*/ const *);
uint64_t read_at_be64(const void *src, size_t offset) {
  const uint8_t *s = src;
  s += offset;
  return read_be64(s);
}


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

x86 assembly (clang, -O2):
<read_at_be64>:
lea    (%rdi,%rsi,4),%rdi
jmp    1030 <read_be64@plt>

LLVM IR (-O0):
define i32 @read_at_be64(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i32*
store i32* %7, i32** %5
%8 = load i64, i64* %4
%9 = load i32*, i32** %5
%10 = getelementptr inbounds i32, i32* %9, i64 %8
store i32* %10, i32** %5
%11 = load i32*, i32** %5
%12 = call i32 @read_be64(i32* %11)
ret i32 %12
}

LLVM IR (-O2):
define i32 @read_at_be64(i8* %0, i64 %1) {
%3 = bitcast i8* %0 to i32*
%4 = getelementptr inbounds i32, i32* %3, i64 %1
%5 = tail call i32 @read_be64(i32* %4)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ my_putchar(char);
void my_putstr(char *str) {
  int n;
  n = 0;
  while (str[n] != '\0') {
    my_putchar(str[n]);
    n = n + 1;
  }
}


x86 assembly (clang, -O0):
<my_putstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
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     1157 <my_putstr+0x47>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <my_putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <my_putstr+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_putstr>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <my_putstr+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <my_putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <my_putstr+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @my_putstr(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 %21
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 = call i32 @my_putchar(i8 signext %17)
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %4
21: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @my_putstr(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8 [ %10, %4 ], [ %2, %1 ]
%7 = tail call i32 @my_putchar(i8 signext %6)
%8 = add nuw i64 %5, 1
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "Usage: igzip_rand_test [options] [FILES]\n"
                  "  -h          help, print this message\n"
                  "  -l          turn off large input test\n"
                  "  -r <iter>   number of randoms for each test\n"
                  "  -s <seed>   set rand() test seed\n"
                  "  -v          enable verbose test log\n");
  exit(0);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [240 x i8] c"Usage: igzip_rand_test [options] [FILES]\0A -h help, print this message\0A -l turn off large input test\0A -r <iter> number of randoms for each test\0A -s <seed> set rand() test seed\0A -v enable verbose test log\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([240 x i8], [240 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [240 x i8] c"Usage: igzip_rand_test [options] [FILES]\0A -h help, print this message\0A -l turn off large input test\0A -r <iter> number of randoms for each test\0A -s <seed> set rand() test seed\0A -v enable verbose test log\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([240 x i8], [240 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 0)
unreachable
}
int compstr(char *a, char *b) {
  for (; *a == *b && *b; a++, b++)
    ;
  return *a - *b;
}


x86 assembly (clang, -O0):
<compstr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    -0x10(%rbp),%rax
movsbl (%rax),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x11(%rbp)
jne    1137 <compstr+0x37>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1147 <compstr+0x47>
jmp    1169 <compstr+0x69>
jmp    114c <compstr+0x4c>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110c <compstr+0xc>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compstr>:
mov    (%rdi),%al
mov    (%rsi),%cl
cmp    %cl,%al
jne    1134 <compstr+0x34>
test   %cl,%cl
je     1134 <compstr+0x34>
mov    $0x1,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%rdi,%rdx,1),%eax
movzbl (%rsi,%rdx,1),%ecx
cmp    %cl,%al
jne    1134 <compstr+0x34>
add    $0x1,%rdx
test   %cl,%cl
jne    1120 <compstr+0x20>
movsbl %al,%eax
movsbl %cl,%ecx
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @compstr(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = icmp ne i8 %3, %4
%6 = icmp eq i8 %4, 0
%7 = or i1 %5, %6
br i1 %7, label %18, label %8
8: ; preds = %2, %8
%9 = phi i8* [ %12, %8 ], [ %1, %2 ]
%10 = phi i8* [ %11, %8 ], [ %0, %2 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = getelementptr inbounds i8, i8* %9, i64 1
%13 = load i8, i8* %11
%14 = load i8, i8* %12
%15 = icmp ne i8 %13, %14
%16 = icmp eq i8 %14, 0
%17 = or i1 %15, %16
br i1 %17, label %18, label %8
18: ; preds = %8, %2
%19 = phi i8 [ %3, %2 ], [ %13, %8 ]
%20 = phi i8 [ %4, %2 ], [ %14, %8 ]
%21 = sext i8 %19 to i32
%22 = sext i8 %20 to i32
%23 = sub nsw i32 %21, %22
ret i32 %23
}
void v2s_(vec) short vec[2];
{
  float v[2];
  v[0] = vec[0];
  v[1] = vec[1];
  vcall(v, 2);
}


x86 assembly (clang, -O0):
<v2s_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movswl 0x2(%rax),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0xc(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1030 <vcall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<v2s_>:
push   %rax
movswl (%rdi),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,(%rsp)
movswl 0x2(%rdi),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x4(%rsp)
mov    %rsp,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <vcall@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @v2s_(i16* %0) {
%2 = alloca i16*
%3 = alloca [2 x float]
store i16* %0, i16** %2
%4 = load i16*, i16** %2
%5 = getelementptr inbounds i16, i16* %4, i64 0
%6 = load i16, i16* %5
%7 = sitofp i16 %6 to float
%8 = getelementptr inbounds [2 x float], [2 x float]* %3, i64 0, i64 0
store float %7, float* %8
%9 = load i16*, i16** %2
%10 = getelementptr inbounds i16, i16* %9, i64 1
%11 = load i16, i16* %10
%12 = sitofp i16 %11 to float
%13 = getelementptr inbounds [2 x float], [2 x float]* %3, i64 0, i64 1
store float %12, float* %13
%14 = getelementptr inbounds [2 x float], [2 x float]* %3, i64 0, i64 0
%15 = call i32 (float*, i32, ...) bitcast (i32 (...)* @vcall to i32 (float*, i32, ...)*)(float* %14, i32 2)
ret void
}

LLVM IR (-O2):
define void @v2s_(i16* nocapture %0) {
%2 = alloca [2 x float]
%3 = bitcast [2 x float]* %2 to i8*
%4 = load i16, i16* %0
%5 = sitofp i16 %4 to float
%6 = getelementptr inbounds [2 x float], [2 x float]* %2, i64 0, i64 0
store float %5, float* %6
%7 = getelementptr inbounds i16, i16* %0, i64 1
%8 = load i16, i16* %7
%9 = sitofp i16 %8 to float
%10 = getelementptr inbounds [2 x float], [2 x float]* %2, i64 0, i64 1
store float %9, float* %10
%11 = call i32 (float*, i32, ...) bitcast (i32 (...)* @vcall to i32 (float*, i32, ...)*)(float* %6, i32 2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ kernel32_exit();
void win32_utf8_exit(void) { kernel32_exit(); }


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

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

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

LLVM IR (-O2):
define void @win32_utf8_exit() {
%1 = tail call i32 (...) @kernel32_exit()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "usage: filegen [-rvVS] [-f maxfilesiz] [-i interval] [-p "
                  "prefix] [-s seed]\n"
                  "               [-t totalbytes] directory\n");
  exit(1);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [117 x i8] c"usage: filegen [-rvVS] [-f maxfilesiz] [-i interval] [-p prefix] [-s seed]\0A [-t totalbytes] directory\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([117 x i8], [117 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [117 x i8] c"usage: filegen [-rvVS] [-f maxfilesiz] [-i interval] [-p prefix] [-s seed]\0A [-t totalbytes] directory\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([117 x i8], [117 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ rc4_nextkey();
void rc4_crypt(unsigned char *stream, int len) {
  while (len--)
    *(stream++) ^= rc4_nextkey();
}


x86 assembly (clang, -O0):
<rc4_crypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     1157 <rc4_crypt+0x47>
mov    $0x0,%al
call   1030 <rc4_nextkey@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%ecx
xor    %edx,%ecx
mov    %cl,(%rax)
jmp    111f <rc4_crypt+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rc4_crypt>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
je     1144 <rc4_crypt+0x34>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <rc4_nextkey@plt>
xor    %al,(%r14,%rbx,1)
add    $0x1,%rbx
cmp    %ebx,%r15d
jne    1130 <rc4_crypt+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @rc4_crypt(i8* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %14, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %1, %2 ]
%6 = phi i8* [ %9, %4 ], [ %0, %2 ]
%7 = add nsw i32 %5, -1
%8 = tail call i32 (...) @rc4_nextkey()
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = load i8, i8* %6
%11 = trunc i32 %8 to i8
%12 = xor i8 %10, %11
store i8 %12, i8* %6
%13 = icmp eq i32 %7, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %2
ret void
}
void rcu_preempt_check_callbacks(void) {}


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

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

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

LLVM IR (-O2):
define void @rcu_preempt_check_callbacks() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void pendingFunHeader(const char *reason) {
  printf("  \t\tPending: %s\n", reason);
}


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

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

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

LLVM IR (-O2):
@.str = [17 x i8] c" \09\09Pending: %s\0A\00"
define void @pendingFunHeader(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}