xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void c(int a) {
  if (a < 0) {
    perror("ioctl");
    exit(6);
  }
}


x86 assembly (clang, -O0):
<c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    114b <c+0x2b>
lea    0xec4(%rip),%rdi
call   1030 <perror@plt>
mov    $0x6,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c>:
test   %edi,%edi
js     1125 <c+0x5>
ret
push   %rax
lea    0xed3(%rip),%rdi
call   1030 <perror@plt>
mov    $0x6,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"ioctl\00"
define void @c(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @exit(i32 6)
unreachable
8: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"ioctl\00"
define void @c(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @exit(i32 6)
unreachable
6: ; preds = %1
ret void
}
void SetWindow() { ; }


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

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

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

LLVM IR (-O2):
define void @SetWindow() {
ret void
}
char *idxtostr(char **strp, int idx) { return strp[idx]; }


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

x86 assembly (clang, -O2):
<idxtostr>:
movslq %esi,%rax
mov    (%rdi,%rax,8),%rax
ret

LLVM IR (-O0):
define i8* @idxtostr(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
store i8** %0, i8*** %3
store i32 %1, i32* %4
%5 = load i8**, i8*** %3
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8*, i8** %5, i64 %7
%9 = load i8*, i8** %8
ret i8* %9
}

LLVM IR (-O2):
define i8* @idxtostr(i8** nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i8*, i8** %0, i64 %3
%5 = load i8*, i8** %4
ret i8* %5
}
/* Variables and functions */
double calcula_total(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char s[50];
  printf("Expressão: ");
  scanf("%s", s);
  printf("Resultado: %f", calcula_total(s));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xeb5(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x40(%rbp),%rdi
call   1030 <calcula_total@plt>
lea    0xea3(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec3(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1030 <calcula_total@plt>
lea    0xeac(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Express\C3\A3o: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [14 x i8] c"Resultado: %f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x i8]
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%7 = call double @calcula_total(i8* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Express\C3\A3o: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [14 x i8] c"Resultado: %f\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call double @calcula_total(i8* %2)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %5)
ret i32 0
}
/* Variables and functions */
float floorf(float);
void floor_ff(float *ret, float f) {
  float r;
  r = floorf(f);
  (*ret) = r;
}


x86 assembly (clang, -O0):
<floor_ff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <floorf@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<floor_ff>:
push   %rbx
mov    %rdi,%rbx
call   1030 <floorf@plt>
movss  %xmm0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @floor_ff(float* %0, float %1) {
%3 = alloca float*
%4 = alloca float
%5 = alloca float
store float* %0, float** %3
store float %1, float* %4
%6 = load float, float* %4
%7 = call float @llvm.floor.f32(float %6)
store float %7, float* %5
%8 = load float, float* %5
%9 = load float*, float** %3
store float %8, float* %9
ret void
}

LLVM IR (-O2):
define void @floor_ff(float* nocapture writeonly %0, float %1) {
%3 = tail call float @llvm.floor.f32(float %1)
store float %3, float* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *getBraceParam();
void ignoreBraceParam(void) {
  char *p = getBraceParam();
  if (NULL != p)
    free(p);
}


x86 assembly (clang, -O0):
<ignoreBraceParam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <getBraceParam@plt>
mov    %rax,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
je     1148 <ignoreBraceParam+0x28>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ignoreBraceParam>:
push   %rax
xor    %eax,%eax
call   1040 <getBraceParam@plt>
test   %rax,%rax
je     1136 <ignoreBraceParam+0x16>
mov    %rax,%rdi
pop    %rax
jmp    1030 <free@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @ignoreBraceParam() {
%1 = tail call i8* (...) @getBraceParam()
%2 = icmp eq i8* %1, null
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @free(i8* %1)
br label %5
5: ; preds = %3, %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int sum(int *, int);
int main() {
  int a[10] = {1, 2, 3, 4, 5, 6, 7};
  int b = sum(a, 7);
  printf("sum = %d\n", b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0x7,%esi
call   1050 <sum@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%esi
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0xef5(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebd(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x7,%esi
call   1040 <sum@plt>
lea    0xecd(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [10 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 0, i32 0, i32 0]
@.str = [10 x i8] c"sum = %d\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = bitcast [10 x i32]* %1 to i8*
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%5 = call i32 @sum(i32* %4, i32 7)
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [10 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 0, i32 0, i32 0]
@.str = [10 x i8] c"sum = %d\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @sum(i32* %3, i32 7)
%5 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Type definitions */
struct timespec {
  int tv_sec;
  long tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
long get_time() {
  struct timespec temps;
  clock_gettime(CLOCK_MONOTONIC, &temps);
  return (temps.tv_sec * 1000000000) + temps.tv_nsec;
}


x86 assembly (clang, -O0):
<get_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
imul   $0x3b9aca00,-0x10(%rbp),%eax
cltq
add    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time>:
sub    $0x18,%rsp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <clock_gettime@plt>
movslq 0x8(%rsp),%rax
imul   $0x3b9aca00,%rax,%rax
add    0x10(%rsp),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i64 }
@CLOCK_MONOTONIC = global i32 0
define i64 @get_time() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_MONOTONIC
%3 = call i32 @clock_gettime(i32 %2, %struct.timespec* %1)
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000000000
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%9 = load i64, i64* %8
%10 = add nsw i64 %7, %9
ret i64 %10
}

LLVM IR (-O2):
%struct.timespec = type { i32, i64 }
@CLOCK_MONOTONIC = global i32 0
define i64 @get_time() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%6 = load i32, i32* %5
%7 = mul nsw i32 %6, 1000000000
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%10 = load i64, i64* %9
%11 = add nsw i64 %10, %8
ret i64 %11
}
/* Variables and functions */
int /*<<< orphan*/ console_init();
int /*<<< orphan*/ console_puts(char *);
int /*<<< orphan*/ led_init();
int /*<<< orphan*/ led_write(int);
void boot(void) {
  led_write(0b0001);
  led_init();
  led_write(0b0011);
  console_init();
  led_write(0b0101);
  console_puts("Ready.\r\n");
  led_write(0b0111);
}


x86 assembly (clang, -O0):
<boot>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1060 <led_write@plt>
mov    $0x0,%al
call   1050 <led_init@plt>
mov    $0x3,%edi
call   1060 <led_write@plt>
mov    $0x0,%al
call   1030 <console_init@plt>
mov    $0x5,%edi
call   1060 <led_write@plt>
lea    0xe89(%rip),%rdi
call   1040 <console_puts@plt>
mov    $0x7,%edi
call   1060 <led_write@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<boot>:
push   %rax
mov    $0x1,%edi
call   1060 <led_write@plt>
xor    %eax,%eax
call   1050 <led_init@plt>
mov    $0x3,%edi
call   1060 <led_write@plt>
xor    %eax,%eax
call   1030 <console_init@plt>
mov    $0x5,%edi
call   1060 <led_write@plt>
lea    0xe8c(%rip),%rdi
call   1040 <console_puts@plt>
mov    $0x7,%edi
pop    %rax
jmp    1060 <led_write@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"Ready.\0D\0A\00"
define void @boot() {
%1 = call i32 @led_write(i32 1)
%2 = call i32 (...) @led_init()
%3 = call i32 @led_write(i32 3)
%4 = call i32 (...) @console_init()
%5 = call i32 @led_write(i32 5)
%6 = call i32 @console_puts(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @led_write(i32 7)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"Ready.\0D\0A\00"
define void @boot() {
%1 = tail call i32 @led_write(i32 1)
%2 = tail call i32 (...) @led_init()
%3 = tail call i32 @led_write(i32 3)
%4 = tail call i32 (...) @console_init()
%5 = tail call i32 @led_write(i32 5)
%6 = tail call i32 @console_puts(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @led_write(i32 7)
ret void
}
/* Variables and functions */
int exact_square(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int number, digit;
  scanf("%d", &number);
  digit = exact_square(number);
  printf("%d", digit);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exact_square@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
call   1040 <exact_square@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @exact_square(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ panic(char *);
void invalid_tss_fault(void) { panic("exception(fault): invalid TSS"); }


x86 assembly (clang, -O0):
<invalid_tss_fault>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <panic@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [30 x i8] c"exception(fault): invalid TSS\00"
define void @invalid_tss_fault() {
%1 = call i32 @panic(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"exception(fault): invalid TSS\00"
define void @invalid_tss_fault() {
%1 = tail call i32 @panic(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
void print(char *str) {
  int i;
  i = 0;
  while (str[i]) {
    write(1, &str[i], 1);
    i++;
  }
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     115a <print+0x4a>
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
add    %rax,%rsi
mov    $0x1,%edx
mov    %edx,%edi
call   1030 <write@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <print+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %rbx
cmpb   $0x0,(%rdi)
je     113c <print+0x2c>
mov    %rdi,%rbx
nopl   0x0(%rax)
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
cmpb   $0x0,0x1(%rbx)
lea    0x1(%rbx),%rbx
jne    1120 <print+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @print(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %9, %4 ], [ %0, %1 ]
%7 = tail call i32 @write(i32 1, i8* %6, i32 1)
%8 = add nuw i64 %5, 1
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
double interp(double A, double B, double t) { return A + (B - A) * t; }


x86 assembly (clang, -O0):
<interp>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<interp>:
subsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @interp(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = load double, double* %4
%10 = fsub double %8, %9
%11 = load double, double* %6
%12 = call double @llvm.fmuladd.f64(double %10, double %11, double %7)
ret double %12
}

LLVM IR (-O2):
define double @interp(double %0, double %1, double %2) {
%4 = fsub double %1, %0
%5 = tail call double @llvm.fmuladd.f64(double %4, double %2, double %0)
ret double %5
}
void jit_get_cpu(void) {}


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

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

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

LLVM IR (-O2):
define void @jit_get_cpu() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ empty_log(char *);
void d_io_free() { empty_log("io_free\n"); }


x86 assembly (clang, -O0):
<d_io_free>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <empty_log@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [9 x i8] c"io_free\0A\00"
define void @d_io_free() {
%1 = call i32 @empty_log(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"io_free\0A\00"
define void @d_io_free() {
%1 = tail call i32 @empty_log(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char toupper(char);
void _strupper(char *s) {
  char *p = s;
  while ((*p) != '\0') {
    (*p) = toupper((*p));
    ++p;
  }
}


x86 assembly (clang, -O0):
<_strupper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1159 <_strupper+0x49>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <_strupper+0x14>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @_strupper(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 = %10, %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = call signext i8 @toupper(i8 signext %12)
%14 = load i8*, i8** %3
store i8 %13, i8* %14
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %3
br label %5
17: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @_strupper(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call signext i8 @toupper(i8 signext %5)
store i8 %7, i8* %6
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
unsigned long get_eflags(void) { return __builtin_ia32_readeflags_u64(); }


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

x86 assembly (clang, -O2):
<get_eflags>:
pushf
pop    %rax
ret

LLVM IR (-O0):
define i64 @get_eflags() {
%1 = call i64 @llvm.x86.flags.read.u64()
ret i64 %1
}

LLVM IR (-O2):
define i64 @get_eflags() {
%1 = tail call i64 @llvm.x86.flags.read.u64()
ret i64 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ b;

/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ mystrcpy(char *, char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stdin;
int main() {
  char a[32];
  char b[32];
  fgets(b, sizeof(b), stdin);
  mystrcpy(a, b);
  puts(a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
mov    0x2e9e(%rip),%rax
mov    (%rax),%edx
mov    $0x20,%esi
call   1040 <fgets@plt>
lea    -0x30(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1050 <mystrcpy@plt>
lea    -0x30(%rbp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    0x2eaa(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x20,%esi
call   1040 <fgets@plt>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <mystrcpy@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdin = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [32 x i8]
%3 = alloca [32 x i8]
store i32 0, i32* %1
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %4, i32 32, i32 %5)
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%9 = call i32 @mystrcpy(i8* %7, i8* %8)
%10 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%11 = call i32 @puts(i8* %10)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
define i32 @main() {
%1 = alloca [32 x i8]
%2 = alloca [32 x i8]
%3 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %4, i32 32, i32 %5)
%7 = call i32 @mystrcpy(i8* %3, i8* %4)
%8 = call i32 @puts(i8* %3)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ X509_NAME_ENTRY;
typedef int /*<<< orphan*/ ASN1_VALUE;

/* Variables and functions */
int ASN1_item_i2d(int /*<<< orphan*/ *, unsigned char **, int /*<<< orphan*/ *);
int /*<<< orphan*/ X509_NAME_ENTRY_it;
int i2d_X509_NAME_ENTRY(X509_NAME_ENTRY *a, unsigned char **out) {
  return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_NAME_ENTRY_it);
}


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

x86 assembly (clang, -O2):
<i2d_X509_NAME_ENTRY>:
mov    0x2ed1(%rip),%rdx
jmp    1030 <ASN1_item_i2d@plt>

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

LLVM IR (-O2):
@X509_NAME_ENTRY_it = global i32 0
define i32 @i2d_X509_NAME_ENTRY(i32* %0, i8** %1) {
%3 = tail call i32 @ASN1_item_i2d(i32* %0, i8** %1, i32* @X509_NAME_ENTRY_it)
ret i32 %3
}
/* Type definitions */
struct bf_buffer {
  int dummy;
};

/* Variables and functions */
size_t bf_buffer_free_space(struct bf_buffer *);
int bf_buffer_grow(struct bf_buffer *, size_t);
int bf_buffer_ensure_free_space(struct bf_buffer *buf, size_t sz) {
  size_t free_space;
  free_space = bf_buffer_free_space(buf);
  if (free_space < sz)
    return bf_buffer_grow(buf, sz - free_space);
  return 0;
}


x86 assembly (clang, -O0):
<bf_buffer_ensure_free_space>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <bf_buffer_free_space@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1164 <bf_buffer_ensure_free_space+0x44>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
sub    -0x20(%rbp),%rsi
call   1030 <bf_buffer_grow@plt>
mov    %eax,-0x4(%rbp)
jmp    116b <bf_buffer_ensure_free_space+0x4b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bf_buffer_ensure_free_space>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
call   1040 <bf_buffer_free_space@plt>
cmp    %rbx,%rax
jae    1149 <bf_buffer_ensure_free_space+0x29>
sub    %rax,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <bf_buffer_grow@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.bf_buffer = type { i32 }
define i32 @bf_buffer_ensure_free_space(%struct.bf_buffer* %0, i64 %1) {
%3 = alloca i32
%4 = alloca %struct.bf_buffer*
%5 = alloca i64
%6 = alloca i64
store %struct.bf_buffer* %0, %struct.bf_buffer** %4
store i64 %1, i64* %5
%7 = load %struct.bf_buffer*, %struct.bf_buffer** %4
%8 = call i64 @bf_buffer_free_space(%struct.bf_buffer* %7)
store i64 %8, i64* %6
%9 = load i64, i64* %6
%10 = load i64, i64* %5
%11 = icmp ult i64 %9, %10
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load %struct.bf_buffer*, %struct.bf_buffer** %4
%14 = load i64, i64* %5
%15 = load i64, i64* %6
%16 = sub i64 %14, %15
%17 = call i32 @bf_buffer_grow(%struct.bf_buffer* %13, i64 %16)
store i32 %17, i32* %3
br label %19
18: ; preds = %2
store i32 0, i32* %3
br label %19
19: ; preds = %18, %12
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
%struct.bf_buffer = type { i32 }
define i32 @bf_buffer_ensure_free_space(%struct.bf_buffer* %0, i64 %1) {
%3 = tail call i64 @bf_buffer_free_space(%struct.bf_buffer* %0)
%4 = icmp ult i64 %3, %1
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = sub i64 %1, %3
%7 = tail call i32 @bf_buffer_grow(%struct.bf_buffer* %0, i64 %6)
br label %8
8: ; preds = %2, %5
%9 = phi i32 [ %7, %5 ], [ 0, %2 ]
ret i32 %9
}
char *create_response() {
  return "HTTP/1.1 200 OK\n"
         "Connection: close\n"
         "\r\n\r\n"
         "<html><body><h1>Hello Webbly!!</h1></body></html>";
}


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

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

LLVM IR (-O0):
@.str = [88 x i8] c"HTTP/1.1 200 OK\0AConnection: close\0A\0D\0A\0D\0A<html><body><h1>Hello Webbly!!</h1></body></html>\00"
define i8* @create_response() {
ret i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [88 x i8] c"HTTP/1.1 200 OK\0AConnection: close\0A\0D\0A\0D\0A<html><body><h1>Hello Webbly!!</h1></body></html>\00"
define i8* @create_response() {
ret i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int check_arg_count(int, int);
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_error(char *);
void cmd_mvin_wchnstr(int nargs, char **args) {
  if (check_arg_count(nargs, 1) == 1)
    return;
  report_count(1);
  report_error("UNSUPPORTED");
}


x86 assembly (clang, -O0):
<cmd_mvin_wchnstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <check_arg_count@plt>
cmp    $0x1,%eax
jne    115a <cmd_mvin_wchnstr+0x2a>
jmp    1170 <cmd_mvin_wchnstr+0x40>
mov    $0x1,%edi
call   1040 <report_count@plt>
lea    0xe95(%rip),%rdi
call   1050 <report_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_mvin_wchnstr>:
push   %rax
mov    $0x1,%esi
call   1030 <check_arg_count@plt>
cmp    $0x1,%eax
jne    1142 <cmd_mvin_wchnstr+0x12>
pop    %rax
ret
mov    $0x1,%edi
call   1040 <report_count@plt>
lea    0xead(%rip),%rdi
pop    %rax
jmp    1050 <report_error@plt>

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

LLVM IR (-O2):
@.str = [12 x i8] c"UNSUPPORTED\00"
define void @cmd_mvin_wchnstr(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @check_arg_count(i32 %0, i32 1)
%4 = icmp eq i32 %3, 1
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @report_count(i32 1)
%7 = tail call i32 @report_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %5
ret void
}
int trx_eth_stop(int card) { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @trx_eth_stop(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ op_quick(char *);
void i_subq(void) { op_quick("sub"); }


x86 assembly (clang, -O0):
<i_subq>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <op_quick@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"sub\00"
define void @i_subq() {
%1 = call i32 @op_quick(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"sub\00"
define void @i_subq() {
%1 = tail call i32 @op_quick(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}
void capturingPosbehind2CAPTURING_POSBEHIND() {}


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

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

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

LLVM IR (-O2):
define void @capturingPosbehind2CAPTURING_POSBEHIND() {
ret void
}
/* Variables and functions */
float sqrt(float);
float sq_side_area(float area) {
  float side = sqrt(area);
  return side;
}


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

x86 assembly (clang, -O2):
<sq_side_area>:
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     111d <sq_side_area+0xd>
sqrtss %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define float @sq_side_area(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = call float @sqrt(float %4)
store float %5, float* %3
%6 = load float, float* %3
ret float %6
}

LLVM IR (-O2):
define float @sq_side_area(float %0) {
%2 = tail call float @sqrt(float %0)
ret float %2
}
/* Variables and functions */
long xatoll_range(char const *, long, long);
__attribute__((always_)) long xatol_range(const char *str, long l, long u) {
  return xatoll_range(str, l, u);
}


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

x86 assembly (clang, -O2):
<xatol_range>:
jmp    1030 <xatoll_range@plt>

LLVM IR (-O0):
define i64 @xatol_range(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i64, i64* %5
%9 = load i64, i64* %6
%10 = call i64 @xatoll_range(i8* %7, i64 %8, i64 %9)
ret i64 %10
}

LLVM IR (-O2):
define i64 @xatol_range(i8* %0, i64 %1, i64 %2) {
%4 = tail call i64 @xatoll_range(i8* %0, i64 %1, i64 %2)
ret i64 %4
}
/* Variables and functions */
char *strdup(char *);
char *shell_expand(char *str) { return strdup(str); }


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

x86 assembly (clang, -O2):
<shell_expand>:
jmp    1030 <strdup@plt>

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

LLVM IR (-O2):
define noalias i8* @shell_expand(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
ret i8* %2
}
void Strcpy(int *dst, int *src) {
  while (*src != '\0') {
    *dst = *src;
    dst++;
    src++;
  }
  *dst = '\0';
}


x86 assembly (clang, -O0):
<Strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
je     1142 <Strcpy+0x42>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
jmp    110c <Strcpy+0xc>
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Strcpy>:
mov    (%rsi),%eax
test   %eax,%eax
je     1120 <Strcpy+0x20>
add    $0x4,%rsi
nopw   0x0(%rax,%rax,1)
mov    %eax,(%rdi)
add    $0x4,%rdi
mov    (%rsi),%eax
add    $0x4,%rsi
test   %eax,%eax
jne    1110 <Strcpy+0x10>
movl   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define void @Strcpy(i32* nocapture writeonly %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = icmp eq i32 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i32 [ %11, %5 ], [ %3, %2 ]
%7 = phi i32* [ %10, %5 ], [ %1, %2 ]
%8 = phi i32* [ %9, %5 ], [ %0, %2 ]
store i32 %6, i32* %8
%9 = getelementptr inbounds i32, i32* %8, i64 1
%10 = getelementptr inbounds i32, i32* %7, i64 1
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i32* [ %0, %2 ], [ %9, %5 ]
store i32 0, i32* %14
ret void
}
void createIndexFile(em_ordem) {}


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

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

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

LLVM IR (-O2):
define void @createIndexFile(i32 %0) {
ret void
}
unsigned long long m_cvt_binary(char *s) {
  unsigned long long ret;
  for (ret = 0; *s >= 0x30 && *s <= 0x31; s++) {
    int d = *s - 0x30;
    ret = (ret << 1) + d;
  }
  return ret;
}


x86 assembly (clang, -O0):
<m_cvt_binary>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x15(%rbp)
jl     1135 <m_cvt_binary+0x35>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x31,%eax
setle  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1145 <m_cvt_binary+0x45>
jmp    1176 <m_cvt_binary+0x76>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x1,%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <m_cvt_binary+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_cvt_binary>:
mov    (%rdi),%cl
mov    %ecx,%eax
and    $0xfe,%al
cmp    $0x30,%al
jne    112c <m_cvt_binary+0x2c>
add    $0x1,%rdi
xor    %eax,%eax
movzbl %cl,%ecx
add    $0xffffffd0,%ecx
lea    (%rcx,%rax,2),%rax
movzbl (%rdi),%ecx
mov    %ecx,%edx
and    $0xfe,%dl
add    $0x1,%rdi
cmp    $0x30,%dl
je     1110 <m_cvt_binary+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @m_cvt_binary(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -2
%4 = icmp eq i8 %3, 48
br i1 %4, label %5, label %18
5: ; preds = %1, %5
%6 = phi i8 [ %15, %5 ], [ %2, %1 ]
%7 = phi i8* [ %14, %5 ], [ %0, %1 ]
%8 = phi i64 [ %13, %5 ], [ 0, %1 ]
%9 = zext i8 %6 to i64
%10 = add nuw nsw i64 %9, 4294967248
%11 = shl i64 %8, 1
%12 = and i64 %10, 4294967295
%13 = add i64 %12, %11
%14 = getelementptr inbounds i8, i8* %7, i64 1
%15 = load i8, i8* %14
%16 = and i8 %15, -2
%17 = icmp eq i8 %16, 48
br i1 %17, label %5, label %18
18: ; preds = %5, %1
%19 = phi i64 [ 0, %1 ], [ %13, %5 ]
ret i64 %19
}
int media(int vet[]) {
  int soma = 0;
  for (int i = 0; i < 5; i++)
    soma += vet[i];
  return soma / 5;
}


x86 assembly (clang, -O0):
<media>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x5,-0x10(%rbp)
jge    113f <media+0x3f>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1116 <media+0x16>
mov    -0xc(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<media>:
movdqu 0x4(%rdi),%xmm0
pshufd $0xee,%xmm0,%xmm1
paddd  %xmm0,%xmm1
pshufd $0x55,%xmm1,%xmm0
paddd  %xmm1,%xmm0
movd   %xmm0,%eax
add    (%rdi),%eax
cltq
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @media(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = bitcast i32* %3 to <4 x i32>*
%5 = load <4 x i32>, <4 x i32>* %4
%6 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %5)
%7 = add nsw i32 %6, %2
%8 = sdiv i32 %7, 5
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ print();
int main() {
  print();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @print()
ret i32 0
}
void f(int a, int b) { &b; }


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

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

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

LLVM IR (-O2):
define void @f(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
size_t strspn(const char *s, const char *accept) { return 0; }


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

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

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

LLVM IR (-O2):
define i64 @strspn(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i64 0
}
void ft_add_test_case(int *data, int nb, int result) {
  data[0] = nb;
  data[1] = result;
}


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

x86 assembly (clang, -O2):
<ft_add_test_case>:
mov    %esi,(%rdi)
mov    %edx,0x4(%rdi)
ret

LLVM IR (-O0):
define void @ft_add_test_case(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* %5
%8 = load i32*, i32** %4
%9 = getelementptr inbounds i32, i32* %8, i64 0
store i32 %7, i32* %9
%10 = load i32, i32* %6
%11 = load i32*, i32** %4
%12 = getelementptr inbounds i32, i32* %11, i64 1
store i32 %10, i32* %12
ret void
}

LLVM IR (-O2):
define void @ft_add_test_case(i32* nocapture writeonly %0, i32 %1, i32 %2) {
store i32 %1, i32* %0
%4 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %2, i32* %4
ret void
}
int clk_init_smp_twd_cpufreq(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @clk_init_smp_twd_cpufreq() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ring_buffer_read_test(void *);
void *ring_buffer_read_test_driver(void *context) {
  while (1)
    ring_buffer_read_test(context);
}


x86 assembly (clang, -O0):
<ring_buffer_read_test_driver>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ring_buffer_read_test@plt>
jmp    111c <ring_buffer_read_test_driver+0xc>

x86 assembly (clang, -O2):
<ring_buffer_read_test_driver>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <ring_buffer_read_test@plt>
jmp    1120 <ring_buffer_read_test_driver+0x10>

LLVM IR (-O0):
define i8* @ring_buffer_read_test_driver(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %1, %3
%4 = load i8*, i8** %2
%5 = call i32 @ring_buffer_read_test(i8* %4)
br label %3
}

LLVM IR (-O2):
define noalias i8* @ring_buffer_read_test_driver(i8* %0) {
br label %2
2: ; preds = %1, %2
%3 = tail call i32 @ring_buffer_read_test(i8* %0)
br label %2
}