xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void usage(const char *mess) {
  fprintf(stderr, "Error: %s\n", mess);
  fprintf(stderr, "Usage: wndr3700 input_file output_file [magic]\n");
  fprintf(stderr, "\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
lea    0xeb4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
lea    0xecb(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rbx
mov    (%rbx),%edi
lea    0xecc(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xec7(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xee5(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [11 x i8] c"Error: %s\0A\00"
@.str.1 = [48 x i8] c"Usage: wndr3700 input_file output_file [magic]\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @stderr
%7 = call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* @stderr
%9 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [11 x i8] c"Error: %s\0A\00"
@.str.1 = [48 x i8] c"Usage: wndr3700 input_file output_file [magic]\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
}
int airSgn(double v) { return (v > 0 ? 1 : (v < 0 ? -1 : 0)); }


x86 assembly (clang, -O0):
<airSgn>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1128 <airSgn+0x28>
mov    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1141 <airSgn+0x41>
movsd  -0x8(%rbp),%xmm1
xorps  %xmm0,%xmm0
xor    %eax,%eax
mov    $0xffffffff,%ecx
ucomisd %xmm1,%xmm0
cmova  %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<airSgn>:
xorpd  %xmm1,%xmm1
xor    %ecx,%ecx
ucomisd %xmm0,%xmm1
seta   %cl
neg    %ecx
ucomisd %xmm1,%xmm0
mov    $0x1,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @airSgn(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp ogt double %3, 0.000000e+00
br i1 %4, label %5, label %6
5: ; preds = %1
br label %11
6: ; preds = %1
%7 = load double, double* %2
%8 = fcmp olt double %7, 0.000000e+00
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 -1, i32 0
br label %11
11: ; preds = %6, %5
%12 = phi i32 [ 1, %5 ], [ %10, %6 ]
ret i32 %12
}

LLVM IR (-O2):
define i32 @airSgn(double %0) {
%2 = fcmp ogt double %0, 0.000000e+00
%3 = fcmp olt double %0, 0.000000e+00
%4 = sext i1 %3 to i32
%5 = select i1 %2, i32 1, i32 %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ SIGINT;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ signal(int /*<<< orphan*/, void (*)(int));
void sigintHandler(int sig_num) {
  signal(SIGINT, sigintHandler);
  printf("\033[?25h");
  exit(0);
}


x86 assembly (clang, -O0):
<sigintHandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
mov    0x2e9d(%rip),%rsi
call   1040 <signal@plt>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<sigintHandler>:
push   %rax
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
mov    0x2ea7(%rip),%rsi
call   1040 <signal@plt>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@SIGINT = global i32 0
@.str = [7 x i8] c"\1B[?25h\00"
define void @sigintHandler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @SIGINT
%4 = call i32 @signal(i32 %3, void (i32)* @sigintHandler)
%5 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@SIGINT = global i32 0
@.str = [7 x i8] c"\1B[?25h\00"
define void @sigintHandler(i32 %0) {
%2 = load i32, i32* @SIGINT
%3 = tail call i32 @signal(i32 %2, void (i32)* @sigintHandler)
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ AES_KEY;

/* Variables and functions */
int /*<<< orphan*/ AES_DECRYPT;
int /*<<< orphan*/ AES_cbc_encrypt(char *, char *, int, int /*<<< orphan*/ *,
                                   char *, int /*<<< orphan*/);
int /*<<< orphan*/ AES_set_decrypt_key(char *, int, int /*<<< orphan*/ *);
int htc_aes_decrypt_chunk(char *buf, int size, char *key, char *iv) {
  AES_KEY dec_key;
  AES_set_decrypt_key(key, 8 * 0x10, &dec_key);
  AES_cbc_encrypt(buf, buf, size, &dec_key, iv, AES_DECRYPT);
}


x86 assembly (clang, -O0):
<htc_aes_decrypt_chunk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x80,%esi
lea    -0x2c(%rbp),%rdx
call   1040 <AES_set_decrypt_key@plt>
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x28(%rbp),%r8
mov    0x2e89(%rip),%rax
mov    (%rax),%r9d
lea    -0x2c(%rbp),%rcx
call   1030 <AES_cbc_encrypt@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<htc_aes_decrypt_chunk>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0x4(%rsp),%r15
mov    %rdx,%rdi
mov    $0x80,%esi
mov    %r15,%rdx
call   1040 <AES_set_decrypt_key@plt>
mov    0x2e9d(%rip),%rax
mov    (%rax),%r9d
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %r15,%rcx
mov    %r14,%r8
call   1030 <AES_cbc_encrypt@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@AES_DECRYPT = global i32 0
define i32 @htc_aes_decrypt_chunk(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
%11 = load i8*, i8** %8
%12 = call i32 @AES_set_decrypt_key(i8* %11, i32 128, i32* %10)
%13 = load i8*, i8** %6
%14 = load i8*, i8** %6
%15 = load i32, i32* %7
%16 = load i8*, i8** %9
%17 = load i32, i32* @AES_DECRYPT
%18 = call i32 @AES_cbc_encrypt(i8* %13, i8* %14, i32 %15, i32* %10, i8* %16, i32 %17)
%19 = load i32, i32* %5
ret i32 %19
}

LLVM IR (-O2):
@AES_DECRYPT = global i32 0
define i32 @htc_aes_decrypt_chunk(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
%7 = call i32 @AES_set_decrypt_key(i8* %2, i32 128, i32* %5)
%8 = load i32, i32* @AES_DECRYPT
%9 = call i32 @AES_cbc_encrypt(i8* %0, i8* %0, i32 %1, i32* %5, i8* %3, i32 %8)
ret i32 undef
}
void iterate_long_loop() {
  long iterations = 10000000;
  for (int i = 0; i < iterations; ++i) {
  }
}


x86 assembly (clang, -O0):
<iterate_long_loop>:
push   %rbp
mov    %rsp,%rbp
movq   $0x989680,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rax
cmp    -0x8(%rbp),%rax
jge    1134 <iterate_long_loop+0x34>
jmp    1126 <iterate_long_loop+0x26>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1113 <iterate_long_loop+0x13>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @iterate_long_loop() {
%1 = alloca i64
%2 = alloca i32
store i64 10000000, i64* %1
store i32 0, i32* %2
br label %3
3: ; preds = %9, %0
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = load i64, i64* %1
%7 = icmp slt i64 %5, %6
br i1 %7, label %8, label %12
8: ; preds = %3
br label %9
9: ; preds = %8
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
store i32 %11, i32* %2
br label %3
12: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @iterate_long_loop() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __builtin_rx_brk();
void rxbreak(void) { __builtin_rx_brk(); }


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

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

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

LLVM IR (-O2):
define void @rxbreak() {
%1 = tail call i32 (...) @__builtin_rx_brk()
ret void
}
/* Variables and functions */
int any_decrqss(char const *, char *);
int rpt_SGR(const char *the_title) { return any_decrqss(the_title, "m"); }


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

x86 assembly (clang, -O2):
<rpt_SGR>:
lea    0xee9(%rip),%rsi
jmp    1030 <any_decrqss@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"m\00"
define i32 @rpt_SGR(i8* %0) {
%2 = tail call i32 @any_decrqss(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
int test_imm_3Cuint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0x3C << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_3Cuint64_midword_reg(i64 %0) {
%2 = and i64 %0, 3932160
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ adi(long, long);
int main() {
  long T, N;
  T = 1000;
  N = 1000;
  adi(T, N);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x3e8,-0x10(%rbp)
movq   $0x3e8,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <adi@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
store i64 1000, i64* %2
store i64 1000, i64* %3
%4 = load i64, i64* %2
%5 = load i64, i64* %3
%6 = call i32 @adi(i64 %4, i64 %5)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @adi(i64 1000, i64 1000)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
float multi(float x, float y) {
  float mult = 0;
  mult = x * y;
  printf("%2.f\n", mult);
  return mult;
}


x86 assembly (clang, -O0):
<multi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<multi>:
push   %rax
mulss  %xmm1,%xmm0
movss  %xmm0,0x4(%rsp)
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
movss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%2.f\0A\00"
define float @multi(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
store float 0.000000e+00, float* %5
%6 = load float, float* %3
%7 = load float, float* %4
%8 = fmul float %6, %7
store float %8, float* %5
%9 = load float, float* %5
%10 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), float %9)
%11 = load float, float* %5
ret float %11
}

LLVM IR (-O2):
@.str = [6 x i8] c"%2.f\0A\00"
define float @multi(float %0, float %1) {
%3 = fmul float %0, %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), float %3)
ret float %3
}
/* Type definitions */
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double wtime(void) {
  struct timeval t;
  gettimeofday(&t, NULL);
  return ((double)t.tv_sec + (double)t.tv_usec / 1000000);
}


x86 assembly (clang, -O0):
<wtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdq -0x8(%rbp),%xmm0
cvtsi2sdq -0x10(%rbp),%xmm1
movsd  0xec7(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wtime>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdq 0x10(%rsp),%xmm1
cvtsi2sdq 0x8(%rsp),%xmm0
divsd  0xeca(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define double @wtime() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%4 = load i64, i64* %3
%5 = sitofp i64 %4 to double
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%7 = load i64, i64* %6
%8 = sitofp i64 %7 to double
%9 = fdiv double %8, 1.000000e+06
%10 = fadd double %5, %9
ret double %10
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define double @wtime() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = fdiv double %9, 1.000000e+06
%11 = fadd double %10, %6
ret double %11
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int _usage(void) {
  fputs("Usage: "
        "dirname"
        " string\n",
        stderr);
  return 1;
}


x86 assembly (clang, -O0):
<_usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_usage>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
lea    0xedf(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Usage: dirname string\0A\00"
@stderr = global i32 0
define i32 @_usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 1
}

LLVM IR (-O2):
@.str = [23 x i8] c"Usage: dirname string\0A\00"
@stderr = global i32 0
define i32 @_usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 1
}
void empty_def_handler(void) {
  while (1) {
  }
}


x86 assembly (clang, -O0):
<empty_def_handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <empty_def_handler+0x9>
jmp    1109 <empty_def_handler+0x9>

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

LLVM IR (-O0):
define void @empty_def_handler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @empty_def_handler() {
br label %1
1: ; preds = %0, %1
br label %1
}
int buscaSequencial(int numeros[], int tamanho, int n) {
  int i;
  for (i = 0; i < tamanho; i++)
    if (numeros[i] == n)
      return i;
  return -1;
}


x86 assembly (clang, -O0):
<buscaSequencial>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1153 <buscaSequencial+0x53>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x18(%rbp),%eax
jne    1140 <buscaSequencial+0x40>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115a <buscaSequencial+0x5a>
jmp    1145 <buscaSequencial+0x45>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1115 <buscaSequencial+0x15>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<buscaSequencial>:
mov    $0xffffffff,%eax
test   %esi,%esi
jle    111e <buscaSequencial+0x1e>
mov    %esi,%esi
xor    %ecx,%ecx
nopl   (%rax)
cmp    %edx,(%rdi,%rcx,4)
je     111f <buscaSequencial+0x1f>
add    $0x1,%rcx
cmp    %rcx,%rsi
jne    1110 <buscaSequencial+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @buscaSequencial(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %12
%8 = phi i64 [ 0, %5 ], [ %13, %12 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, %2
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %17, label %7
15: ; preds = %7
%16 = trunc i64 %8 to i32
br label %17
17: ; preds = %12, %15, %3
%18 = phi i32 [ -1, %3 ], [ %16, %15 ], [ -1, %12 ]
ret i32 %18
}
int myisdigit(int c) { return '0' <= c && c <= '9'; }


x86 assembly (clang, -O0):
<myisdigit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
mov    $0x30,%ecx
cmp    -0x4(%rbp),%ecx
mov    %al,-0x5(%rbp)
jg     1124 <myisdigit+0x24>
cmpl   $0x39,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<myisdigit>:
add    $0xffffffd0,%edi
xor    %eax,%eax
cmp    $0xa,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @myisdigit(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
size_t mbstowcs(int /*<<< orphan*/ *, char const *, int /*<<< orphan*/);
size_t wide_len(const char s[]) { return mbstowcs(NULL, s, 0); }


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

x86 assembly (clang, -O2):
<wide_len>:
mov    %rdi,%rsi
xor    %edi,%edi
xor    %edx,%edx
jmp    1030 <mbstowcs@plt>

LLVM IR (-O0):
define i64 @wide_len(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @mbstowcs(i32* null, i8* %3, i32 0)
ret i64 %4
}

LLVM IR (-O2):
define i64 @wide_len(i8* %0) {
%2 = tail call i64 @mbstowcs(i32* null, i8* %0, i32 0)
ret i64 %2
}
/* Variables and functions */
bool bitfield_test(unsigned long *bits, int bit) {
  return !!(bits[bit / (8 * sizeof(unsigned long))] &
            (1UL << (bit % (8 * sizeof(unsigned long)))));
}


x86 assembly (clang, -O0):
<bitfield_test>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shr    $0x6,%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xc(%rbp),%rcx
and    $0x3f,%rcx
mov    $0x1,%edx
shl    %cl,%rdx
mov    %rdx,%rcx
and    %rcx,%rax
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitfield_test>:
movslq %esi,%rcx
mov    %rcx,%rax
shr    $0x6,%rax
mov    (%rdi,%rax,8),%rdx
xor    %eax,%eax
bt     %rcx,%rdx
setb   %al
ret

LLVM IR (-O0):
define i32 @bitfield_test(i64* %0, i32 %1) {
%3 = alloca i64*
%4 = alloca i32
store i64* %0, i64** %3
store i32 %1, i32* %4
%5 = load i64*, i64** %3
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = udiv i64 %7, 64
%9 = getelementptr inbounds i64, i64* %5, i64 %8
%10 = load i64, i64* %9
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = urem i64 %12, 64
%14 = shl i64 1, %13
%15 = and i64 %10, %14
%16 = icmp ne i64 %15, 0
%17 = xor i1 %16, true
%18 = xor i1 %17, true
%19 = zext i1 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
define i32 @bitfield_test(i64* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = lshr i64 %3, 6
%5 = getelementptr inbounds i64, i64* %0, i64 %4
%6 = load i64, i64* %5
%7 = and i64 %3, 63
%8 = shl nuw i64 1, %7
%9 = and i64 %6, %8
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ create_test_list(int);
__attribute__((constructor)) void test_create_test_list() {
  create_test_list(20);
}


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

x86 assembly (clang, -O2):
<test_create_test_list>:
mov    $0x14,%edi
jmp    1030 <create_test_list@plt>

LLVM IR (-O0):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @test_create_test_list, i8* null }]
define void @test_create_test_list() {
%1 = call i32 @create_test_list(i32 20)
ret void
}

LLVM IR (-O2):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @test_create_test_list, i8* null }]
define void @test_create_test_list() {
%1 = tail call i32 @create_test_list(i32 20)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CheckRunningInMainThread(char *);
void XOPBeep(void) {
  if (!CheckRunningInMainThread("XOPBeep"))
    return;
}


x86 assembly (clang, -O0):
<XOPBeep>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <CheckRunningInMainThread@plt>
cmp    $0x0,%eax
jne    112e <XOPBeep+0x1e>
jmp    112e <XOPBeep+0x1e>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [8 x i8] c"XOPBeep\00"
define void @XOPBeep() {
%1 = call i32 @CheckRunningInMainThread(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = icmp ne i32 %1, 0
br i1 %2, label %4, label %3
3: ; preds = %0
br label %4
4: ; preds = %3, %0
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"XOPBeep\00"
define void @XOPBeep() {
%1 = tail call i32 @CheckRunningInMainThread(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int __builtin_arm_crc32cw(int, int);
int crc32cw(int a, int b) { return __builtin_arm_crc32cw(a, b); }


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

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

LLVM IR (-O0):
define i32 @crc32cw(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 @__builtin_arm_crc32cw(i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @crc32cw(i32 %0, i32 %1) {
%3 = tail call i32 @__builtin_arm_crc32cw(i32 %0, i32 %1)
ret i32 %3
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int key;
};
typedef TYPE_1__ XKeyboardControl;

/* Variables and functions */
void set_XKeyboardControl_key(void *_p, int _v) {
  ((XKeyboardControl *)_p)->key = (int)_v;
}


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

x86 assembly (clang, -O2):
<set_XKeyboardControl_key>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XKeyboardControl_key(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XKeyboardControl_key(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
void GPIOPortE_Handler(void) {
  while (1) {
  }
}


x86 assembly (clang, -O0):
<GPIOPortE_Handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <GPIOPortE_Handler+0x9>
jmp    1109 <GPIOPortE_Handler+0x9>

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

LLVM IR (-O0):
define void @GPIOPortE_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @GPIOPortE_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Type definitions */
struct termios {
  int *c_cc;
  int c_cflag;
  int c_iflag;
};
typedef int /*<<< orphan*/ speed_t;

/* Variables and functions */
int CLOCAL;
int CRTSCTS;
int CS8;
int CSIZE;
int IXANY;
int IXOFF;
int IXON;
int PARENB;
int PARODD;
int /*<<< orphan*/ TCSAFLUSH;
size_t VMIN;
size_t VTIME;
int /*<<< orphan*/ cfmakeraw(struct termios *);
int cfsetispeed(struct termios *, int /*<<< orphan*/);
int cfsetospeed(struct termios *, int /*<<< orphan*/);
int tcgetattr(int, struct termios *);
int tcsetattr(int, int /*<<< orphan*/, struct termios *);
int serial_conf(int fd, speed_t speed) {
  return 0;
  struct termios t;
  int ret = tcgetattr(fd, &t);
  if (ret < 0)
    return ret;
  cfmakeraw(&t);
  t.c_cc[VMIN] = 1;
  t.c_cc[VTIME] = 0;
  ret = cfsetispeed(&t, speed);
  if (ret < 0)
    return ret;
  ret = cfsetospeed(&t, speed);
  if (ret < 0)
    return ret;
  t.c_cflag |= PARENB | PARODD;
  t.c_cflag = (t.c_cflag & ~CSIZE) | CS8;
  t.c_cflag &= ~(CRTSCTS);
  t.c_iflag &= ~(IXON | IXOFF | IXANY);
  t.c_cflag |= CLOCAL;
  return tcsetattr(fd, TCSAFLUSH, &t);
}


x86 assembly (clang, -O0):
<serial_conf>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.termios = type { i32*, i32, i32 }
@CLOCAL = global i32 0
@CRTSCTS = global i32 0
@CS8 = global i32 0
@CSIZE = global i32 0
@IXANY = global i32 0
@IXOFF = global i32 0
@IXON = global i32 0
@PARENB = global i32 0
@PARODD = global i32 0
@TCSAFLUSH = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
define i32 @serial_conf(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.termios
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
ret i32 0
}

LLVM IR (-O2):
@CLOCAL = global i32 0
@CRTSCTS = global i32 0
@CS8 = global i32 0
@CSIZE = global i32 0
@IXANY = global i32 0
@IXOFF = global i32 0
@IXON = global i32 0
@PARENB = global i32 0
@PARODD = global i32 0
@TCSAFLUSH = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
define i32 @serial_conf(i32 %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ a11(int);
void a10(int n) { a11(n); }


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

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

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

LLVM IR (-O2):
define void @a10(i32 %0) {
%2 = tail call i32 @a11(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mmapcall(int);
int main(void) {
  mmapcall(3000000);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @mmapcall(i32 3000000)
ret i32 0
}
/* Variables and functions */
scalar_t__ toupper(char);
char *strlib_toupper(char *s) {
  char *ps;
  if (s) {
    ps = s;
    while (*ps) {
      *ps = (char)toupper(*ps);
      ps++;
    }
  }
  return (s);
}


x86 assembly (clang, -O0):
<strlib_toupper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1166 <strlib_toupper+0x56>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1161 <strlib_toupper+0x51>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    112f <strlib_toupper+0x1f>
jmp    1166 <strlib_toupper+0x56>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlib_toupper>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
test   %rdi,%rdi
je     1146 <strlib_toupper+0x36>
mov    (%r14),%al
test   %al,%al
je     1146 <strlib_toupper+0x36>
lea    0x1(%r14),%rbx
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <toupper@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <strlib_toupper+0x20>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @strlib_toupper(i8* returned %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %14, label %6
6: ; preds = %3, %6
%7 = phi i8 [ %12, %6 ], [ %4, %3 ]
%8 = phi i8* [ %11, %6 ], [ %0, %3 ]
%9 = tail call i64 @toupper(i8 signext %7)
%10 = trunc i64 %9 to i8
store i8 %10, i8* %8
%11 = getelementptr inbounds i8, i8* %8, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %6
14: ; preds = %6, %3, %1
ret i8* %0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ write_u16sparseco(int, int, int /*<<< orphan*/ **, char *,
                                     int /*<<< orphan*/);
void write_u16sparse(int nr, int nc, uint16_t **x, char *fname) {
  write_u16sparseco(nr, nc, x, fname, 0);
}


x86 assembly (clang, -O0):
<write_u16sparse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
xor    %r8d,%r8d
call   1030 <write_u16sparseco@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_u16sparse>:
xor    %r8d,%r8d
jmp    1030 <write_u16sparseco@plt>

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

LLVM IR (-O2):
define void @write_u16sparse(i32 %0, i32 %1, i32** %2, i8* %3) {
%5 = tail call i32 @write_u16sparseco(i32 %0, i32 %1, i32** %2, i8* %3, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
int /*<<< orphan*/ strncmp(char const *, char const *, int /*<<< orphan*/);
int has_prefix(const char *str, const char *prefix) {
  return !strncmp(str, prefix, strlen(prefix));
}


x86 assembly (clang, -O0):
<has_prefix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<has_prefix>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @has_prefix(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @strncmp(i8* %5, i8* %6, i32 %8)
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @has_prefix(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @strncmp(i8* %0, i8* %1, i32 %3)
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
void copy(void) {
  int i;
  extern char line[], longest[];
  i = 0;
  while ((longest[i] = line[i]) != '\0') {
    ++i;
  }
}


x86 assembly (clang, -O0):
<copy>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movslq -0x4(%rbp),%rcx
mov    0x2ed2(%rip),%rax
mov    (%rax,%rcx,1),%al
movslq -0x4(%rbp),%rdx
mov    0x2eb4(%rip),%rcx
mov    %al,(%rcx,%rdx,1)
movsbl %al,%eax
cmp    $0x0,%eax
je     1141 <copy+0x41>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <copy+0xb>
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy>:
xor    %eax,%eax
mov    0x2edf(%rip),%rsi
mov    0x2ec8(%rip),%rdx
movzbl (%rsi,%rax,1),%ecx
mov    %cl,(%rdx,%rax,1)
add    $0x1,%rax
test   %cl,%cl
jne    1110 <copy+0x10>
ret

LLVM IR (-O0):
@line = external global [0 x i8]
@longest = external global [0 x i8]
define void @copy() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %12, %0
%3 = load i32, i32* %1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds [0 x i8], [0 x i8]* @line, i64 0, i64 %4
%6 = load i8, i8* %5
%7 = load i32, i32* %1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [0 x i8], [0 x i8]* @longest, i64 0, i64 %8
store i8 %6, i8* %9
%10 = sext i8 %6 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i32, i32* %1
%14 = add nsw i32 %13, 1
store i32 %14, i32* %1
br label %2
15: ; preds = %2
ret void
}

LLVM IR (-O2):
@line = external global [0 x i8]
@longest = external global [0 x i8]
define void @copy() {
br label %1
1: ; preds = %1, %0
%2 = phi i64 [ %7, %1 ], [ 0, %0 ]
%3 = getelementptr inbounds [0 x i8], [0 x i8]* @line, i64 0, i64 %2
%4 = load i8, i8* %3
%5 = getelementptr inbounds [0 x i8], [0 x i8]* @longest, i64 0, i64 %2
store i8 %4, i8* %5
%6 = icmp eq i8 %4, 0
%7 = add nuw i64 %2, 1
br i1 %6, label %8, label %1
8: ; preds = %1
ret void
}
int fun993() { return 993; }


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

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

LLVM IR (-O0):
define i32 @fun993() {
ret i32 993
}

LLVM IR (-O2):
define i32 @fun993() {
ret i32 993
}
foo(int (*(*bar)(float))(int)) {
  int (*baz)(int) = (int (*)(int))0, y = (y * (*baz)(y)),
      *(*z)(int) = (int *(*)(int))0;
  struct {
    int (*foo)(int);
  } * (*s)(int) = (struct { int (*foo)(int); } * (*)(int))0;
  { y = (y * (*baz)(y)); }
  { z = (int *(*)(int))0; }
  {
    s = (struct { int (*foo)(int); } * (*)(int))0;
  }
  return (0);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%edi
call   *%rax
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%edi
call   *%rax
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
%struct.anon = type { i32 (i32)* }
define i32 @foo(i32 (i32)* (float)* %0) {
%2 = alloca i32 (i32)* (float)*
%3 = alloca i32 (i32)*
%4 = alloca i32
%5 = alloca i32* (i32)*
%6 = alloca %struct.anon* (i32)*
store i32 (i32)* (float)* %0, i32 (i32)* (float)** %2
store i32 (i32)* null, i32 (i32)** %3
%7 = load i32, i32* %4
%8 = load i32 (i32)*, i32 (i32)** %3
%9 = load i32, i32* %4
%10 = call i32 %8(i32 %9)
%11 = mul nsw i32 %7, %10
store i32 %11, i32* %4
store i32* (i32)* null, i32* (i32)** %5
store %struct.anon* (i32)* null, %struct.anon* (i32)** %6
%12 = load i32, i32* %4
%13 = load i32 (i32)*, i32 (i32)** %3
%14 = load i32, i32* %4
%15 = call i32 %13(i32 %14)
%16 = mul nsw i32 %12, %15
store i32 %16, i32* %4
store i32* (i32)* null, i32* (i32)** %5
store %struct.anon* (i32)* null, %struct.anon* (i32)** %6
ret i32 0
}

LLVM IR (-O2):
void mpo_free(void *ptr) {}


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

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

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

LLVM IR (-O2):
define void @mpo_free(i8* nocapture %0) {
ret void
}
void init_rtt() {
  *(volatile unsigned long *)((void *)0xfffffd20 + 0x00) =
      0x40000 | (((1) & 0xffff) << 0);
}


x86 assembly (clang, -O0):
<init_rtt>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfffffd20,%eax
movq   $0x40001,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_rtt>:
mov    $0xfffffd20,%eax
movq   $0x40001,(%rax)
ret

LLVM IR (-O0):
define void @init_rtt() {
store volatile i64 262145, i64* inttoptr (i64 4294966560 to i64*)
ret void
}

LLVM IR (-O2):
define void @init_rtt() {
store volatile i64 262145, i64* inttoptr (i64 4294966560 to i64*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void freeChar(char **tmp) {
  if (*tmp != NULL) {
    free(*tmp);
    *tmp = NULL;
  }
}


x86 assembly (clang, -O0):
<freeChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1141 <freeChar+0x31>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freeChar>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1128 <freeChar+0x18>
call   1030 <free@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @freeChar(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @free(i8* %2)
store i8* null, i8** %0
br label %6
6: ; preds = %4, %1
ret void
}
long cdflib_fifidint(double a) {
  if (a < 1.0) {
    return (long)0;
  } else {
    return (long)a;
  }
}


x86 assembly (clang, -O0):
<cdflib_fifidint>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  0xeef(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1129 <cdflib_fifidint+0x29>
movq   $0x0,-0x8(%rbp)
jmp    1133 <cdflib_fifidint+0x33>
cvttsd2si -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdflib_fifidint>:
xor    %eax,%eax
movsd  0xef6(%rip),%xmm1
ucomisd %xmm0,%xmm1
cvttsd2si %xmm0,%rcx
cmovbe %rcx,%rax
ret

LLVM IR (-O0):
define i64 @cdflib_fifidint(double %0) {
%2 = alloca i64
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp olt double %4, 1.000000e+00
br i1 %5, label %6, label %7
6: ; preds = %1
store i64 0, i64* %2
br label %10
7: ; preds = %1
%8 = load double, double* %3
%9 = fptosi double %8 to i64
store i64 %9, i64* %2
br label %10
10: ; preds = %7, %6
%11 = load i64, i64* %2
ret i64 %11
}

LLVM IR (-O2):
define i64 @cdflib_fifidint(double %0) {
%2 = fcmp olt double %0, 1.000000e+00
%3 = fptosi double %0 to i64
%4 = select i1 %2, i64 0, i64 %3
ret i64 %4
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int getVarIntSize(int32_t input) {
  for (unsigned char x = 1; x < 5; ++x)
    if (((input & -1) << (x * 7)) == 0)
      return x;
  return 5;
}


x86 assembly (clang, -O0):
<getVarIntSize>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movb   $0x1,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
cmp    $0x5,%eax
jge    114e <getVarIntSize+0x4e>
mov    -0x8(%rbp),%eax
and    $0xffffffff,%eax
movzbl -0x9(%rbp),%ecx
imul   $0x7,%ecx,%ecx
shl    %cl,%eax
cmp    $0x0,%eax
jne    113c <getVarIntSize+0x3c>
movzbl -0x9(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1155 <getVarIntSize+0x55>
jmp    1141 <getVarIntSize+0x41>
mov    -0x9(%rbp),%al
add    $0x1,%al
mov    %al,-0x9(%rbp)
jmp    110b <getVarIntSize+0xb>
movl   $0x5,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getVarIntSize>:
test   $0x1ffffff,%edi
je     1127 <getVarIntSize+0x27>
test   $0x3ffff,%edi
je     112d <getVarIntSize+0x2d>
test   $0x7ff,%edi
je     1133 <getVarIntSize+0x33>
and    $0xf,%edi
cmp    $0x1,%edi
mov    $0x5,%eax
sbb    $0x0,%eax
ret
mov    $0x1,%eax
ret
mov    $0x2,%eax
ret
mov    $0x3,%eax
ret

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

LLVM IR (-O2):
define i32 @getVarIntSize(i32 %0) {
%2 = and i32 %0, 33554431
%3 = icmp eq i32 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1
%5 = and i32 %0, 262143
%6 = icmp eq i32 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %4
%8 = and i32 %0, 2047
%9 = icmp eq i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = and i32 %0, 15
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, i32 4, i32 5
br label %14
14: ; preds = %10, %7, %4, %1
%15 = phi i32 [ 3, %7 ], [ 2, %4 ], [ 1, %1 ], [ %13, %10 ]
ret i32 %15
}
void foo756() {}


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

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

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

LLVM IR (-O2):
define void @foo756() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fatal(char *, int);
void syntax_error(int linenum) {
  fatal("Configuration file syntax error on line %d\n", linenum);
}


x86 assembly (clang, -O0):
<syntax_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <fatal@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [44 x i8] c"Configuration file syntax error on line %d\0A\00"
define void @syntax_error(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @fatal(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [44 x i8] c"Configuration file syntax error on line %d\0A\00"
define void @syntax_error(i32 %0) {
%2 = tail call i32 @fatal(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}