xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void cpSleep(int sleepMs) { usleep(sleepMs * 1000); }


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

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

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

LLVM IR (-O2):
define void @cpSleep(i32 %0) {
%2 = mul nsw i32 %0, 1000
%3 = tail call i32 @usleep(i32 %2)
ret void
}
double utencdate(year, month, day)
int year;
int month;
int day;
{
  return ((long)gregdate_to_julday(year, month, day) -
          (long)gregdate_to_julday(2001, 1, 1)) *
         86400.0;
}


x86 assembly (clang, -O0):
<utencdate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    $0x0,%al
call   1030 <gregdate_to_julday@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    $0x7d1,%edi
mov    $0x1,%edx
mov    %edx,%esi
mov    $0x0,%al
call   1030 <gregdate_to_julday@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
sub    %rcx,%rax
cvtsi2sd %rax,%xmm0
movsd  0xe9d(%rip),%xmm1
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utencdate>:
push   %rbx
xor    %eax,%eax
call   1030 <gregdate_to_julday@plt>
movslq %eax,%rbx
mov    $0x7d1,%edi
mov    $0x1,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <gregdate_to_julday@plt>
cltq
sub    %rax,%rbx
cvtsi2sd %rbx,%xmm0
mulsd  0xebd(%rip),%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define double @utencdate(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 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @gregdate_to_julday to i32 (i32, i32, i32, ...)*)(i32 %7, i32 %8, i32 %9)
%11 = sext i32 %10 to i64
%12 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @gregdate_to_julday to i32 (i32, i32, i32, ...)*)(i32 2001, i32 1, i32 1)
%13 = sext i32 %12 to i64
%14 = sub nsw i64 %11, %13
%15 = sitofp i64 %14 to double
%16 = fmul double %15, 8.640000e+04
ret double %16
}

LLVM IR (-O2):
define double @utencdate(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @gregdate_to_julday to i32 (i32, i32, i32, ...)*)(i32 %0, i32 %1, i32 %2)
%5 = sext i32 %4 to i64
%6 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @gregdate_to_julday to i32 (i32, i32, i32, ...)*)(i32 2001, i32 1, i32 1)
%7 = sext i32 %6 to i64
%8 = sub nsw i64 %5, %7
%9 = sitofp i64 %8 to double
%10 = fmul double %9, 8.640000e+04
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ clog_clearup();
int clog_start();
int clog_initilize() {
  clog_clearup();
  return clog_start();
}


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

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

LLVM IR (-O0):
define i32 @clog_initilize() {
%1 = call i32 (...) @clog_clearup()
%2 = call i32 (...) @clog_start()
ret i32 %2
}

LLVM IR (-O2):
define i32 @clog_initilize() {
%1 = tail call i32 (...) @clog_clearup()
%2 = tail call i32 (...) @clog_start()
ret i32 %2
}
int test_imm_00int8_reg(signed char val) {
  return ((val) & (0x00 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0x0,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    $0xffffffd8,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_00int8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, 0
%6 = icmp ne i32 %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_00int8_reg(i8 signext %0) {
ret i32 -40
}
/* Variables and functions */
int /*<<< orphan*/ eval(int);
int parse(int /*<<< orphan*/);
int /*<<< orphan*/ print(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
int main() {
  int t;
  while (1) {
    printf("> ");
    t = parse(stdin);
    print(eval(t));
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
call   1050 <parse@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <eval@plt>
mov    %eax,%edi
call   1040 <print@plt>
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
jmp    114f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xea5(%rip),%r14
mov    0x2e86(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
call   1040 <printf@plt>
mov    (%rbx),%edi
call   1060 <parse@plt>
mov    %eax,%edi
call   1070 <eval@plt>
mov    %eax,%edi
call   1050 <print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1170 <main+0x20>

LLVM IR (-O0):
@.str = [3 x i8] c"> \00"
@stdin = global i32 0
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %0, %3
%4 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @stdin
%6 = call i32 @parse(i32 %5)
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = call i32 @eval(i32 %7)
%9 = call i32 @print(i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %3
}

LLVM IR (-O2):
@.str = [3 x i8] c"> \00"
@stdin = global i32 0
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdin
%4 = tail call i32 @parse(i32 %3)
%5 = tail call i32 @eval(i32 %4)
%6 = tail call i32 @print(i32 %5)
%7 = tail call i32 @putchar(i32 10)
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M553_f(char *s) {
  debug("M553_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M553_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M553_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M553_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M553_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M553_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M553_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
int divisao(int dividendo, int divisor, int *resto) {
  *resto = dividendo % divisor;
  return (int)dividendo / divisor;
}


x86 assembly (clang, -O0):
<divisao>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    %edx,(%rax)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<divisao>:
mov    %rdx,%rcx
mov    %edi,%eax
cltd
idiv   %esi
mov    %edx,(%rcx)
ret

LLVM IR (-O0):
define i32 @divisao(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 = srem i32 %7, %8
%10 = load i32*, i32** %6
store i32 %9, i32* %10
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = sdiv i32 %11, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @divisao(i32 %0, i32 %1, i32* nocapture writeonly %2) {
%4 = srem i32 %0, %1
store i32 %4, i32* %2
%5 = sdiv i32 %0, %1
ret i32 %5
}
int Cyc_InsertChecks_visit_esc_fn_stmt(struct Cyc_Hashtable_Table *env,
                                       struct Cyc_Absyn_Stmt *s) {
  return 1;
}


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

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

LLVM IR (-O0):
%struct.Cyc_Hashtable_Table = type opaque
%struct.Cyc_Absyn_Stmt = type opaque
define i32 @Cyc_InsertChecks_visit_esc_fn_stmt(%struct.Cyc_Hashtable_Table* %0, %struct.Cyc_Absyn_Stmt* %1) {
%3 = alloca %struct.Cyc_Hashtable_Table*
%4 = alloca %struct.Cyc_Absyn_Stmt*
store %struct.Cyc_Hashtable_Table* %0, %struct.Cyc_Hashtable_Table** %3
store %struct.Cyc_Absyn_Stmt* %1, %struct.Cyc_Absyn_Stmt** %4
ret i32 1
}

LLVM IR (-O2):
%struct.Cyc_Hashtable_Table = type opaque
%struct.Cyc_Absyn_Stmt = type opaque
define i32 @Cyc_InsertChecks_visit_esc_fn_stmt(%struct.Cyc_Hashtable_Table* nocapture readnone %0, %struct.Cyc_Absyn_Stmt* nocapture readnone %1) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isalpha(int);
void t_isalpha_0xc6() {
  Assert_real((isalpha(198) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isalpha.c",
              995, ("isalpha should be 0 for 0xc6"));
}


x86 assembly (clang, -O0):
<t_isalpha_0xc6>:
push   %rbp
mov    %rsp,%rbp
mov    $0xc6,%edi
call   1030 <isalpha@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x3e3,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isalpha_0xc6>:
push   %rax
mov    $0xc6,%edi
call   1030 <isalpha@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x3e3,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalpha.c\00"
@.str.1 = [29 x i8] c"isalpha should be 0 for 0xc6\00"
define void @t_isalpha_0xc6() {
%1 = call i64 @isalpha(i32 198)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 995, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalpha.c\00"
@.str.1 = [29 x i8] c"isalpha should be 0 for 0xc6\00"
define void @t_isalpha_0xc6() {
%1 = tail call i64 @isalpha(i32 198)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 995, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
size_t parent(size_t ix) { return (ix - 1) / 2; }


x86 assembly (clang, -O0):
<parent>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
sub    $0x1,%rax
shr    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<parent>:
lea    -0x1(%rdi),%rax
shr    %rax
ret

LLVM IR (-O0):
define i64 @parent(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = sub i64 %3, 1
%5 = udiv i64 %4, 2
ret i64 %5
}

LLVM IR (-O2):
define i64 @parent(i64 %0) {
%2 = add i64 %0, -1
%3 = lshr i64 %2, 1
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ db(int);
void fscale() {
  db(0xD9);
  db(0xFD);
}


x86 assembly (clang, -O0):
<fscale>:
push   %rbp
mov    %rsp,%rbp
mov    $0xd9,%edi
call   1030 <db@plt>
mov    $0xfd,%edi
call   1030 <db@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fscale>:
push   %rax
mov    $0xd9,%edi
call   1030 <db@plt>
mov    $0xfd,%edi
pop    %rax
jmp    1030 <db@plt>

LLVM IR (-O0):
define void @fscale() {
%1 = call i32 @db(i32 217)
%2 = call i32 @db(i32 253)
ret void
}

LLVM IR (-O2):
define void @fscale() {
%1 = tail call i32 @db(i32 217)
%2 = tail call i32 @db(i32 253)
ret void
}
/* Variables and functions */
double fmod(double, int);
double mod(double x, int n) {
  x = fmod(x, n);
  if (x >= n) {
    x -= n;
  }
  if (x < 0) {
    x += n;
  }
  return x;
}


x86 assembly (clang, -O0):
<mod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%edi
call   1030 <fmod@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jb     1159 <mod+0x49>
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1176 <mod+0x66>
cvtsi2sdl -0xc(%rbp),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mod>:
push   %rbx
mov    %edi,%ebx
call   1030 <fmod@plt>
cvtsi2sd %ebx,%xmm1
movapd %xmm1,%xmm2
cmpnlesd %xmm0,%xmm2
andnpd %xmm1,%xmm2
subsd  %xmm2,%xmm0
xorpd  %xmm2,%xmm2
movapd %xmm0,%xmm3
cmpltsd %xmm2,%xmm3
andpd  %xmm3,%xmm1
movsd  0xeba(%rip),%xmm2
andnpd %xmm2,%xmm3
orpd   %xmm1,%xmm3
addsd  %xmm3,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define double @mod(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
store double %0, double* %3
store i32 %1, i32* %4
%5 = load double, double* %3
%6 = load i32, i32* %4
%7 = call double @fmod(double %5, i32 %6)
store double %7, double* %3
%8 = load double, double* %3
%9 = load i32, i32* %4
%10 = sitofp i32 %9 to double
%11 = fcmp oge double %8, %10
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i32, i32* %4
%14 = sitofp i32 %13 to double
%15 = load double, double* %3
%16 = fsub double %15, %14
store double %16, double* %3
br label %17
17: ; preds = %12, %2
%18 = load double, double* %3
%19 = fcmp olt double %18, 0.000000e+00
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = load i32, i32* %4
%22 = sitofp i32 %21 to double
%23 = load double, double* %3
%24 = fadd double %23, %22
store double %24, double* %3
br label %25
25: ; preds = %20, %17
%26 = load double, double* %3
ret double %26
}

LLVM IR (-O2):
define double @mod(double %0, i32 %1) {
%3 = tail call double @fmod(double %0, i32 %1)
%4 = sitofp i32 %1 to double
%5 = fcmp ult double %3, %4
%6 = select i1 %5, double 0.000000e+00, double %4
%7 = fsub double %3, %6
%8 = fcmp olt double %7, 0.000000e+00
%9 = select i1 %8, double %4, double -0.000000e+00
%10 = fadd double %7, %9
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ TimerHardware_Init();
int /*<<< orphan*/ TimerModel_Init();
void TimerConductor_Init() {
  TimerHardware_Init();
  TimerModel_Init();
}


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

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

LLVM IR (-O0):
define void @TimerConductor_Init() {
%1 = call i32 (...) @TimerHardware_Init()
%2 = call i32 (...) @TimerModel_Init()
ret void
}

LLVM IR (-O2):
define void @TimerConductor_Init() {
%1 = tail call i32 (...) @TimerHardware_Init()
%2 = tail call i32 (...) @TimerModel_Init()
ret void
}
void av_log() {}


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

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

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

LLVM IR (-O2):
define void @av_log() {
ret void
}
void onintr(signo) int signo __attribute__((__unused__));
{
  scr_clear();
  scr_end();
  exit(0);
}


x86 assembly (clang, -O0):
<onintr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <scr_clear@plt>
mov    $0x0,%al
call   1050 <scr_end@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<onintr>:
push   %rax
xor    %eax,%eax
call   1030 <scr_clear@plt>
xor    %eax,%eax
call   1050 <scr_end@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @onintr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @scr_clear()
%4 = call i32 (...) @scr_end()
unreachable
}

LLVM IR (-O2):
define void @onintr(i32 %0) {
%2 = tail call i32 (...) @scr_clear()
%3 = tail call i32 (...) @scr_end()
tail call void @exit(i32 0)
unreachable
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
void EventSwEventSet(uint32_t ui32SwEvent) {
  ;
  (*((volatile unsigned char *)(0x40083000 + 0x00000F00 + ui32SwEvent))) = 1;
}


x86 assembly (clang, -O0):
<EventSwEventSet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40083f00,%rax
movb   $0x1,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<EventSwEventSet>:
movb   $0x1,0x40083f00(%rdi)
ret

LLVM IR (-O0):
define void @EventSwEventSet(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add nsw i64 1074282240, %3
%5 = inttoptr i64 %4 to i8*
store volatile i8 1, i8* %5
ret void
}

LLVM IR (-O2):
define void @EventSwEventSet(i64 %0) {
%2 = add nsw i64 %0, 1074282240
%3 = inttoptr i64 %2 to i8*
store volatile i8 1, i8* %3
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
scalar_t__ readyn(char *);
int main() {
  int count;
  count = 1;
  do {
    printf("The counter value is %d\n", count++);
  } while (readyn("Do you want to continue"));
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
call   1040 <readyn@plt>
cmp    $0x0,%rax
jne    1136 <main+0x16>
mov    0x2e76(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x1,%esi
lea    0xed0(%rip),%r14
lea    0xee2(%rip),%rbx
nopw   0x0(%rax,%rax,1)
lea    0x1(%rsi),%ebp
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <readyn@plt>
mov    %ebp,%esi
test   %rax,%rax
jne    1140 <main+0x20>
mov    0x2e7f(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"The counter value is %d\0A\00"
@.str.1 = [24 x i8] c"Do you want to continue\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
br label %3
3: ; preds = %7, %0
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 1
store i32 %5, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %7
7: ; preds = %3
%8 = call i64 @readyn(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp ne i64 %8, 0
br i1 %9, label %3, label %10
10: ; preds = %7
%11 = load i32, i32* @EXIT_SUCCESS
ret i32 %11
}

LLVM IR (-O2):
@.str = [25 x i8] c"The counter value is %d\0A\00"
@.str.1 = [24 x i8] c"Do you want to continue\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 1, %0 ], [ %3, %1 ]
%3 = add nuw nsw i32 %2, 1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %2)
%5 = tail call i64 @readyn(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %1
7: ; preds = %1
%8 = load i32, i32* @EXIT_SUCCESS
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
testNotEqualTo() { printf("%d != %d = %d\n", 10, 4, 10 != 4); }


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

x86 assembly (clang, -O2):
<testNotEqualTo>:
lea    0xee9(%rip),%rdi
mov    $0xa,%esi
mov    $0x4,%edx
mov    $0x1,%ecx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"%d != %d = %d\0A\00"
define i32 @testNotEqualTo() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 10, i32 4, i32 1)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [15 x i8] c"%d != %d = %d\0A\00"
define i32 @testNotEqualTo() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 10, i32 4, i32 1)
ret i32 undef
}
/* Variables and functions */
void WI_End(void) {
  void WI_unloadData(void);
  WI_unloadData();
}


x86 assembly (clang, -O0):
<WI_End>:
push   %rbp
mov    %rsp,%rbp
call   1030 <WI_unloadData@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<WI_End>:
jmp    1030 <WI_unloadData@plt>

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

LLVM IR (-O2):
define void @WI_End() {
tail call void @WI_unloadData()
ret void
}
int ft_is_prime(int nb) {
  int i;
  i = 2;
  if (nb < 2)
    return (0);
  while (i < nb) {
    if (nb % i == 0)
      return (0);
    i++;
  }
  return (1);
}


x86 assembly (clang, -O0):
<ft_is_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1124 <ft_is_prime+0x24>
movl   $0x0,-0x4(%rbp)
jmp    1166 <ft_is_prime+0x66>
jmp    1129 <ft_is_prime+0x29>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    115f <ft_is_prime+0x5f>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1151 <ft_is_prime+0x51>
movl   $0x0,-0x4(%rbp)
jmp    1166 <ft_is_prime+0x66>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1129 <ft_is_prime+0x29>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_is_prime>:
xor    %ecx,%ecx
cmp    $0x2,%edi
jge    110a <ft_is_prime+0xa>
mov    %ecx,%eax
ret
jne    1112 <ft_is_prime+0x12>
mov    $0x1,%eax
ret
mov    $0x2,%esi
nopw   0x0(%rax,%rax,1)
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1107 <ft_is_prime+0x7>
add    $0x1,%esi
cmp    %esi,%edi
jne    1120 <ft_is_prime+0x20>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_is_prime(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = icmp eq i32 %0, 2
br i1 %4, label %12, label %7
5: ; preds = %7
%6 = icmp eq i32 %11, %0
br i1 %6, label %12, label %7
7: ; preds = %3, %5
%8 = phi i32 [ %11, %5 ], [ 2, %3 ]
%9 = srem i32 %0, %8
%10 = icmp eq i32 %9, 0
%11 = add nuw nsw i32 %8, 1
br i1 %10, label %12, label %5
12: ; preds = %7, %5, %3, %1
%13 = phi i32 [ 0, %1 ], [ 1, %3 ], [ 0, %7 ], [ 1, %5 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void funPrinti() {
  int i = 10;
  printf("i = %d", i);
}


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

x86 assembly (clang, -O2):
<funPrinti>:
lea    0xee9(%rip),%rdi
mov    $0xa,%esi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c"i = %d\00"
define void @funPrinti() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 10)
ret void
}
/* Variables and functions */
int rand();
int isOn() { return rand(); }


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

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

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

LLVM IR (-O2):
define i32 @isOn() {
%1 = tail call i32 (...) @rand()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void autoIndent(int levels) {
  int i;
  for (i = 0; i < levels; i++)
    printf("    ");
}


x86 assembly (clang, -O0):
<autoIndent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1148 <autoIndent+0x38>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <autoIndent+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<autoIndent>:
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    113d <autoIndent+0x2d>
mov    %edi,%ebx
lea    0xedf(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0xffffffff,%ebx
jne    1130 <autoIndent+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c" \00"
define void @autoIndent(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int first;
  int second;
  scanf("%d%d", &first, &second);
  if (second != 0 && first % second == 0) {
    printf("yes\n");
  } else {
    printf("no\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
je     116e <main+0x4e>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    116e <main+0x4e>
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
jmp    117a <main+0x5a>
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    (%rsp),%ecx
test   %ecx,%ecx
je     1147 <main+0x27>
mov    0x4(%rsp),%eax
cltd
idiv   %ecx
test   %edx,%edx
je     1150 <main+0x30>
lea    0xeb7(%rip),%rdi
jmp    1157 <main+0x37>
lea    0xeb1(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%d%d\00"
@.str.1 = [5 x i8] c"yes\0A\00"
@.str.2 = [4 x i8] c"no\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %0
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = srem i32 %8, %9
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %16
14: ; preds = %7, %0
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %12
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d%d\00"
@str = [3 x i8] c"no\00"
@str.3 = [4 x i8] c"yes\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %0
%9 = load i32, i32* %1
%10 = srem i32 %9, %6
%11 = icmp eq i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %8, %0
br label %13
13: ; preds = %8, %12
%14 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0), %12 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @str.3, i64 0, i64 0), %8 ]
%15 = call i32 @puts(i8* dereferenceable(1) %14)
ret i32 0
}
int sum_digits(int n) {
  if (n == 0)
    return 0;
  return n % 10 + sum_digits(n / 10);
}


x86 assembly (clang, -O0):
<sum_digits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1131 <sum_digits+0x21>
movl   $0x0,-0x4(%rbp)
jmp    1159 <sum_digits+0x49>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <sum_digits@plt>
mov    -0xc(%rbp),%edx
add    %eax,%edx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum_digits>:
xor    %eax,%eax
test   %edi,%edi
je     113b <sum_digits+0x3b>
cs nopw 0x0(%rax,%rax,1)
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
lea    (%rdi,%rdi,1),%edx
lea    (%rdx,%rdx,4),%edx
mov    %ecx,%esi
sub    %edx,%esi
add    %esi,%eax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <sum_digits+0x10>
ret

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

LLVM IR (-O2):
define i32 @sum_digits(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ %0, %1 ]
%5 = phi i32 [ %8, %3 ], [ 0, %1 ]
%6 = srem i32 %4, 10
%7 = sdiv i32 %4, 10
%8 = add nsw i32 %6, %5
%9 = add i32 %4, 9
%10 = icmp ult i32 %9, 19
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %8, %3 ]
ret i32 %12
}
int class_upper(const char c) { return ((c >= 'A') && (c <= 'Z')); }


x86 assembly (clang, -O0):
<class_upper>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x41,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <class_upper+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<class_upper>:
add    $0xbf,%dil
xor    %eax,%eax
cmp    $0x1a,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @class_upper(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 65
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 90
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):
define i32 @class_upper(i8 signext %0) {
%2 = add i8 %0, -65
%3 = icmp ult i8 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
scomp(a, b, s) char s;
{
  if (s == '+')
    return (a > b);
  if (s == '-')
    return (a < (b * -1));
  return (a == b);
}


x86 assembly (clang, -O0):
<scomp>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
cmp    $0x2b,%eax
jne    1132 <scomp+0x32>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1169 <scomp+0x69>
movsbl -0xd(%rbp),%eax
cmp    $0x2d,%eax
jne    1158 <scomp+0x58>
mov    -0x8(%rbp),%eax
imul   $0xffffffff,-0xc(%rbp),%ecx
cmp    %ecx,%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1169 <scomp+0x69>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<scomp>:
shl    $0x18,%edx
cmp    $0x2d000000,%edx
je     1117 <scomp+0x17>
cmp    $0x2b000000,%edx
jne    1122 <scomp+0x22>
cmp    %esi,%edi
jmp    111b <scomp+0x1b>
neg    %esi
cmp    %edi,%esi
setg   %al
movzbl %al,%eax
ret
cmp    %esi,%edi
sete   %al
movzbl %al,%eax
ret

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

LLVM IR (-O2):
define i32 @scomp(i32 %0, i32 %1, i32 %2) {
%4 = shl i32 %2, 24
switch i32 %4, label %10 [
i32 721420288, label %5
i32 754974720, label %7
]
5: ; preds = %3
%6 = icmp sgt i32 %0, %1
br label %12
7: ; preds = %3
%8 = sub nsw i32 0, %1
%9 = icmp sgt i32 %8, %0
br label %12
10: ; preds = %3
%11 = icmp eq i32 %0, %1
br label %12
12: ; preds = %10, %7, %5
%13 = phi i1 [ %6, %5 ], [ %9, %7 ], [ %11, %10 ]
%14 = zext i1 %13 to i32
ret i32 %14
}
/* Type definitions */
struct list_item {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ list_insert(struct list_item *, struct list_item *);
void list_append(struct list_item *list, struct list_item *item) {
  list_insert(list, item);
}


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

x86 assembly (clang, -O2):
<list_append>:
jmp    1030 <list_insert@plt>

LLVM IR (-O0):
%struct.list_item = type { i32 }
define void @list_append(%struct.list_item* %0, %struct.list_item* %1) {
%3 = alloca %struct.list_item*
%4 = alloca %struct.list_item*
store %struct.list_item* %0, %struct.list_item** %3
store %struct.list_item* %1, %struct.list_item** %4
%5 = load %struct.list_item*, %struct.list_item** %3
%6 = load %struct.list_item*, %struct.list_item** %4
%7 = call i32 @list_insert(%struct.list_item* %5, %struct.list_item* %6)
ret void
}

LLVM IR (-O2):
%struct.list_item = type { i32 }
define void @list_append(%struct.list_item* %0, %struct.list_item* %1) {
%3 = tail call i32 @list_insert(%struct.list_item* %0, %struct.list_item* %1)
ret void
}
void gtk_im_context_simple_new() {}


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

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

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

LLVM IR (-O2):
define void @gtk_im_context_simple_new() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main(int argc, char *argv[]) {
  char to[4];
  char *str = "nok";
  strncpy(to, str, 4);
  printf("%s\n", to);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    -0x14(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
lea    -0x14(%rbp),%rsi
lea    0xea6(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rsi
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <strncpy@plt>
lea    0xebf(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"nok\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4 x i8]
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 0
%9 = load i8*, i8** %7
%10 = call i32 @strncpy(i8* %8, i8* %9, i32 4)
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 0
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"nok\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [4 x i8]
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%5 = call i32 @strncpy(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
}
int test_imm_1Dint64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x1D << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_1Dint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 1900544
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int fibo_r(int);
int main(void) {
  int counter = 1000;
  int counter2 = counter;
  int fib;
  while (counter--) {
    fib = fibo_r(20);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3e8,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1152 <main+0x42>
mov    $0x14,%edi
call   1030 <fibo_r@plt>
mov    %eax,-0x10(%rbp)
jmp    112c <main+0x1c>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xfffffc18,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0x14,%edi
call   1030 <fibo_r@plt>
inc    %ebx
jne    1120 <main+0x10>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 1000, i32* %2
%5 = load i32, i32* %2
store i32 %5, i32* %3
br label %6
6: ; preds = %10, %0
%7 = load i32, i32* %2
%8 = add nsw i32 %7, -1
store i32 %8, i32* %2
%9 = icmp ne i32 %7, 0
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = call i32 @fibo_r(i32 20)
store i32 %11, i32* %4
br label %6
12: ; preds = %6
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 1000, %0 ], [ %3, %1 ]
%3 = add nsw i32 %2, -1
%4 = tail call i32 @fibo_r(i32 20)
%5 = icmp eq i32 %3, 0
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ IPC_RMID;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ semctl(int, int /*<<< orphan*/, int /*<<< orphan*/,
                  int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int sem_remove(int id) {
  if (semctl(id, 0, IPC_RMID, 0) < 0) {
    fprintf(stderr, "Error: unable to remove semaphore\n");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<sem_remove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2ea3(%rip),%rax
mov    (%rax),%edx
xor    %ecx,%ecx
mov    %ecx,%esi
call   1040 <semctl@plt>
cmp    $0x0,%rax
jge    116b <sem_remove+0x4b>
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
lea    0xea6(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1172 <sem_remove+0x52>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sem_remove>:
push   %rbx
mov    0x2eb0(%rip),%rax
mov    (%rax),%edx
xor    %ebx,%ebx
xor    %esi,%esi
xor    %ecx,%ecx
call   1040 <semctl@plt>
test   %rax,%rax
jns    1154 <sem_remove+0x34>
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
lea    0xeb6(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@IPC_RMID = global i32 0
@stderr = global i32 0
@.str = [35 x i8] c"Error: unable to remove semaphore\0A\00"
define i32 @sem_remove(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = load i32, i32* @IPC_RMID
%6 = call i64 @semctl(i32 %4, i32 0, i32 %5, i32 0)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %12
11: ; preds = %1
store i32 0, i32* %2
br label %12
12: ; preds = %11, %8
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@IPC_RMID = global i32 0
@stderr = global i32 0
@.str = [35 x i8] c"Error: unable to remove semaphore\0A\00"
define i32 @sem_remove(i32 %0) {
%2 = load i32, i32* @IPC_RMID
%3 = tail call i64 @semctl(i32 %0, i32 0, i32 %2, i32 0)
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %1, %5
%9 = phi i32 [ -1, %5 ], [ 0, %1 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ I2C_HAL_delay_10th_usec(int);
int /*<<< orphan*/ I2C_SCL_LOW();
int /*<<< orphan*/ I2C_SDA_LOW();
void I2C_START(void) {
  I2C_SDA_LOW();
  I2C_HAL_delay_10th_usec(40);
  ;
  I2C_SCL_LOW();
}


x86 assembly (clang, -O0):
<I2C_START>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <I2C_SDA_LOW@plt>
mov    $0x28,%edi
call   1040 <I2C_HAL_delay_10th_usec@plt>
mov    $0x0,%al
call   1030 <I2C_SCL_LOW@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2C_START>:
push   %rax
xor    %eax,%eax
call   1050 <I2C_SDA_LOW@plt>
mov    $0x28,%edi
call   1040 <I2C_HAL_delay_10th_usec@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <I2C_SCL_LOW@plt>

LLVM IR (-O0):
define void @I2C_START() {
%1 = call i32 (...) @I2C_SDA_LOW()
%2 = call i32 @I2C_HAL_delay_10th_usec(i32 40)
%3 = call i32 (...) @I2C_SCL_LOW()
ret void
}

LLVM IR (-O2):
define void @I2C_START() {
%1 = tail call i32 (...) @I2C_SDA_LOW()
%2 = tail call i32 @I2C_HAL_delay_10th_usec(i32 40)
%3 = tail call i32 (...) @I2C_SCL_LOW()
ret void
}
/* Variables and functions */
int INT_MAX;
int multiply_overflow(int a, int multiplier) {
  return (INT_MAX / multiplier) < a;
}


x86 assembly (clang, -O0):
<multiply_overflow>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2ed7(%rip),%rax
mov    (%rax),%eax
cltd
idivl  -0x8(%rbp)
cmp    -0x4(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<multiply_overflow>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
cltd
idiv   %esi
xor    %ecx,%ecx
cmp    %edi,%eax
setl   %cl
mov    %ecx,%eax
ret

LLVM IR (-O0):
@INT_MAX = global i32 0
define i32 @multiply_overflow(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* @INT_MAX
%6 = load i32, i32* %4
%7 = sdiv i32 %5, %6
%8 = load i32, i32* %3
%9 = icmp slt i32 %7, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
@INT_MAX = global i32 0
define i32 @multiply_overflow(i32 %0, i32 %1) {
%3 = load i32, i32* @INT_MAX
%4 = sdiv i32 %3, %1
%5 = icmp slt i32 %4, %0
%6 = zext i1 %5 to i32
ret i32 %6
}