xunge/DecIR huggingface dataset:
/* Variables and functions */
unsigned int get_bit(int, int /*<<< orphan*/);
unsigned int get_lsb(int reg) {
  unsigned int output;
  output = get_bit(reg, 0);
  return output;
}


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

x86 assembly (clang, -O2):
<get_lsb>:
xor    %esi,%esi
jmp    1030 <get_bit@plt>

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

LLVM IR (-O2):
define i32 @get_lsb(i32 %0) {
%2 = tail call i32 @get_bit(i32 %0, i32 0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void help_help() {
  puts("help [<command name>]\n"
       "Displays usage information for the specified command. Displays all\n"
       "available commands if command name is not provided as parameter.");
}


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

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

LLVM IR (-O0):
@.str = [154 x i8] c"help [<command name>]\0ADisplays usage information for the specified command. Displays all\0Aavailable commands if command name is not provided as parameter.\00"
define void @help_help() {
%1 = call i32 @puts(i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [154 x i8] c"help [<command name>]\0ADisplays usage information for the specified command. Displays all\0Aavailable commands if command name is not provided as parameter.\00"
define void @help_help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int time_total_centiseconds(float);
int time_seconds(float t) { return time_total_centiseconds(t) / 100 % 60; }


x86 assembly (clang, -O0):
<time_seconds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <time_total_centiseconds@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_seconds>:
push   %rax
call   1030 <time_total_centiseconds@plt>
cltq
imul   $0x51eb851f,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x5,%eax
add    %ecx,%eax
cltq
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x5,%ecx
add    %edx,%ecx
imul   $0x3c,%ecx,%ecx
sub    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @time_seconds(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i32 @time_total_centiseconds(float %3)
%5 = sdiv i32 %4, 100
%6 = srem i32 %5, 60
ret i32 %6
}

LLVM IR (-O2):
define i32 @time_seconds(float %0) {
%2 = tail call i32 @time_total_centiseconds(float %0)
%3 = sdiv i32 %2, 100
%4 = srem i32 %3, 60
ret i32 %4
}
void *nothing2() {
  void *a;
  return a;
}


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

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

LLVM IR (-O0):
define i8* @nothing2() {
%1 = alloca i8*
%2 = load i8*, i8** %1
ret i8* %2
}

LLVM IR (-O2):
define noalias i8* @nothing2() {
ret i8* undef
}
void byte_free(form) unsigned char *form;
{ free(form); }


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

x86 assembly (clang, -O2):
<byte_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @byte_free(i8* nocapture %0) {
tail call void @free(i8* %0)
ret void
}
int index_bw(int x, int y) { return x * 160 + y; }


x86 assembly (clang, -O0):
<index_bw>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
imul   $0xa0,-0x4(%rbp),%eax
add    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<index_bw>:
lea    (%rdi,%rdi,4),%eax
shl    $0x5,%eax
add    %esi,%eax
ret

LLVM IR (-O0):
define i32 @index_bw(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = mul nsw i32 %5, 160
%7 = load i32, i32* %4
%8 = add nsw i32 %6, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @index_bw(i32 %0, i32 %1) {
%3 = mul nsw i32 %0, 160
%4 = add nsw i32 %3, %1
ret i32 %4
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
__attribute__((always_)) uint32_t __UXTB_RORn(uint32_t op1, uint32_t rotate) {
  return (op1 >> rotate) & 0xFF;
}


x86 assembly (clang, -O0):
<__UXTB_RORn>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
and    $0xff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__UXTB_RORn>:
mov    %esi,%ecx
sar    %cl,%edi
movzbl %dil,%eax
ret

LLVM IR (-O0):
define i32 @__UXTB_RORn(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = ashr i32 %5, %6
%8 = and i32 %7, 255
ret i32 %8
}

LLVM IR (-O2):
define i32 @__UXTB_RORn(i32 %0, i32 %1) {
%3 = ashr i32 %0, %1
%4 = and i32 %3, 255
ret i32 %4
}
int ntfs_sysctl(int add) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @ntfs_sysctl(i32 %0) {
ret i32 0
}
void lcommon(name) char *name;
{
  outccname(name);
  outop0str("\tLCOMM\t");
}


x86 assembly (clang, -O0):
<lcommon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <outccname@plt>
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <outop0str@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcommon>:
push   %rax
xor    %eax,%eax
call   1040 <outccname@plt>
lea    0xed1(%rip),%rdi
xor    %eax,%eax
pop    %rcx
jmp    1030 <outop0str@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"\09LCOMM\09\00"
define void @lcommon(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @outccname to i32 (i8*, ...)*)(i8* %3)
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @outop0str to i32 (i8*, ...)*)(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"\09LCOMM\09\00"
define void @lcommon(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @outccname to i32 (i8*, ...)*)(i8* %0)
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @outop0str to i32 (i8*, ...)*)(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}
int test_imm_A6uint32_reg(unsigned int val) {
  return ((val) & (0xA6 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_A6uint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0xa6,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_A6uint32_reg(i32 %0) {
%2 = and i32 %0, 166
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int HelpItem100(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @HelpItem100() {
ret i32 0
}
void g_option_error_quark() {}


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

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

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

LLVM IR (-O2):
define void @g_option_error_quark() {
ret void
}
/* Variables and functions */
double arcsin(double);
double arccos(double n) { return 3.14159265358979323846 / 2 - arcsin(n); }


x86 assembly (clang, -O0):
<arccos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <arcsin@plt>
movaps %xmm0,%xmm1
movsd  0xece(%rip),%xmm0
subsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arccos>:
push   %rax
call   1030 <arcsin@plt>
movsd  0xee2(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @arccos(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @arcsin(double %3)
%5 = fsub double 0x3FF921FB54442D18, %4
ret double %5
}

LLVM IR (-O2):
define double @arccos(double %0) {
%2 = tail call double @arcsin(double %0)
%3 = fsub double 0x3FF921FB54442D18, %2
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
int *malloc(int);
int do_an_allocation() {
  int *a = malloc(sizeof(int));
  int *b = a;
  *a = 4;
  free(b);
  return 48;
}


x86 assembly (clang, -O0):
<do_an_allocation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x4,(%rax)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    $0x30,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_an_allocation>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
movl   $0x4,(%rax)
mov    %rax,%rdi
call   1030 <free@plt>
mov    $0x30,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @do_an_allocation() {
%1 = alloca i32*
%2 = alloca i32*
%3 = call i32* @malloc(i32 4)
store i32* %3, i32** %1
%4 = load i32*, i32** %1
store i32* %4, i32** %2
%5 = load i32*, i32** %1
store i32 4, i32* %5
%6 = load i32*, i32** %2
%7 = call i32 @free(i32* %6)
ret i32 48
}

LLVM IR (-O2):
define i32 @do_an_allocation() {
%1 = tail call i32* @malloc(i32 4)
store i32 4, i32* %1
%2 = tail call i32 @free(i32* %1)
ret i32 48
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int x;
  int *p;
  p = &x;
  scanf("%d", &x);
  printf("%d\n", *p);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\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 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Variables and functions */
char *skip_token(char const *);
char *skip_multiple_token(const char *p, int count) {
  int i;
  for (i = 0; i < count; i++)
    p = skip_token(p);
  return (char *)p;
}


x86 assembly (clang, -O0):
<skip_multiple_token>:
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    114d <skip_multiple_token+0x3d>
mov    -0x8(%rbp),%rdi
call   1030 <skip_token@plt>
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <skip_multiple_token+0x16>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_multiple_token>:
push   %rbx
mov    %rdi,%rax
test   %esi,%esi
jle    112d <skip_multiple_token+0x1d>
mov    %esi,%ebx
nopw   0x0(%rax,%rax,1)
mov    %rax,%rdi
call   1030 <skip_token@plt>
add    $0xffffffff,%ebx
jne    1120 <skip_multiple_token+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @skip_multiple_token(i8* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %10
4: ; preds = %2, %4
%5 = phi i32 [ %8, %4 ], [ 0, %2 ]
%6 = phi i8* [ %7, %4 ], [ %0, %2 ]
%7 = tail call i8* @skip_token(i8* %6)
%8 = add nuw nsw i32 %5, 1
%9 = icmp eq i32 %8, %1
br i1 %9, label %10, label %4
10: ; preds = %4, %2
%11 = phi i8* [ %0, %2 ], [ %7, %4 ]
ret i8* %11
}
int main() {
l1:
  return &&l1 - &&l2;
l2:;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
lea    -0x7(%rip),%rax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
lea    -0x7(%rip),%rax
add    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %6, %0
store i32 trunc (i64 sub (i64 ptrtoint (i8* blockaddress(@main, %2) to i64), i64 ptrtoint (i8* blockaddress(@main, %3) to i64)) to i32), i32* %1
br label %4
3: ; preds = %6
br label %4
4: ; preds = %3, %2
%5 = load i32, i32* %1
ret i32 %5
6: ; No predecessors!
indirectbr i8* undef, [label %2, label %3]
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0
ret i32 trunc (i64 sub (i64 ptrtoint (i8* blockaddress(@main, %1) to i64), i64 1) to i32)
}
int Get_USB3_Port_Info(const char *port_x) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @Get_USB3_Port_Info(i8* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ vprintf(char const *, int /*<<< orphan*/);
void msg_callback(int level, const char *fmt, va_list va, void *data) {
  if (level > 6)
    return;
  printf("libass: ");
  vprintf(fmt, va);
  printf("\n");
}


x86 assembly (clang, -O0):
<msg_callback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
cmpl   $0x6,-0x4(%rbp)
jle    1145 <msg_callback+0x25>
jmp    1169 <msg_callback+0x49>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <vprintf@plt>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<msg_callback>:
cmp    $0x6,%edi
jle    1136 <msg_callback+0x6>
ret
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%rbx
lea    0xebb(%rip),%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1050 <vprintf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [9 x i8] c"libass: \00"
define void @msg_callback(i32 %0, i8* nocapture %1, i32 %2, i8* nocapture readnone %3) {
%5 = icmp sgt i32 %0, 6
br i1 %5, label %10, label %6
6: ; preds = %4
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @vprintf(i8* %1, i32 %2)
%9 = tail call i32 @putchar(i32 10)
br label %10
10: ; preds = %4, %6
ret void
}
char *troca_letra(char *str, char original, char novo) {
  int i;
  char *p;
  for (i = 0; str[i]; i++) {
    if (*(str + i) == original)
      *(p + i) = novo;
    else
      *(p + i) = *(str + i);
  }
  *(p + i) = '\0';
  return p;
}


x86 assembly (clang, -O0):
<troca_letra>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1180 <troca_letra+0x80>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1157 <troca_letra+0x57>
mov    -0xa(%rbp),%dl
mov    -0x18(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    116d <troca_letra+0x6d>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x18(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1172 <troca_letra+0x72>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    111a <troca_letra+0x1a>
mov    -0x18(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define i8* @troca_letra(i8* %0, i8 signext %1, i8 signext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
store i32 0, i32* %7
br label %9
9: ; preds = %43, %3
%10 = load i8*, i8** %4
%11 = load i32, i32* %7
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %10, i64 %12
%14 = load i8, i8* %13
%15 = icmp ne i8 %14, 0
br i1 %15, label %16, label %46
16: ; preds = %9
%17 = load i8*, i8** %4
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = load i8, i8* %5
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %22, %24
br i1 %25, label %26, label %32
26: ; preds = %16
%27 = load i8, i8* %6
%28 = load i8*, i8** %8
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
store i8 %27, i8* %31
br label %42
32: ; preds = %16
%33 = load i8*, i8** %4
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %33, i64 %35
%37 = load i8, i8* %36
%38 = load i8*, i8** %8
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %38, i64 %40
store i8 %37, i8* %41
br label %42
42: ; preds = %32, %26
br label %43
43: ; preds = %42
%44 = load i32, i32* %7
%45 = add nsw i32 %44, 1
store i32 %45, i32* %7
br label %9
46: ; preds = %9
%47 = load i8*, i8** %8
%48 = load i32, i32* %7
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8, i8* %47, i64 %49
store i8 0, i8* %50
%51 = load i8*, i8** %8
ret i8* %51
}

LLVM IR (-O2):
/* Variables and functions */
char *getenv(const char *name __attribute__((unused))) { return NULL; }


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

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

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

LLVM IR (-O2):
define noalias i8* @getenv(i8* nocapture readnone %0) {
ret i8* null
}
int if_down(int sid) {
  (void)sid;
  return (0);
}


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

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

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

LLVM IR (-O2):
define i32 @if_down(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
void f3() {
  float x = 3.141592653;
  char array[] = "allen";
  printf("%c\n", array[-2]);
  printf("%c\n", array[-1]);
}


x86 assembly (clang, -O0):
<f3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  0xee0(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
mov    0xed9(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xed3(%rip),%ax
mov    %ax,-0x6(%rbp)
lea    0xeca(%rip),%rdi
movsbl -0xc(%rbp),%esi
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
movsbl -0xb(%rbp),%esi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f3>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@__const.f3.array = [6 x i8] c"allen\00"
@.str = [4 x i8] c"%c\0A\00"
define void @f3() {
%1 = alloca float
%2 = alloca [6 x i8]
store float 0x400921FB60000000, float* %1
%3 = bitcast [6 x i8]* %2 to i8*
%4 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 -2
%5 = load i8, i8* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %5)
%7 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 -1
%8 = load i8, i8* %7
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %8)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%c\0A\00"
define void @f3() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext poison)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext poison)
ret void
}
/* Variables and functions */
int Pop();
int /*<<< orphan*/ Push(int);
int CmdLE(void) {
  int operand2;
  operand2 = Pop();
  Push(Pop() <= operand2);
  return 0;
}


x86 assembly (clang, -O0):
<CmdLE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <Pop@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <Pop@plt>
cmp    -0x4(%rbp),%eax
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <Push@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CmdLE>:
push   %rbx
xor    %eax,%eax
call   1030 <Pop@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <Pop@plt>
xor    %edi,%edi
cmp    %ebx,%eax
setle  %dil
call   1040 <Push@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @CmdLE() {
%1 = alloca i32
%2 = call i32 (...) @Pop()
store i32 %2, i32* %1
%3 = call i32 (...) @Pop()
%4 = load i32, i32* %1
%5 = icmp sle i32 %3, %4
%6 = zext i1 %5 to i32
%7 = call i32 @Push(i32 %6)
ret i32 0
}

LLVM IR (-O2):
define i32 @CmdLE() {
%1 = tail call i32 (...) @Pop()
%2 = tail call i32 (...) @Pop()
%3 = icmp sle i32 %2, %1
%4 = zext i1 %3 to i32
%5 = tail call i32 @Push(i32 %4)
ret i32 0
}
/* Type definitions */
struct number_map_entry {
  int dummy;
};

/* Variables and functions */
int straight_replace_entry(char *, struct number_map_entry *);
void straight_replace_loop(char *input, struct number_map_entry *e) {
  int rc;
  do {
    rc = straight_replace_entry(input, e);
  } while (rc == 1);
}


x86 assembly (clang, -O0):
<straight_replace_loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <straight_replace_entry@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
je     1120 <straight_replace_loop+0x10>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<straight_replace_loop>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <straight_replace_entry@plt>
cmp    $0x1,%eax
je     1120 <straight_replace_loop+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.number_map_entry = type { i32 }
define void @straight_replace_loop(i8* %0, %struct.number_map_entry* %1) {
%3 = alloca i8*
%4 = alloca %struct.number_map_entry*
%5 = alloca i32
store i8* %0, i8** %3
store %struct.number_map_entry* %1, %struct.number_map_entry** %4
br label %6
6: ; preds = %10, %2
%7 = load i8*, i8** %3
%8 = load %struct.number_map_entry*, %struct.number_map_entry** %4
%9 = call i32 @straight_replace_entry(i8* %7, %struct.number_map_entry* %8)
store i32 %9, i32* %5
br label %10
10: ; preds = %6
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, 1
br i1 %12, label %6, label %13
13: ; preds = %10
ret void
}

LLVM IR (-O2):
%struct.number_map_entry = type { i32 }
define void @straight_replace_loop(i8* %0, %struct.number_map_entry* %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call i32 @straight_replace_entry(i8* %0, %struct.number_map_entry* %1)
%5 = icmp eq i32 %4, 1
br i1 %5, label %3, label %6
6: ; preds = %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void shell_clear() { system("clear"); }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
define void @shell_clear() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ writel(int, void *);
void set__PIO_PCx__BIDIR_OPEN_DRAIN(void *base, int pin) {
  writel(((0x1) & 0x1) << pin, base + (0x28 + (2) * 0x10));
  writel(((0x1) & 0x1) << pin, base + (0x28 + (1) * 0x10));
  writel(((0x1) & 0x1) << pin, base + (0x24 + (0) * 0x10));
}


x86 assembly (clang, -O0):
<set__PIO_PCx__BIDIR_OPEN_DRAIN>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x1,%edi
shl    %cl,%edi
mov    -0x8(%rbp),%rsi
add    $0x48,%rsi
call   1030 <writel@plt>
mov    -0xc(%rbp),%ecx
mov    $0x1,%edi
shl    %cl,%edi
mov    -0x8(%rbp),%rsi
add    $0x38,%rsi
call   1030 <writel@plt>
mov    -0xc(%rbp),%ecx
mov    $0x1,%edi
shl    %cl,%edi
mov    -0x8(%rbp),%rsi
add    $0x24,%rsi
call   1030 <writel@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set__PIO_PCx__BIDIR_OPEN_DRAIN>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ecx
mov    %rdi,%rbx
mov    $0x1,%ebp
shl    %cl,%ebp
lea    0x48(%rdi),%rsi
mov    %ebp,%edi
call   1030 <writel@plt>
lea    0x38(%rbx),%rsi
mov    %ebp,%edi
call   1030 <writel@plt>
add    $0x24,%rbx
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <writel@plt>

LLVM IR (-O0):
define void @set__PIO_PCx__BIDIR_OPEN_DRAIN(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = shl i32 1, %5
%7 = load i8*, i8** %3
%8 = getelementptr i8, i8* %7, i64 72
%9 = call i32 @writel(i32 %6, i8* %8)
%10 = load i32, i32* %4
%11 = shl i32 1, %10
%12 = load i8*, i8** %3
%13 = getelementptr i8, i8* %12, i64 56
%14 = call i32 @writel(i32 %11, i8* %13)
%15 = load i32, i32* %4
%16 = shl i32 1, %15
%17 = load i8*, i8** %3
%18 = getelementptr i8, i8* %17, i64 36
%19 = call i32 @writel(i32 %16, i8* %18)
ret void
}

LLVM IR (-O2):
define void @set__PIO_PCx__BIDIR_OPEN_DRAIN(i8* %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = getelementptr i8, i8* %0, i64 72
%5 = tail call i32 @writel(i32 %3, i8* %4)
%6 = getelementptr i8, i8* %0, i64 56
%7 = tail call i32 @writel(i32 %3, i8* %6)
%8 = getelementptr i8, i8* %0, i64 36
%9 = tail call i32 @writel(i32 %3, i8* %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ demo_main();
void main(void) { demo_main(); }


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

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

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

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @demo_main()
ret void
}
void _isdead_dbg() { __asm__("int $3"); }


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

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

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

LLVM IR (-O2):
define void @_isdead_dbg() {
tail call void asm sideeffect "int $$3", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int syscon_standard_multi_affinization(int m) {
  int fail, b;
  double c;
  fail = _ada_use_c2phc4c(907, &m, &b, &c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<syscon_standard_multi_affinization>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x38b,%edi
lea    -0x4(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x18(%rbp),%rcx
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<syscon_standard_multi_affinization>:
sub    $0x18,%rsp
mov    %edi,0x8(%rsp)
lea    0x8(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x10(%rsp),%rcx
mov    $0x38b,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @syscon_standard_multi_affinization(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
store i32 %0, i32* %2
%6 = call i32 @_ada_use_c2phc4c(i32 907, i32* %2, i32* %4, double* %5, i32 0)
store i32 %6, i32* %3
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
define i32 @syscon_standard_multi_affinization(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
store i32 %0, i32* %2
%5 = bitcast i32* %3 to i8*
%6 = bitcast double* %4 to i8*
%7 = call i32 @_ada_use_c2phc4c(i32 907, i32* %2, i32* %3, double* %4, i32 0)
ret i32 %7
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ putchar(char);
void no_tabs() {
  int c;
  printf("tab is %d", '\t');
  while ((c = getchar()) != EOF) {
    if (c == 9)
      putchar('\t');
  }
}


x86 assembly (clang, -O0):
<no_tabs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0x9,%esi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x4(%rbp)
mov    0x2e8e(%rip),%rcx
cmp    (%rcx),%eax
je     117b <no_tabs+0x4b>
cmpl   $0x9,-0x4(%rbp)
jne    1176 <no_tabs+0x46>
mov    $0x9,%edi
call   1030 <putchar@plt>
jmp    1149 <no_tabs+0x19>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<no_tabs>:
push   %rbx
lea    0xec8(%rip),%rdi
mov    $0x9,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e98(%rip),%rbx
jmp    1167 <no_tabs+0x37>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%eax
je     117c <no_tabs+0x4c>
cmp    $0x9,%eax
jne    1160 <no_tabs+0x30>
mov    $0x9,%edi
call   1030 <putchar@plt>
jmp    1160 <no_tabs+0x30>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"tab is %d\00"
@EOF = global i32 0
define void @no_tabs() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8 signext 9)
br label %3
3: ; preds = %12, %0
%4 = call i32 (...) @getchar()
store i32 %4, i32* %1
%5 = load i32, i32* @EOF
%6 = icmp ne i32 %4, %5
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = load i32, i32* %1
%9 = icmp eq i32 %8, 9
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @putchar(i8 signext 9)
br label %12
12: ; preds = %10, %7
br label %3
13: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"tab is %d\00"
@EOF = global i32 0
define void @no_tabs() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8 signext 9)
%2 = tail call i32 (...) @getchar()
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %14, label %5
5: ; preds = %0, %10
%6 = phi i32 [ %11, %10 ], [ %2, %0 ]
%7 = icmp eq i32 %6, 9
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @putchar(i8 signext 9)
br label %10
10: ; preds = %8, %5
%11 = tail call i32 (...) @getchar()
%12 = load i32, i32* @EOF
%13 = icmp eq i32 %11, %12
br i1 %13, label %14, label %5
14: ; preds = %10, %0
ret void
}
double Fmira(x, p)
double x, p;
{
  static double z;
  z = x * x;
  return (p * x + ((2.0 * (1.0 - p) * z) / (1.0 + z)));
}


x86 assembly (clang, -O0):
<Fmira>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,0x2f08(%rip)
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xece(%rip),%xmm3
subsd  -0x10(%rbp),%xmm3
movsd  0xec9(%rip),%xmm1
mulsd  %xmm3,%xmm1
mulsd  0x2edd(%rip),%xmm1
movsd  0xead(%rip),%xmm3
addsd  0x2ecd(%rip),%xmm3
divsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fmira>:
movapd %xmm0,%xmm2
mulsd  %xmm0,%xmm2
movsd  0xef0(%rip),%xmm3
movapd %xmm3,%xmm4
subsd  %xmm1,%xmm4
addsd  %xmm4,%xmm4
mulsd  %xmm2,%xmm4
addsd  %xmm3,%xmm2
divsd  %xmm2,%xmm4
mulsd  %xmm1,%xmm0
addsd  %xmm4,%xmm0
ret

LLVM IR (-O0):
@Fmira.z = internal global double 0.000000e+00
define double @Fmira(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %3
%7 = fmul double %5, %6
store double %7, double* @Fmira.z
%8 = load double, double* %4
%9 = load double, double* %3
%10 = load double, double* %4
%11 = fsub double 1.000000e+00, %10
%12 = fmul double 2.000000e+00, %11
%13 = load double, double* @Fmira.z
%14 = fmul double %12, %13
%15 = load double, double* @Fmira.z
%16 = fadd double 1.000000e+00, %15
%17 = fdiv double %14, %16
%18 = call double @llvm.fmuladd.f64(double %8, double %9, double %17)
ret double %18
}

LLVM IR (-O2):
define double @Fmira(double %0, double %1) {
%3 = fmul double %0, %0
%4 = fsub double 1.000000e+00, %1
%5 = fmul double %4, 2.000000e+00
%6 = fmul double %3, %5
%7 = fadd double %3, 1.000000e+00
%8 = fdiv double %6, %7
%9 = tail call double @llvm.fmuladd.f64(double %1, double %0, double %8)
ret double %9
}
int f() {
  int local = 1;
  return local;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @f() {
ret i32 1
}
int get_direction(void *sensor_address) {
  return *((volatile int *)sensor_address + 2);
}


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

x86 assembly (clang, -O2):
<get_direction>:
mov    0x8(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @get_direction(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = getelementptr inbounds i32, i32* %4, i64 2
%6 = load volatile i32, i32* %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @get_direction(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 8
%3 = bitcast i8* %2 to i32*
%4 = load volatile i32, i32* %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
scalar_t__ get_hypervisor_id(char *);
int /*<<< orphan*/ printf(char *, ...);
void main() {
  char id[13] = {0};
  if (get_hypervisor_id(id)) {
    printf("%s\n", id);
    exit(0);
  } else {
    printf("No hypervisor detected\n");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0xd(%rbp),%rdi
xor    %esi,%esi
mov    $0xd,%edx
call   1050 <memset@plt>
lea    -0xd(%rbp),%rdi
call   1040 <get_hypervisor_id@plt>
cmp    $0x0,%rax
je     1184 <main+0x44>
lea    -0xd(%rbp),%rsi
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movq   $0x0,0xd(%rsp)
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rdi
call   1040 <get_hypervisor_id@plt>
test   %rax,%rax
jne    116b <main+0x3b>
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
lea    0x8(%rsp),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [24 x i8] c"No hypervisor detected\0A\00"
define void @main() {
%1 = alloca [13 x i8]
%2 = bitcast [13 x i8]* %1 to i8*
%3 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%4 = call i64 @get_hypervisor_id(i8* %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = call i32 @exit(i32 0)
unreachable
10: ; preds = %0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [23 x i8] c"No hypervisor detected\00"
define void @main() {
%1 = alloca [13 x i8]
%2 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%3 = call i64 @get_hypervisor_id(i8* %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %0
%6 = call i32 @puts(i8* %2)
%7 = call i32 @exit(i32 0)
unreachable
8: ; preds = %0
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int dice;
  int x;
  srand(time(NULL));
  dice = rand() % 6;
  x = rand() % 6 + 1;
  printf("%d\n", x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1060 <rand@plt>
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,2),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1,%esi
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 (...) @rand()
%4 = tail call i32 (...) @rand()
%5 = srem i32 %4, 6
%6 = add nsw i32 %5, 1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}
void writew(unsigned short val, volatile void *addr) {
  asm volatile("mov"
               "w"
               " %0,%1"
               :
               : "r"(val), "m"(*(volatile unsigned short *)addr)
               : "memory");
}


x86 assembly (clang, -O0):
<writew>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x2(%rbp),%ax
mov    -0x10(%rbp),%rcx
mov    %ax,(%rcx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<writew>:
mov    %di,(%rsi)
ret

LLVM IR (-O0):
define void @writew(i16 zeroext %0, i8* %1) {
%3 = alloca i16
%4 = alloca i8*
store i16 %0, i16* %3
store i8* %1, i8** %4
%5 = load i16, i16* %3
%6 = load i8*, i8** %4
%7 = bitcast i8* %6 to i16*
ret void
}

LLVM IR (-O2):
define void @writew(i16 zeroext %0, i8* %1) {
%3 = bitcast i8* %1 to i16*
tail call void asm sideeffect "movw $0,$1", "r,*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i16 %0, i16* elementtype(i16) %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bigmod(int, int, int);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int main() {
  int long long a;
  int p, m;
  printf("%lld ", bigmod(5, 55, 231));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x5,%edi
mov    $0x37,%esi
mov    $0xe7,%edx
call   1040 <bigmod@plt>
mov    %eax,%esi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x5,%edi
mov    $0x37,%esi
mov    $0xe7,%edx
call   1040 <bigmod@plt>
lea    0xec4(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%lld \00"
define i32 @main() {
%1 = tail call i32 @bigmod(i32 5, i32 55, i32 231)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
void test_bcmp(void) {}


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

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

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

LLVM IR (-O2):
define void @test_bcmp() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char, char);
void move(char x, char y) {
  static int cnt = 0;
  printf("%d %c => %c\n", ++cnt, x, y);
}


x86 assembly (clang, -O0):
<move>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    0x2f02(%rip),%esi
add    $0x1,%esi
mov    %esi,0x2ef9(%rip)
mov    -0x1(%rbp),%al
lea    0xec3(%rip),%rdi
movsbl %al,%edx
movsbl -0x2(%rbp),%ecx
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<move>:
mov    %esi,%ecx
mov    %edi,%edx
mov    0x2f12(%rip),%esi
add    $0x1,%esi
mov    %esi,0x2f09(%rip)
lea    0xed6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@move.cnt = internal global i32 0
@.str = [13 x i8] c"%d %c => %c\0A\00"
define void @move(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i32, i32* @move.cnt
%6 = add nsw i32 %5, 1
store i32 %6, i32* @move.cnt
%7 = load i8, i8* %3
%8 = load i8, i8* %4
%9 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %6, i8 signext %7, i8 signext %8)
ret void
}

LLVM IR (-O2):
@move.cnt = internal unnamed_addr global i32 0
@.str = [13 x i8] c"%d %c => %c\0A\00"
define void @move(i8 signext %0, i8 signext %1) {
%3 = load i32, i32* @move.cnt
%4 = add nsw i32 %3, 1
store i32 %4, i32* @move.cnt
%5 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %4, i8 signext %0, i8 signext %1)
ret void
}
double eval_clt(double x, double y) { return x < y; }


x86 assembly (clang, -O0):
<eval_clt>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
cvtsi2sd %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<eval_clt>:
cmpltsd %xmm1,%xmm0
movsd  0xef3(%rip),%xmm1
andpd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @eval_clt(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp olt double %5, %6
%8 = zext i1 %7 to i32
%9 = sitofp i32 %8 to double
ret double %9
}

LLVM IR (-O2):
define double @eval_clt(double %0, double %1) {
%3 = fcmp olt double %0, %1
%4 = uitofp i1 %3 to double
ret double %4
}
void interrupts_disable(void) { asm volatile("cli\n\t"); }


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

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

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

LLVM IR (-O2):
define void @interrupts_disable() {
tail call void asm sideeffect "cli\0A\09", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
float floorf(float x) {}


x86 assembly (clang, -O0):
<floorf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

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

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

LLVM IR (-O2):
define float @floorf(float %0) {
ret float undef
}
int Long_to_MINUS_int(long a) { return (int)a; }


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

x86 assembly (clang, -O2):
<Long_to_MINUS_int>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
define i32 @Long_to_MINUS_int(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @Long_to_MINUS_int(i64 %0) {
%2 = trunc i64 %0 to i32
ret i32 %2
}
int a1(void) { return 0; }


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

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

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

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