xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ chroot(char *);
int /*<<< orphan*/ foo();
void f1(void) {
  chroot("/usr/local");
  foo();
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <chroot@plt>
mov    $0x0,%al
call   1040 <foo@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <chroot@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <foo@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"/usr/local\00"
define void @f1() {
%1 = call i32 @chroot(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @foo()
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"/usr/local\00"
define void @f1() {
%1 = tail call i32 @chroot(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @foo()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void clear_buffer(void) {
  printf("\e");
  printf("[2J");
  printf("\e");
  printf("[H");
}


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

x86 assembly (clang, -O2):
<clear_buffer>:
push   %rax
mov    $0x1b,%edi
call   1030 <putchar@plt>
lea    0xece(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1b,%edi
call   1030 <putchar@plt>
lea    0xebc(%rip),%rdi
pop    %rax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\1B\00"
@.str.1 = [4 x i8] c"[2J\00"
@.str.2 = [3 x i8] c"[H\00"
define void @clear_buffer() {
%1 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"[2J\00"
@.str.2 = [3 x i8] c"[H\00"
define void @clear_buffer() {
%1 = tail call i32 @putchar(i32 27)
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @putchar(i32 27)
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int pow(double, int);
double gpnr(double x) { return (3 * pow(x, 2) + 8 * x); }


x86 assembly (clang, -O0):
<gpnr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
imul   $0x3,%eax,%eax
cvtsi2sd %eax,%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  0xec0(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpnr>:
push   %rax
movsd  %xmm0,(%rsp)
mov    $0x2,%edi
call   1030 <pow@plt>
lea    (%rax,%rax,2),%eax
cvtsi2sd %eax,%xmm1
movsd  (%rsp),%xmm0
mulsd  0xecc(%rip),%xmm0
addsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @gpnr(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @pow(double %3, i32 2)
%5 = mul nsw i32 3, %4
%6 = sitofp i32 %5 to double
%7 = load double, double* %2
%8 = call double @llvm.fmuladd.f64(double 8.000000e+00, double %7, double %6)
ret double %8
}

LLVM IR (-O2):
define double @gpnr(double %0) {
%2 = tail call i32 @pow(double %0, i32 2)
%3 = mul nsw i32 %2, 3
%4 = sitofp i32 %3 to double
%5 = tail call double @llvm.fmuladd.f64(double %0, double 8.000000e+00, double %4)
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ EMLINK;
int /*<<< orphan*/ errno;
int _link(char *oldName, char *newName) {
  errno = EMLINK;
  return -1;
}


x86 assembly (clang, -O0):
<_link>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2edd(%rip),%rax
mov    (%rax),%ecx
mov    0x2ebc(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_link>:
mov    0x2ee9(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@EMLINK = global i32 0
@errno = global i32 0
define i32 @_link(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @EMLINK
store i32 %5, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@EMLINK = global i32 0
@errno = global i32 0
define i32 @_link(i8* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @EMLINK
store i32 %3, i32* @errno
ret i32 -1
}
int compara_int(void *a, void *b) {
  int *x = (int *)a;
  int *y = (int *)b;
  if ((*x) > (*y)) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<compara_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jle    113a <compara_int+0x3a>
movl   $0x1,-0x4(%rbp)
jmp    1141 <compara_int+0x41>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compara_int>:
mov    (%rdi),%ecx
xor    %eax,%eax
cmp    (%rsi),%ecx
setg   %al
ret

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

LLVM IR (-O2):
define i32 @compara_int(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp sgt i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
int wakeup_source_pm8xxx_add_irq(unsigned int irq) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @wakeup_source_pm8xxx_add_irq(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ init_torpedo();
int /*<<< orphan*/ init_torpedo_trails();
void init_torps(void) {
  init_torpedo();
  init_torpedo_trails();
  return;
}


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

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

LLVM IR (-O0):
define void @init_torps() {
%1 = call i32 (...) @init_torpedo()
%2 = call i32 (...) @init_torpedo_trails()
ret void
}

LLVM IR (-O2):
define void @init_torps() {
%1 = tail call i32 (...) @init_torpedo()
%2 = tail call i32 (...) @init_torpedo_trails()
ret void
}
help(str, swp) char *str;
{
  printf("syntax: %s\n", str);
  printf("  switches are:\n");
  printsw("", swp);
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1040 <printsw@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<help>:
push   %rbx
mov    %esi,%ebx
mov    %rdi,%rsi
lea    0xec3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb4(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
pop    %rbx
jmp    1050 <printsw@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"syntax: %s\0A\00"
@.str.1 = [17 x i8] c" switches are:\0A\00"
@.str.2 = [1 x i8] zeroinitializer
define i32 @help(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i8*, i8** %4
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* %5
%10 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @printsw to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
@.str = [12 x i8] c"syntax: %s\0A\00"
@.str.2 = [1 x i8] zeroinitializer
@str = [16 x i8] c" switches are:\00"
define i32 @help(i8* %0, i32 %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @printsw to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i32 %1)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int distance = 100;
  printf("You are %d miles away.\n", distance);
  printf("Create a Makefile.\n");
  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)
movl   $0x64,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
mov    $0x64,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"You are %d miles away.\0A\00"
@.str.1 = [20 x i8] c"Create a Makefile.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 100, i32* %6
%7 = load i32, i32* %6
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"You are %d miles away.\0A\00"
@str = [19 x i8] c"Create a Makefile.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 100)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_cmpgt_epi32(int /*<<< orphan*/, int /*<<< orphan*/);
__m128i __attribute__((__always___, __nodebug__))
_mm_cmplt_epi32(__m128i a, __m128i b) {
  return _mm_cmpgt_epi32(b, a);
}


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

x86 assembly (clang, -O2):
<_mm_cmplt_epi32>:
mov    %edi,%eax
mov    %esi,%edi
mov    %eax,%esi
jmp    1030 <_mm_cmpgt_epi32@plt>

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

LLVM IR (-O2):
define i32 @_mm_cmplt_epi32(i32 %0, i32 %1) {
%3 = tail call i32 @_mm_cmpgt_epi32(i32 %1, i32 %0)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ ClWait(int);
int /*<<< orphan*/ Cl_tab(int);
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Change tab continous press Ctrl-C to exit\n");
  while (1) {
    Cl_tab(0);
    ClWait(1000);
    Cl_tab(1);
    ClWait(1000);
    Cl_tab(2);
    ClWait(1000);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <Cl_tab@plt>
mov    $0x3e8,%edi
call   1040 <ClWait@plt>
mov    $0x1,%edi
call   1050 <Cl_tab@plt>
mov    $0x3e8,%edi
call   1040 <ClWait@plt>
mov    $0x2,%edi
call   1050 <Cl_tab@plt>
mov    $0x3e8,%edi
call   1040 <ClWait@plt>
jmp    114b <main+0x1b>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
nopl   (%rax)
xor    %edi,%edi
call   1050 <Cl_tab@plt>
mov    $0x3e8,%edi
call   1040 <ClWait@plt>
mov    $0x1,%edi
call   1050 <Cl_tab@plt>
mov    $0x3e8,%edi
call   1040 <ClWait@plt>
mov    $0x2,%edi
call   1050 <Cl_tab@plt>
mov    $0x3e8,%edi
call   1040 <ClWait@plt>
jmp    1140 <main+0x10>

LLVM IR (-O0):
@.str = [43 x i8] c"Change tab continous press Ctrl-C to exit\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %0, %3
%4 = call i32 @Cl_tab(i32 0)
%5 = call i32 @ClWait(i32 1000)
%6 = call i32 @Cl_tab(i32 1)
%7 = call i32 @ClWait(i32 1000)
%8 = call i32 @Cl_tab(i32 2)
%9 = call i32 @ClWait(i32 1000)
br label %3
}

LLVM IR (-O2):
@str = [42 x i8] c"Change tab continous press Ctrl-C to exit\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
%3 = tail call i32 @Cl_tab(i32 0)
%4 = tail call i32 @ClWait(i32 1000)
%5 = tail call i32 @Cl_tab(i32 1)
%6 = tail call i32 @ClWait(i32 1000)
%7 = tail call i32 @Cl_tab(i32 2)
%8 = tail call i32 @ClWait(i32 1000)
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ fn0000000000401620();
void fn00000000004016D0() {
  fn0000000000401620();
  return;
}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ chomp(char *);
char *fgets(char *, int, int /*<<< orphan*/ *);
char *fgets_chomp(char *a, int b, FILE *c) {
  char *ret = fgets(a, b, c);
  chomp(a);
  return ret;
}


x86 assembly (clang, -O0):
<fgets_chomp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <fgets@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <chomp@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgets_chomp>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <fgets@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <chomp@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @fgets_chomp(i8* %0, i32 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = load i32*, i32** %6
%11 = call i8* @fgets(i8* %8, i32 %9, i32* %10)
store i8* %11, i8** %7
%12 = load i8*, i8** %4
%13 = call i32 @chomp(i8* %12)
%14 = load i8*, i8** %7
ret i8* %14
}

LLVM IR (-O2):
define i8* @fgets_chomp(i8* %0, i32 %1, i32* nocapture %2) {
%4 = tail call i8* @fgets(i8* %0, i32 %1, i32* %2)
%5 = tail call i32 @chomp(i8* %0)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hello Da_min,\nHello Er_min,\nHello Xiao_ming!");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [45 x i8] c"Hello Da_min,\0AHello Er_min,\0AHello Xiao_ming!\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [45 x i8] c"Hello Da_min,\0AHello Er_min,\0AHello Xiao_ming!\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ EACCES;
int /*<<< orphan*/ O_RDONLY;
int _close(int);
int _open(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ errno;
int access(const char *fn, int flags) {
  int fd;
  fd = _open(fn, O_RDONLY);
  if (fd >= 0) {
    return _close(fd);
  }
  errno = EACCES;
  return -1;
}


x86 assembly (clang, -O0):
<access>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2eae(%rip),%rax
mov    (%rax),%esi
call   1030 <_open@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     115e <access+0x3e>
mov    -0x18(%rbp),%edi
call   1040 <_close@plt>
mov    %eax,-0x4(%rbp)
jmp    1177 <access+0x57>
mov    0x2e7b(%rip),%rax
mov    (%rax),%ecx
mov    0x2e62(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<access>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
call   1030 <_open@plt>
test   %eax,%eax
js     113b <access+0x1b>
mov    %eax,%edi
pop    %rax
jmp    1040 <_close@plt>
mov    0x2e9e(%rip),%rax
mov    (%rax),%eax
mov    0x2e85(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@O_RDONLY = global i32 0
@EACCES = global i32 0
@errno = global i32 0
define i32 @access(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%7 = load i8*, i8** %4
%8 = load i32, i32* @O_RDONLY
%9 = call i32 @_open(i8* %7, i32 %8)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp sge i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i32, i32* %6
%14 = call i32 @_close(i32 %13)
store i32 %14, i32* %3
br label %17
15: ; preds = %2
%16 = load i32, i32* @EACCES
store i32 %16, i32* @errno
store i32 -1, i32* %3
br label %17
17: ; preds = %15, %12
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
@EACCES = global i32 0
@errno = global i32 0
define i32 @access(i8* %0, i32 %1) {
%3 = load i32, i32* @O_RDONLY
%4 = tail call i32 @_open(i8* %0, i32 %3)
%5 = icmp sgt i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @_close(i32 %4)
br label %10
8: ; preds = %2
%9 = load i32, i32* @EACCES
store i32 %9, i32* @errno
br label %10
10: ; preds = %8, %6
%11 = phi i32 [ %7, %6 ], [ -1, %8 ]
ret i32 %11
}
prprompt(as) char *as;
{ prs(as); }


x86 assembly (clang, -O0):
<prprompt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <prs@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @prprompt(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @prs to i32 (i8*, ...)*)(i8* %0)
ret i32 undef
}
/* Type definitions */
typedef void uint8_t;

/* Variables and functions */
int /*<<< orphan*/ memset(void *, int, size_t);
void *mempset(void *s, int c, size_t n) {
  memset(s, c, n);
  return (uint8_t *)s + n;
}


x86 assembly (clang, -O0):
<mempset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <memset@plt>
mov    -0x8(%rbp),%rax
add    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mempset>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
call   1030 <memset@plt>
add    %r14,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @mempset(i8* %0, i32 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i64
store i8* %0, i8** %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i64, i64* %6
%10 = call i32 @memset(i8* %7, i32 %8, i64 %9)
%11 = load i8*, i8** %4
%12 = load i64, i64* %6
%13 = getelementptr i8, i8* %11, i64 %12
ret i8* %13
}

LLVM IR (-O2):
define i8* @mempset(i8* %0, i32 %1, i64 %2) {
%4 = tail call i32 @memset(i8* %0, i32 %1, i64 %2)
%5 = getelementptr i8, i8* %0, i64 %2
ret i8* %5
}
int word_length(const char *s, int i, int j, char c) {
  while (s[i] && s[i] != c) {
    ++i;
    ++j;
  }
  return (j);
}


x86 assembly (clang, -O0):
<word_length>:
push   %rbp
mov    %rsp,%rbp
mov    %cl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x12(%rbp)
je     1145 <word_length+0x45>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    1155 <word_length+0x55>
jmp    116c <word_length+0x6c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1113 <word_length+0x13>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<word_length>:
mov    %edx,%eax
movslq %esi,%rsi
mov    (%rdi,%rsi,1),%dl
test   %dl,%dl
je     1132 <word_length+0x32>
cmp    %cl,%dl
je     1132 <word_length+0x32>
add    %rdi,%rsi
add    $0x1,%rsi
nopw   0x0(%rax,%rax,1)
add    $0x1,%eax
movzbl (%rsi),%edx
test   %dl,%dl
je     1132 <word_length+0x32>
add    $0x1,%rsi
cmp    %cl,%dl
jne    1120 <word_length+0x20>
ret

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

LLVM IR (-O2):
define i32 @word_length(i8* nocapture %0, i32 %1, i32 %2, i8 signext %3) {
%5 = sext i32 %1 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
%9 = icmp eq i8 %7, %3
%10 = or i1 %8, %9
br i1 %10, label %21, label %11
11: ; preds = %4, %11
%12 = phi i64 [ %14, %11 ], [ %5, %4 ]
%13 = phi i32 [ %15, %11 ], [ %2, %4 ]
%14 = add i64 %12, 1
%15 = add nsw i32 %13, 1
%16 = getelementptr inbounds i8, i8* %0, i64 %14
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
%19 = icmp eq i8 %17, %3
%20 = or i1 %18, %19
br i1 %20, label %21, label %11
21: ; preds = %11, %4
%22 = phi i32 [ %2, %4 ], [ %15, %11 ]
ret i32 %22
}
void LowerString(s) char *s;
{
  while (*s) {
    if (isupper(*s))
      *s += ('a' - 'A');
    s++;
  }
}


x86 assembly (clang, -O0):
<LowerString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     115b <LowerString+0x4b>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isupper@plt>
cmp    $0x0,%eax
je     114a <LowerString+0x3a>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
add    $0x20,%ecx
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <LowerString+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LowerString>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%bpl
test   %bpl,%bpl
je     1153 <LowerString+0x43>
mov    %rdi,%rbx
add    $0x1,%rbx
jmp    113c <LowerString+0x2c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rbx),%ebp
add    $0x1,%rbx
test   %bpl,%bpl
je     1153 <LowerString+0x43>
movsbl %bpl,%edi
call   1030 <isupper@plt>
test   %eax,%eax
je     1130 <LowerString+0x20>
add    $0x20,%bpl
mov    %bpl,-0x1(%rbx)
jmp    1130 <LowerString+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @LowerString(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %12
%5 = phi i8 [ %14, %12 ], [ %2, %1 ]
%6 = phi i8* [ %13, %12 ], [ %0, %1 ]
%7 = sext i8 %5 to i32
%8 = tail call i32 @isupper(i32 %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %4
%11 = add i8 %5, 32
store i8 %11, i8* %6
br label %12
12: ; preds = %10, %4
%13 = getelementptr inbounds i8, i8* %6, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %4
16: ; preds = %12, %1
ret void
}
char *get_basename(const char *filename) {
  char *base_filename = (char *)filename;
  while (*filename != '\0') {
    if (*filename == '/') {
      filename++;
      if (*filename != '\0')
        base_filename = (char *)filename;
    } else
      filename++;
  }
  return base_filename;
}


x86 assembly (clang, -O0):
<get_basename>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     116a <get_basename+0x6a>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1159 <get_basename+0x59>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1154 <get_basename+0x54>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1165 <get_basename+0x65>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <get_basename+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_basename>:
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rdi
movzbl -0x1(%rdi),%ecx
test   %cl,%cl
je     112a <get_basename+0x2a>
cmp    $0x2f,%cl
jne    1110 <get_basename+0x10>
cmpb   $0x0,(%rdi)
cmovne %rdi,%rax
jmp    1110 <get_basename+0x10>
ret

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

LLVM IR (-O2):
define i8* @get_basename(i8* %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i8* [ %9, %8 ], [ %0, %1 ]
%4 = phi i8* [ %12, %8 ], [ %0, %1 ]
br label %5
5: ; preds = %2, %13
%6 = phi i8* [ %14, %13 ], [ %3, %2 ]
%7 = load i8, i8* %6
switch i8 %7, label %13 [
i8 0, label %15
i8 47, label %8
]
8: ; preds = %5
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
%12 = select i1 %11, i8* %4, i8* %9
br label %2
13: ; preds = %5
%14 = getelementptr inbounds i8, i8* %6, i64 1
br label %5
15: ; preds = %5
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ arm_ror(int /*<<< orphan*/);
int /*<<< orphan*/ t16_data_rdn3_op();
void t16_ror() { arm_ror(t16_data_rdn3_op()); }


x86 assembly (clang, -O0):
<t16_ror>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <t16_data_rdn3_op@plt>
mov    %eax,%edi
call   1030 <arm_ror@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t16_ror>:
push   %rax
xor    %eax,%eax
call   1040 <t16_data_rdn3_op@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <arm_ror@plt>

LLVM IR (-O0):
define void @t16_ror() {
%1 = call i32 (...) @t16_data_rdn3_op()
%2 = call i32 @arm_ror(i32 %1)
ret void
}

LLVM IR (-O2):
define void @t16_ror() {
%1 = tail call i32 (...) @t16_data_rdn3_op()
%2 = tail call i32 @arm_ror(i32 %1)
ret void
}
void swap_2(void *s) {
  char tmp;
  tmp = *((char *)s + 0);
  *((char *)s + 0) = *((char *)s + 1);
  *((char *)s + 1) = tmp;
}


x86 assembly (clang, -O0):
<swap_2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_2>:
rolw   $0x8,(%rdi)
ret

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

LLVM IR (-O2):
define void @swap_2(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = getelementptr inbounds i8, i8* %0, i64 1
%4 = load i8, i8* %3
store i8 %4, i8* %0
store i8 %2, i8* %3
ret void
}
/* Variables and functions */
int EOF;
int /*<<< orphan*/ printf(char *, int);
int main(void) { printf("EOF:\t%x", EOF); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"EOF:\09%x\00"
@EOF = global i32 0
define i32 @main() {
%1 = load i32, i32* @EOF
%2 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"EOF:\09%x\00"
@EOF = global i32 0
define i32 @main() {
%1 = load i32, i32* @EOF
%2 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
int test_imm_10int16_reg(short val) {
  return ((val) & (0x10 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_10int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0x10,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_10int16_reg>:
test   $0x10,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_10int16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, 16
%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_10int16_reg(i16 signext %0) {
%2 = and i16 %0, 16
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Это строчка с пробелами и русскими буквами");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [79 x i8] c"\D0\AD\D1\82\D0\BE \D1\81\D1\82\D1\80\D0\BE\D1\87\D0\BA\D0\B0 \D1\81 \D0\BF\D1\80\D0\BE\D0\B1\D0\B5\D0\BB\D0\B0\D0\BC\D0\B8 \D0\B8 \D1\80\D1\83\D1\81\D1\81\D0\BA\D0\B8\D0\BC\D0\B8 \D0\B1\D1\83\D0\BA\D0\B2\D0\B0\D0\BC\D0\B8\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [79 x i8] c"\D0\AD\D1\82\D0\BE \D1\81\D1\82\D1\80\D0\BE\D1\87\D0\BA\D0\B0 \D1\81 \D0\BF\D1\80\D0\BE\D0\B1\D0\B5\D0\BB\D0\B0\D0\BC\D0\B8 \D0\B8 \D1\80\D1\83\D1\81\D1\81\D0\BA\D0\B8\D0\BC\D0\B8 \D0\B1\D1\83\D0\BA\D0\B2\D0\B0\D0\BC\D0\B8\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void tsi2dt(isec, date, time) int isec;
double *date;
double *time;
{ ts2dt(tsi2ts(isec), date, time); }


x86 assembly (clang, -O0):
<tsi2dt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1040 <tsi2ts@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1030 <ts2dt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tsi2dt>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
xor    %eax,%eax
call   1040 <tsi2ts@plt>
mov    %eax,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <ts2dt@plt>

LLVM IR (-O0):
define void @tsi2dt(i32 %0, double* %1, double* %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca double*
store i32 %0, i32* %4
store double* %1, double** %5
store double* %2, double** %6
%7 = load i32, i32* %4
%8 = call i32 (i32, ...) bitcast (i32 (...)* @tsi2ts to i32 (i32, ...)*)(i32 %7)
%9 = load double*, double** %5
%10 = load double*, double** %6
%11 = call i32 (i32, double*, double*, ...) bitcast (i32 (...)* @ts2dt to i32 (i32, double*, double*, ...)*)(i32 %8, double* %9, double* %10)
ret void
}

LLVM IR (-O2):
define void @tsi2dt(i32 %0, double* %1, double* %2) {
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @tsi2ts to i32 (i32, ...)*)(i32 %0)
%5 = tail call i32 (i32, double*, double*, ...) bitcast (i32 (...)* @ts2dt to i32 (i32, double*, double*, ...)*)(i32 %4, double* %1, double* %2)
ret void
}
/* Variables and functions */
int RE_Manipulate(char);
int RE_Sub() { return (RE_Manipulate('s')); }


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

x86 assembly (clang, -O2):
<RE_Sub>:
mov    $0x73,%edi
jmp    1030 <RE_Manipulate@plt>

LLVM IR (-O0):
define i32 @RE_Sub() {
%1 = call i32 @RE_Manipulate(i8 signext 115)
ret i32 %1
}

LLVM IR (-O2):
define i32 @RE_Sub() {
%1 = tail call i32 @RE_Manipulate(i8 signext 115)
ret i32 %1
}
void I2CMasterStart(unsigned int baseAdd) {
  (*((volatile unsigned int *)(baseAdd + (0xA4)))) |= (0x00000001u);
}


x86 assembly (clang, -O0):
<I2CMasterStart>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa4,%eax
mov    %eax,%eax
mov    (%rax),%ecx
or     $0x1,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2CMasterStart>:
add    $0xa4,%edi
orl    $0x1,(%rdi)
ret

LLVM IR (-O0):
define void @I2CMasterStart(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add i32 %3, 164
%5 = zext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
%7 = load volatile i32, i32* %6
%8 = or i32 %7, 1
store volatile i32 %8, i32* %6
ret void
}

LLVM IR (-O2):
define void @I2CMasterStart(i32 %0) {
%2 = add i32 %0, 164
%3 = zext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
%5 = load volatile i32, i32* %4
%6 = or i32 %5, 1
store volatile i32 %6, i32* %4
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int ferror(int /*<<< orphan*/ *);
int c_ferror(void *stream) { return ferror((FILE *)stream); }


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

x86 assembly (clang, -O2):
<c_ferror>:
jmp    1030 <ferror@plt>

LLVM IR (-O0):
define i32 @c_ferror(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = call i32 @ferror(i32* %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @c_ferror(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = tail call i32 @ferror(i32* %2)
ret i32 %3
}
void b(char a) { asm("" : : "pir"(a)); }


x86 assembly (clang, -O0):
<b>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
mov    %al,-0x2(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<b>:
mov    %dil,-0x1(%rsp)
ret

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

LLVM IR (-O2):
define void @b(i8 signext %0) {
tail call void asm sideeffect "", "imir,~{dirflag},~{fpsr},~{flags}"(i8 %0)
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
void display_hex(uint8_t *buf, int length) {
  int i;
  for (i = 0; i < length; i++) {
    fprintf(stderr, "%02X ", buf[i]);
  }
}


x86 assembly (clang, -O0):
<display_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1160 <display_hex+0x50>
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <display_hex+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_hex>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %esi,%esi
jle    1159 <display_hex+0x49>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
mov    0x2eb4(%rip),%r13
lea    0xecd(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x0(%r13),%edi
mov    (%r15,%rbx,4),%edx
mov    %r14,%rsi
call   1030 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <display_hex+0x30>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [6 x i8] c"%02X \00"
define void @display_hex(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %18, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %21
10: ; preds = %6
%11 = load i32, i32* @stderr
%12 = load i32*, i32** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = load i32, i32* %15
%17 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %10
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %6
21: ; preds = %6
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [6 x i8] c"%02X \00"
define void @display_hex(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = load i32, i32* @stderr
%9 = getelementptr inbounds i32, i32* %0, i64 %7
%10 = load i32, i32* %9
%11 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
ret void
}
long NextTickLength(long timeRemaining) {
  long nominalTickLength, nextTickLength;
  if (timeRemaining > 0L && timeRemaining <= 10000L)
    nominalTickLength = 100L;
  else
    nominalTickLength = 1000L;
  nextTickLength = timeRemaining % nominalTickLength;
  if (nextTickLength <= 0)
    nextTickLength += nominalTickLength;
  return nextTickLength;
}


x86 assembly (clang, -O0):
<NextTickLength>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jle    112e <NextTickLength+0x2e>
cmpq   $0x2710,-0x8(%rbp)
jg     112e <NextTickLength+0x2e>
movq   $0x64,-0x10(%rbp)
jmp    1136 <NextTickLength+0x36>
movq   $0x3e8,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cqto
idivq  -0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jg     115b <NextTickLength+0x5b>
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<NextTickLength>:
mov    %rdi,%rax
lea    -0x1(%rdi),%rcx
cmp    $0x2710,%rcx
mov    $0x64,%edx
mov    $0x3e8,%ecx
cmovb  %rdx,%rcx
mov    %rdi,%rdx
shr    $0x20,%rdx
je     112c <NextTickLength+0x2c>
cqto
idiv   %rcx
jmp    1130 <NextTickLength+0x30>
xor    %edx,%edx
div    %ecx
xor    %eax,%eax
test   %rdx,%rdx
cmovg  %rax,%rcx
add    %rdx,%rcx
mov    %rcx,%rax
ret

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

LLVM IR (-O2):
define i64 @NextTickLength(i64 %0) {
%2 = add i64 %0, -1
%3 = icmp ult i64 %2, 10000
%4 = select i1 %3, i64 100, i64 1000
%5 = srem i64 %0, %4
%6 = icmp sgt i64 %5, 0
%7 = select i1 %6, i64 0, i64 %4
%8 = add nsw i64 %7, %5
ret i64 %8
}
/* Variables and functions */
scalar_t__ mock(char *);
char *cf_s_passwd(char *s) { return (char *)mock(s); }


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

x86 assembly (clang, -O2):
<cf_s_passwd>:
jmp    1030 <mock@plt>

LLVM IR (-O0):
define i8* @cf_s_passwd(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @mock(i8* %3)
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}

LLVM IR (-O2):
define i8* @cf_s_passwd(i8* %0) {
%2 = tail call i64 @mock(i8* %0)
%3 = inttoptr i64 %2 to i8*
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int main(void) {
  int inteiro = 10;
  float decimal = 10.5;
  char letra = 'a';
  printf("%i\n", inteiro);
  printf("%.2f\n", decimal);
  printf("%c\n", letra);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x41280000,-0xc(%rbp)
movb   $0x61,-0xd(%rbp)
movsbl -0x8(%rbp),%esi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
cvttss2si %xmm0,%eax
lea    0xeb3(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
movsbl -0xd(%rbp),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0xa,%esi
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
mov    $0xa,%esi
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
mov    $0x61,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
@.str.1 = [6 x i8] c"%.2f\0A\00"
@.str.2 = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext 10)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 signext 10)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8 signext 97)
ret i32 0
}