xunge/DecIR huggingface dataset:
void testDelay(void) {
  volatile unsigned int j;
  for (j = 0; j < 30000; j++)
    ;
}


x86 assembly (clang, -O0):
<testDelay>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    $0x7530,%eax
jae    112c <testDelay+0x2c>
jmp    111e <testDelay+0x1e>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <testDelay+0xb>
pop    %rbp
ret

x86 assembly (clang, -O2):
<testDelay>:
movl   $0x0,-0x4(%rsp)
mov    -0x4(%rsp),%eax
cmp    $0x752f,%eax
ja     1130 <testDelay+0x30>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
addl   $0x1,-0x4(%rsp)
mov    -0x4(%rsp),%eax
cmp    $0x7530,%eax
jb     1120 <testDelay+0x20>
ret

LLVM IR (-O0):
define void @testDelay() {
%1 = alloca i32
store volatile i32 0, i32* %1
br label %2
2: ; preds = %6, %0
%3 = load volatile i32, i32* %1
%4 = icmp ult i32 %3, 30000
br i1 %4, label %5, label %9
5: ; preds = %2
br label %6
6: ; preds = %5
%7 = load volatile i32, i32* %1
%8 = add i32 %7, 1
store volatile i32 %8, i32* %1
br label %2
9: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @testDelay() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store volatile i32 0, i32* %1
%3 = load volatile i32, i32* %1
%4 = icmp ult i32 %3, 30000
br i1 %4, label %5, label %10
5: ; preds = %0, %5
%6 = load volatile i32, i32* %1
%7 = add i32 %6, 1
store volatile i32 %7, i32* %1
%8 = load volatile i32, i32* %1
%9 = icmp ult i32 %8, 30000
br i1 %9, label %5, label %10
10: ; preds = %5, %0
ret void
}
/* Variables and functions */
double __nv_asinh(double);
double asinh(double __a) { return __nv_asinh(__a); }


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

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

LLVM IR (-O0):
define double @asinh(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @__nv_asinh(double %3)
ret double %4
}

LLVM IR (-O2):
define double @asinh(double %0) {
%2 = tail call double @__nv_asinh(double %0)
ret double %2
}
/* Variables and functions */
int SNDRV_PCM_HW_PARAM_FIRST_MASK;
int SNDRV_PCM_HW_PARAM_LAST_MASK;
int param_is_mask(int p) {
  return (p >= SNDRV_PCM_HW_PARAM_FIRST_MASK) &&
         (p <= SNDRV_PCM_HW_PARAM_LAST_MASK);
}


x86 assembly (clang, -O0):
<param_is_mask>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
xor    %eax,%eax
mov    0x2ec5(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x5(%rbp)
jl     1130 <param_is_mask+0x30>
mov    -0x4(%rbp),%eax
mov    0x2ec0(%rip),%rcx
cmp    (%rcx),%eax
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<param_is_mask>:
mov    0x2ed1(%rip),%rax
cmp    %edi,(%rax)
setle  %al
mov    0x2ed5(%rip),%rcx
cmp    %edi,(%rcx)
setge  %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
@SNDRV_PCM_HW_PARAM_FIRST_MASK = global i32 0
@SNDRV_PCM_HW_PARAM_LAST_MASK = global i32 0
define i32 @param_is_mask(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SNDRV_PCM_HW_PARAM_FIRST_MASK
%5 = icmp sge i32 %3, %4
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %2
%8 = load i32, i32* @SNDRV_PCM_HW_PARAM_LAST_MASK
%9 = icmp sle i32 %7, %8
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
@SNDRV_PCM_HW_PARAM_FIRST_MASK = global i32 0
@SNDRV_PCM_HW_PARAM_LAST_MASK = global i32 0
define i32 @param_is_mask(i32 %0) {
%2 = load i32, i32* @SNDRV_PCM_HW_PARAM_FIRST_MASK
%3 = icmp sle i32 %2, %0
%4 = load i32, i32* @SNDRV_PCM_HW_PARAM_LAST_MASK
%5 = icmp sge i32 %4, %0
%6 = select i1 %3, i1 %5, i1 false
%7 = zext i1 %6 to i32
ret i32 %7
}
void os_blink_off(void) { *(volatile unsigned int *)0x2020001c = 1 << 16; }


x86 assembly (clang, -O0):
<os_blink_off>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2020001c,%eax
movl   $0x10000,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<os_blink_off>:
movl   $0x10000,0x2020001c
ret

LLVM IR (-O0):
define void @os_blink_off() {
store volatile i32 65536, i32* inttoptr (i64 538968092 to i32*)
ret void
}

LLVM IR (-O2):
define void @os_blink_off() {
store volatile i32 65536, i32* inttoptr (i64 538968092 to i32*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ xil_printf(char *);
void main() {
  xil_printf("Circuits are wonderful!\r\n");
  xil_printf("Embeded Systems is the funest class to ever exist");
  xil_printf("Dr. Hummel is the bestest teacher EVER!!!\r\n");
  xil_printf("Coolest feature is this right here");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <xil_printf@plt>
lea    0xef3(%rip),%rdi
call   1030 <xil_printf@plt>
lea    0xf19(%rip),%rdi
call   1030 <xil_printf@plt>
lea    0xf39(%rip),%rdi
call   1030 <xil_printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <xil_printf@plt>
lea    0xef6(%rip),%rdi
call   1030 <xil_printf@plt>
lea    0xf1c(%rip),%rdi
call   1030 <xil_printf@plt>
lea    0xf3c(%rip),%rdi
pop    %rax
jmp    1030 <xil_printf@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"Circuits are wonderful!\0D\0A\00"
@.str.1 = [50 x i8] c"Embeded Systems is the funest class to ever exist\00"
@.str.2 = [44 x i8] c"Dr. Hummel is the bestest teacher EVER!!!\0D\0A\00"
@.str.3 = [35 x i8] c"Coolest feature is this right here\00"
define void @main() {
%1 = call i32 @xil_printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @xil_printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @xil_printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @xil_printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"Circuits are wonderful!\0D\0A\00"
@.str.1 = [50 x i8] c"Embeded Systems is the funest class to ever exist\00"
@.str.2 = [44 x i8] c"Dr. Hummel is the bestest teacher EVER!!!\0D\0A\00"
@.str.3 = [35 x i8] c"Coolest feature is this right here\00"
define void @main() {
%1 = tail call i32 @xil_printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @xil_printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @xil_printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @xil_printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
ret void
}
int pos(int x, int y, int tamanho) { return x + y * tamanho; }


x86 assembly (clang, -O0):
<pos>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pos>:
imul   %edx,%esi
lea    (%rsi,%rdi,1),%eax
ret

LLVM IR (-O0):
define i32 @pos(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* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = mul nsw i32 %8, %9
%11 = add nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @pos(i32 %0, i32 %1, i32 %2) {
%4 = mul nsw i32 %2, %1
%5 = add nsw i32 %4, %0
ret i32 %5
}
/* Variables and functions */
unsigned short int get_short_le(const char *cp) {
  unsigned short int ret;
  unsigned char *source = (unsigned char *)cp;
  if (NULL == cp)
    return 0;
  ret = *source++;
  ret += ((*source++) << 8);
  return ret;
}


x86 assembly (clang, -O0):
<get_short_le>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    1127 <get_short_le+0x27>
movw   $0x0,-0x2(%rbp)
jmp    1164 <get_short_le+0x64>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movzbl (%rax),%eax
mov    %ax,-0x12(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movzbl (%rax),%ecx
shl    $0x8,%ecx
movzwl -0x12(%rbp),%eax
add    %ecx,%eax
mov    %ax,-0x12(%rbp)
mov    -0x12(%rbp),%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_short_le>:
test   %rdi,%rdi
je     1109 <get_short_le+0x9>
movzwl (%rdi),%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define zeroext i16 @get_short_le(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %0
%6 = load i8, i8* %4
%7 = zext i8 %6 to i16
%8 = shl nuw i16 %7, 8
%9 = zext i8 %5 to i16
%10 = or i16 %8, %9
br label %11
11: ; preds = %1, %3
%12 = phi i16 [ %10, %3 ], [ 0, %1 ]
ret i16 %12
}
/* Type definitions */
struct jit_state {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ emit1(struct jit_state *, int);
int /*<<< orphan*/ emit_jump_offset(struct jit_state *, int /*<<< orphan*/);
void emit_jcc(struct jit_state *state, int code, int32_t target_pc) {
  emit1(state, 0x0f);
  emit1(state, code);
  emit_jump_offset(state, target_pc);
}


x86 assembly (clang, -O0):
<emit_jcc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xf,%esi
call   1030 <emit1@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <emit1@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1040 <emit_jump_offset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_jcc>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
mov    $0xf,%esi
call   1030 <emit1@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <emit1@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <emit_jump_offset@plt>

LLVM IR (-O0):
%struct.jit_state = type { i32 }
define void @emit_jcc(%struct.jit_state* %0, i32 %1, i32 %2) {
%4 = alloca %struct.jit_state*
%5 = alloca i32
%6 = alloca i32
store %struct.jit_state* %0, %struct.jit_state** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load %struct.jit_state*, %struct.jit_state** %4
%8 = call i32 @emit1(%struct.jit_state* %7, i32 15)
%9 = load %struct.jit_state*, %struct.jit_state** %4
%10 = load i32, i32* %5
%11 = call i32 @emit1(%struct.jit_state* %9, i32 %10)
%12 = load %struct.jit_state*, %struct.jit_state** %4
%13 = load i32, i32* %6
%14 = call i32 @emit_jump_offset(%struct.jit_state* %12, i32 %13)
ret void
}

LLVM IR (-O2):
%struct.jit_state = type { i32 }
define void @emit_jcc(%struct.jit_state* %0, i32 %1, i32 %2) {
%4 = tail call i32 @emit1(%struct.jit_state* %0, i32 15)
%5 = tail call i32 @emit1(%struct.jit_state* %0, i32 %1)
%6 = tail call i32 @emit_jump_offset(%struct.jit_state* %0, i32 %2)
ret void
}
/* Variables and functions */
unsigned int CalculateLog2(unsigned int);
int fgen_calculate_shift(unsigned int n) {
  unsigned int shift = CalculateLog2(n);
  if (((unsigned int)1 << shift) == n)
    return shift;
  return -1;
}


x86 assembly (clang, -O0):
<fgen_calculate_shift>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <CalculateLog2@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
cmp    -0x8(%rbp),%eax
jne    1144 <fgen_calculate_shift+0x34>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114b <fgen_calculate_shift+0x3b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgen_calculate_shift>:
push   %rbx
mov    %edi,%ebx
call   1030 <CalculateLog2@plt>
mov    $0x1,%edx
mov    %eax,%ecx
shl    %cl,%edx
cmp    %ebx,%edx
mov    $0xffffffff,%ecx
cmovne %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @fgen_calculate_shift(i32 %0) {
%2 = tail call i32 @CalculateLog2(i32 %0)
%3 = shl nuw i32 1, %2
%4 = icmp eq i32 %3, %0
%5 = select i1 %4, i32 %2, i32 -1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ calculo(int *);
int /*<<< orphan*/ leitura(int *);
void main() {
  int vetor[30];
  leitura(vetor);
  calculo(vetor);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    -0x80(%rbp),%rdi
call   1040 <leitura@plt>
lea    -0x80(%rbp),%rdi
call   1030 <calculo@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <leitura@plt>
mov    %rbx,%rdi
call   1030 <calculo@plt>
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @main() {
%1 = alloca [30 x i32]
%2 = getelementptr inbounds [30 x i32], [30 x i32]* %1, i64 0, i64 0
%3 = call i32 @leitura(i32* %2)
%4 = getelementptr inbounds [30 x i32], [30 x i32]* %1, i64 0, i64 0
%5 = call i32 @calculo(i32* %4)
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = alloca [30 x i32]
%2 = bitcast [30 x i32]* %1 to i8*
%3 = getelementptr inbounds [30 x i32], [30 x i32]* %1, i64 0, i64 0
%4 = call i32 @leitura(i32* %3)
%5 = call i32 @calculo(i32* %3)
ret void
}
float newAverage(float newSample, float currentAverage, int newCount) {
  float average;
  average = currentAverage + (newSample - currentAverage) / newCount;
  return average;
}


x86 assembly (clang, -O0):
<newAverage>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
subss  -0x8(%rbp),%xmm1
cvtsi2ssl -0xc(%rbp),%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<newAverage>:
cvtsi2ss %edi,%xmm2
subss  %xmm1,%xmm0
divss  %xmm2,%xmm0
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @newAverage(float %0, float %1, i32 %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca i32
%7 = alloca float
store float %0, float* %4
store float %1, float* %5
store i32 %2, i32* %6
%8 = load float, float* %5
%9 = load float, float* %4
%10 = load float, float* %5
%11 = fsub float %9, %10
%12 = load i32, i32* %6
%13 = sitofp i32 %12 to float
%14 = fdiv float %11, %13
%15 = fadd float %8, %14
store float %15, float* %7
%16 = load float, float* %7
ret float %16
}

LLVM IR (-O2):
define float @newAverage(float %0, float %1, i32 %2) {
%4 = fsub float %0, %1
%5 = sitofp i32 %2 to float
%6 = fdiv float %4, %5
%7 = fadd float %6, %1
ret float %7
}
int ft_toupper(int c) { return (c > 96 && c < 123 ? c - 32 : c); }


x86 assembly (clang, -O0):
<ft_toupper>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x60,-0x4(%rbp)
jle    1129 <ft_toupper+0x29>
cmpl   $0x7b,-0x4(%rbp)
jge    1129 <ft_toupper+0x29>
mov    -0x4(%rbp),%eax
sub    $0x20,%eax
mov    %eax,-0x8(%rbp)
jmp    112f <ft_toupper+0x2f>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_toupper>:
lea    -0x61(%rdi),%ecx
lea    -0x20(%rdi),%eax
cmp    $0x1a,%ecx
cmovae %edi,%eax
ret

LLVM IR (-O0):
define i32 @ft_toupper(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 96
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 123
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i32, i32* %2
%10 = sub nsw i32 %9, 32
br label %13
11: ; preds = %5, %1
%12 = load i32, i32* %2
br label %13
13: ; preds = %11, %8
%14 = phi i32 [ %10, %8 ], [ %12, %11 ]
ret i32 %14
}

LLVM IR (-O2):
define i32 @ft_toupper(i32 %0) {
%2 = add i32 %0, -97
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, -32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
int ft_str_is_printable(char *str) {
  int i;
  i = 0;
  while (str[i] != '\0') {
    if (str[i] < 32 || str[i] > 126)
      return (0);
    i++;
  }
  return (1);
}


x86 assembly (clang, -O0):
<ft_str_is_printable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1168 <ft_str_is_printable+0x68>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jl     114e <ft_str_is_printable+0x4e>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7e,%eax
jle    115a <ft_str_is_printable+0x5a>
movl   $0x0,-0x4(%rbp)
jmp    116f <ft_str_is_printable+0x6f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    110f <ft_str_is_printable+0xf>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_str_is_printable>:
mov    (%rdi),%cl
mov    $0x1,%eax
test   %cl,%cl
je     1123 <ft_str_is_printable+0x23>
add    $0x1,%rdi
nop
add    $0x81,%cl
cmp    $0xa0,%cl
jbe    1124 <ft_str_is_printable+0x24>
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <ft_str_is_printable+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_str_is_printable(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %8
4: ; preds = %8
%5 = getelementptr inbounds i8, i8* %0, i64 %13
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %14, label %8
8: ; preds = %1, %4
%9 = phi i64 [ %13, %4 ], [ 0, %1 ]
%10 = phi i8 [ %6, %4 ], [ %2, %1 ]
%11 = add i8 %10, -127
%12 = icmp ult i8 %11, -95
%13 = add nuw i64 %9, 1
br i1 %12, label %14, label %4
14: ; preds = %8, %4, %1
%15 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %8 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ op_write1(int);
void op_enc_pop_hl(void) { op_write1(0xe1); }


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

x86 assembly (clang, -O2):
<op_enc_pop_hl>:
mov    $0xe1,%edi
jmp    1030 <op_write1@plt>

LLVM IR (-O0):
define void @op_enc_pop_hl() {
%1 = call i32 @op_write1(i32 225)
ret void
}

LLVM IR (-O2):
define void @op_enc_pop_hl() {
%1 = tail call i32 @op_write1(i32 225)
ret void
}
void COM_FixPath(char *pathname) {
  while (*pathname) {
    if (*pathname == '\\') {
      *pathname = '/';
    }
    pathname++;
  }
}


x86 assembly (clang, -O0):
<COM_FixPath>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     113d <COM_FixPath+0x3d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    112c <COM_FixPath+0x2c>
mov    -0x8(%rbp),%rax
movb   $0x2f,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <COM_FixPath+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<COM_FixPath>:
jmp    1117 <COM_FixPath+0x17>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movb   $0x2f,(%rdi)
add    $0x1,%rdi
movzbl (%rdi),%eax
cmp    $0x5c,%al
je     1110 <COM_FixPath+0x10>
test   %al,%al
jne    1113 <COM_FixPath+0x13>
ret

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

LLVM IR (-O2):
define void @COM_FixPath(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = load i8, i8* %3
switch i8 %4, label %6 [
i8 0, label %8
i8 92, label %5
]
5: ; preds = %2
store i8 47, i8* %3
br label %6
6: ; preds = %2, %5
%7 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
8: ; preds = %2
ret void
}
/* Type definitions */
struct frame {
  int dummy;
};
struct fcgi {
  int dummy;
};

/* Variables and functions */
int process_data(struct frame *f, struct fcgi *fcgi, const char *str,
                 size_t num) {
  return 1;
}


x86 assembly (clang, -O0):
<process_data>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.frame = type { i32 }
%struct.fcgi = type { i32 }
define i32 @process_data(%struct.frame* %0, %struct.fcgi* %1, i8* %2, i64 %3) {
%5 = alloca %struct.frame*
%6 = alloca %struct.fcgi*
%7 = alloca i8*
%8 = alloca i64
store %struct.frame* %0, %struct.frame** %5
store %struct.fcgi* %1, %struct.fcgi** %6
store i8* %2, i8** %7
store i64 %3, i64* %8
ret i32 1
}

LLVM IR (-O2):
%struct.frame = type { i32 }
%struct.fcgi = type { i32 }
define i32 @process_data(%struct.frame* nocapture readnone %0, %struct.fcgi* nocapture readnone %1, i8* nocapture readnone %2, i64 %3) {
ret i32 1
}
void rt_free_reqbuf(void *voidhandle) {}


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

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

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

LLVM IR (-O2):
define void @rt_free_reqbuf(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Fail(char *, int, int);
int printf(char const *, void *);
int strlen(char const *);
void DoPointerTest(const char *formatstr, void *param, char *paramstr,
                   const char *checkstr1) {
  int ret;
  ret = printf(formatstr, param);
  if (ret != strlen(checkstr1)) {
    Fail("Expected printf to return %d, got %d.\n", strlen(checkstr1), ret);
  }
}


x86 assembly (clang, -O0):
<DoPointerTest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <printf@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
cmp    %ecx,%eax
je     118e <DoPointerTest+0x5e>
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
mov    -0x24(%rbp),%edx
lea    0xe77(%rip),%rdi
call   1050 <Fail@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DoPointerTest>:
push   %rbp
push   %rbx
push   %rax
mov    %rcx,%rbx
call   1040 <printf@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    %eax,%ebp
jne    1150 <DoPointerTest+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0xea1(%rip),%rdi
mov    %eax,%esi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <Fail@plt>

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

LLVM IR (-O2):
@.str = [39 x i8] c"Expected printf to return %d, got %d.\0A\00"
define void @DoPointerTest(i8* %0, i8* %1, i8* nocapture readnone %2, i8* %3) {
%5 = tail call i32 @printf(i8* %0, i8* %1)
%6 = tail call i32 @strlen(i8* %3)
%7 = icmp eq i32 %5, %6
br i1 %7, label %11, label %8
8: ; preds = %4
%9 = tail call i32 @strlen(i8* %3)
%10 = tail call i32 @Fail(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %5)
br label %11
11: ; preds = %8, %4
ret void
}
void SSMR3GetMem(void) {}


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

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

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

LLVM IR (-O2):
define void @SSMR3GetMem() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ notify_pvcall(char *);
void pvEnableTrace(char bEnable) { notify_pvcall("f"); }


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

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

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

LLVM IR (-O2):
@.str = [2 x i8] c"f\00"
define void @pvEnableTrace(i8 signext %0) {
%2 = tail call i32 @notify_pvcall(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ result;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, char const *, int);
uint32_t read32(const char *p) {
  uint32_t result;
  memcpy(&result, p, sizeof(result));
  return result;
}


x86 assembly (clang, -O0):
<read32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read32>:
push   %rax
mov    %rdi,%rsi
lea    0x4(%rsp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @read32(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @memcpy(i32* %2, i8* %0, i32 4)
%5 = load i32, i32* %2
ret i32 %5
}
char *GUI_Strcpy(char *dst, const char *src) {
  char c;
  char *s = (char *)src;
  const int off = dst - s - 1;
  do {
    c = *s++;
    s[off] = c;
  } while (c != '\0');
  return dst;
}


x86 assembly (clang, -O0):
<GUI_Strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    %rcx,%rax
sub    $0x1,%rax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%dl
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
movsbl -0x11(%rbp),%eax
cmp    $0x0,%eax
jne    1126 <GUI_Strcpy+0x26>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GUI_Strcpy>:
mov    %rdi,%rax
mov    %esi,%ecx
not    %ecx
add    %edi,%ecx
movslq %ecx,%rcx
nopl   0x0(%rax)
movzbl (%rsi),%edx
mov    %dl,0x1(%rsi,%rcx,1)
add    $0x1,%rsi
test   %dl,%dl
jne    1110 <GUI_Strcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @GUI_Strcpy(i8* returned %0, i8* %1) {
%3 = ptrtoint i8* %0 to i64
%4 = ptrtoint i8* %1 to i64
%5 = xor i64 %4, -1
%6 = add i64 %5, %3
%7 = shl i64 %6, 32
%8 = ashr exact i64 %7, 32
br label %9
9: ; preds = %9, %2
%10 = phi i8* [ %1, %2 ], [ %11, %9 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %10
%13 = getelementptr inbounds i8, i8* %11, i64 %8
store i8 %12, i8* %13
%14 = icmp eq i8 %12, 0
br i1 %14, label %15, label %9
15: ; preds = %9
ret i8* %0
}
/* Type definitions */
typedef int /*<<< orphan*/ uintmax_t;

/* Variables and functions */
int /*<<< orphan*/ INTMAX_MAX;
int /*<<< orphan*/ xsd_integer_value(char const *, int /*<<< orphan*/,
                                     int /*<<< orphan*/);
uintmax_t xsd_uintmax_value(const char *literal) {
  return (uintmax_t)xsd_integer_value(literal, 0, INTMAX_MAX);
}


x86 assembly (clang, -O0):
<xsd_uintmax_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ec1(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <xsd_integer_value@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xsd_uintmax_value>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
jmp    1030 <xsd_integer_value@plt>

LLVM IR (-O0):
@INTMAX_MAX = global i32 0
define i32 @xsd_uintmax_value(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @INTMAX_MAX
%5 = call i32 @xsd_integer_value(i8* %3, i32 0, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
@INTMAX_MAX = global i32 0
define i32 @xsd_uintmax_value(i8* %0) {
%2 = load i32, i32* @INTMAX_MAX
%3 = tail call i32 @xsd_integer_value(i8* %0, i32 0, i32 %2)
ret i32 %3
}
/* Variables and functions */
int SIGINT;
int /*<<< orphan*/ dobuf();
void sig_handler(int signo) {
  if (signo == SIGINT) {
    dobuf();
  }
}


x86 assembly (clang, -O0):
<sig_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ec3(%rip),%rcx
cmp    (%rcx),%eax
jne    1134 <sig_handler+0x24>
mov    $0x0,%al
call   1030 <dobuf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_handler>:
mov    0x2ed1(%rip),%rax
cmp    %edi,(%rax)
jne    1122 <sig_handler+0x12>
xor    %eax,%eax
jmp    1030 <dobuf@plt>
ret

LLVM IR (-O0):
@SIGINT = global i32 0
define void @sig_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGINT
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 (...) @dobuf()
br label %8
8: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@SIGINT = global i32 0
define void @sig_handler(i32 %0) {
%2 = load i32, i32* @SIGINT
%3 = icmp eq i32 %2, %0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @dobuf()
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
unsigned int __get_cpuid_max(unsigned int, unsigned int *);
unsigned int get_cpuid_max(unsigned int ext, unsigned int *sig) {
  return __get_cpuid_max(ext, sig);
}


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

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

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

LLVM IR (-O2):
define i32 @get_cpuid_max(i32 %0, i32* %1) {
%3 = tail call i32 @__get_cpuid_max(i32 %0, i32* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ test_show_bytes(int);
int main(void) {
  test_show_bytes(12345);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3039,%edi
call   1030 <test_show_bytes@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @test_show_bytes(i32 12345)
ret i32 0
}
long NET_sendPadData(void *pData, int Size) { return 0; }


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

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

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

LLVM IR (-O2):
define i64 @NET_sendPadData(i8* nocapture readnone %0, i32 %1) {
ret i64 0
}
/* Variables and functions */
int /*<<< orphan*/ getch();
int /*<<< orphan*/ nordisrnd(double, double, double *);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
main() {
  double u, g, r;
  u = 2.7;
  g = 4.3;
  r = 3.0;
  printf("\nThe random number is:%5.2lf", nordisrnd(u, g, &r));
  getch();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  0xed0(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xebb(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xea6(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
lea    -0x18(%rbp),%rdi
call   1040 <nordisrnd@plt>
mov    %eax,%esi
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <getch@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movabs $0x4008000000000000,%rax
mov    %rax,(%rsp)
movsd  0xeb9(%rip),%xmm0
movsd  0xeb9(%rip),%xmm1
mov    %rsp,%rdi
call   1040 <nordisrnd@plt>
lea    0xeb2(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <getch@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"\0AThe random number is:%5.2lf\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
store double 2.700000e+00, double* %1
store double 4.300000e+00, double* %2
store double 3.000000e+00, double* %3
%4 = load double, double* %1
%5 = load double, double* %2
%6 = call i32 @nordisrnd(double %4, double %5, double* %3)
%7 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 (...) @getch()
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"\0AThe random number is:%5.2lf\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
store double 3.000000e+00, double* %1
%3 = call i32 @nordisrnd(double 2.700000e+00, double 4.300000e+00, double* %1)
%4 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 (...) @getch()
ret i32 0
}
void __attribute__((no))
lkmc_busy_loop(unsigned long long max, unsigned long long max2) {
  for (unsigned long long i = 0; i < max2; i++) {
    for (unsigned long long j = 0; j < max; j++) {
      __asm__ __volatile__("" : "+g"(i), "+g"(j) : :);
    }
  }
}


x86 assembly (clang, -O0):
<lkmc_busy_loop>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    116f <lkmc_busy_loop+0x6f>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    1159 <lkmc_busy_loop+0x59>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    112a <lkmc_busy_loop+0x2a>
jmp    115e <lkmc_busy_loop+0x5e>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1114 <lkmc_busy_loop+0x14>
pop    %rbp
ret

x86 assembly (clang, -O2):
<lkmc_busy_loop>:
movq   $0x0,-0x10(%rsp)
test   %rsi,%rsi
je     1155 <lkmc_busy_loop+0x55>
xor    %eax,%eax
jmp    112e <lkmc_busy_loop+0x2e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rax
mov    %rax,-0x10(%rsp)
cmp    %rsi,%rax
jae    1155 <lkmc_busy_loop+0x55>
movq   $0x0,-0x8(%rsp)
test   %rdi,%rdi
je     1120 <lkmc_busy_loop+0x20>
xor    %ecx,%ecx
xchg   %ax,%ax
mov    %rax,-0x10(%rsp)
add    $0x1,%rcx
mov    %rcx,-0x8(%rsp)
cmp    %rdi,%rcx
jb     1140 <lkmc_busy_loop+0x40>
jmp    1120 <lkmc_busy_loop+0x20>
ret

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

LLVM IR (-O2):
define void @lkmc_busy_loop(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = bitcast i64* %3 to i8*
store i64 0, i64* %3
%6 = icmp eq i64 %1, 0
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = bitcast i64* %4 to i8*
%9 = icmp eq i64 %0, 0
br label %11
10: ; preds = %13, %2
ret void
11: ; preds = %7, %13
%12 = phi i64 [ 0, %7 ], [ %15, %13 ]
store i64 0, i64* %4
br i1 %9, label %13, label %17
13: ; preds = %17, %11
%14 = phi i64 [ %12, %11 ], [ %23, %17 ]
%15 = add i64 %14, 1
store i64 %15, i64* %3
%16 = icmp ult i64 %15, %1
br i1 %16, label %11, label %10
17: ; preds = %11, %17
%18 = phi i64 [ %23, %17 ], [ %12, %11 ]
%19 = phi i64 [ %21, %17 ], [ 0, %11 ]
%20 = load i64, i64* %4
%21 = add i64 %20, 1
store i64 %21, i64* %4
%22 = icmp ult i64 %21, %0
%23 = load i64, i64* %3
br i1 %22, label %17, label %13
}
/* Variables and functions */
int /*<<< orphan*/ clrtobot();
int /*<<< orphan*/ getch();
int /*<<< orphan*/ move(int, int /*<<< orphan*/);
int /*<<< orphan*/ printw(char *);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ timeout(int);
void overload(void) {
  move(16, 0);
  clrtobot();
  printw("Comprador's Report\n\n");
  printw("Your ship is overloaded, Taipan!!");
  refresh();
  timeout(5000);
  getch();
  timeout(-1);
  return;
}


x86 assembly (clang, -O0):
<overload>:
push   %rbp
mov    %rsp,%rbp
mov    $0x10,%edi
xor    %esi,%esi
call   1080 <move@plt>
mov    $0x0,%al
call   1030 <clrtobot@plt>
lea    0xe82(%rip),%rdi
call   1050 <printw@plt>
lea    0xe8b(%rip),%rdi
call   1050 <printw@plt>
mov    $0x0,%al
call   1060 <refresh@plt>
mov    $0x1388,%edi
call   1040 <timeout@plt>
mov    $0x0,%al
call   1070 <getch@plt>
mov    $0xffffffff,%edi
call   1040 <timeout@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<overload>:
push   %rax
mov    $0x10,%edi
xor    %esi,%esi
call   1080 <move@plt>
xor    %eax,%eax
call   1030 <clrtobot@plt>
lea    0xe85(%rip),%rdi
call   1050 <printw@plt>
lea    0xe8e(%rip),%rdi
call   1050 <printw@plt>
xor    %eax,%eax
call   1060 <refresh@plt>
mov    $0x1388,%edi
call   1040 <timeout@plt>
xor    %eax,%eax
call   1070 <getch@plt>
mov    $0xffffffff,%edi
pop    %rax
jmp    1040 <timeout@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Comprador's Report\0A\0A\00"
@.str.1 = [34 x i8] c"Your ship is overloaded, Taipan!!\00"
define void @overload() {
%1 = call i32 @move(i32 16, i32 0)
%2 = call i32 (...) @clrtobot()
%3 = call i32 @printw(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printw(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 (...) @refresh()
%6 = call i32 @timeout(i32 5000)
%7 = call i32 (...) @getch()
%8 = call i32 @timeout(i32 -1)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"Comprador's Report\0A\0A\00"
@.str.1 = [34 x i8] c"Your ship is overloaded, Taipan!!\00"
define void @overload() {
%1 = tail call i32 @move(i32 16, i32 0)
%2 = tail call i32 (...) @clrtobot()
%3 = tail call i32 @printw(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @printw(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (...) @refresh()
%6 = tail call i32 @timeout(i32 5000)
%7 = tail call i32 (...) @getch()
%8 = tail call i32 @timeout(i32 -1)
ret void
}
/* Variables and functions */
int EINVAL;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int imd_command_setenv(const char *variable_name, const char *value) {
  fprintf(stderr, "-s option ignored\n");
  return -EINVAL;
}


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

x86 assembly (clang, -O2):
<imd_command_setenv>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2eab(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"-s option ignored\0A\00"
@EINVAL = global i32 0
define i32 @imd_command_setenv(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EINVAL
%8 = sub nsw i32 0, %7
ret i32 %8
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"-s option ignored\0A\00"
@EINVAL = global i32 0
define i32 @imd_command_setenv(i8* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @EINVAL
%6 = sub nsw i32 0, %5
ret i32 %6
}
int paperdone(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @paperdone() {
ret i32 0
}

LLVM IR (-O2):
define i32 @paperdone() {
ret i32 0
}
int AbsInt(const int x) {
  const int mask = x >> (sizeof(int) * 8 - 1);
  return (x + mask) ^ mask;
}


x86 assembly (clang, -O0):
<AbsInt>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1f,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
xor    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @AbsInt(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = ashr i32 %4, 31
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = add nsw i32 %6, %7
%9 = load i32, i32* %3
%10 = xor i32 %8, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @AbsInt(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
int f(int a) { return (a << 31) << 6; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1f,%eax
shl    $0x6,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 31
%5 = shl i32 %4, 6
ret i32 %5
}

LLVM IR (-O2):
define i32 @f(i32 %0) {
ret i32 0
}