xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int /*<<< orphan*/);
int /*<<< orphan*/ UARTBaseValid(unsigned long);
void UARTCharPut(unsigned long ulBase, unsigned char ucData) {
  DEBUG_ASSERT(UARTBaseValid(ulBase));
  while ((*((volatile unsigned long *)(ulBase + 0x00000018))) & 0x00000020) {
  }
  (*((volatile unsigned long *)(ulBase + 0x00000000))) = ucData;
}


x86 assembly (clang, -O0):
<UARTCharPut>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <UARTBaseValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rax
and    $0x20,%rax
cmp    $0x0,%rax
je     115d <UARTCharPut+0x3d>
jmp    1142 <UARTCharPut+0x22>
movzbl -0x9(%rbp),%eax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTCharPut>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1040 <UARTBaseValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
testq  $0x20,0x18(%rbx)
jne    1140 <UARTCharPut+0x20>
movzbl %bpl,%eax
mov    %rax,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @UARTCharPut(i64 %0, i8 zeroext %1) {
%3 = alloca i64
%4 = alloca i8
store i64 %0, i64* %3
store i8 %1, i8* %4
%5 = load i64, i64* %3
%6 = call i32 @UARTBaseValid(i64 %5)
%7 = call i32 @DEBUG_ASSERT(i32 %6)
br label %8
8: ; preds = %15, %2
%9 = load i64, i64* %3
%10 = add i64 %9, 24
%11 = inttoptr i64 %10 to i64*
%12 = load volatile i64, i64* %11
%13 = and i64 %12, 32
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %8
br label %8
16: ; preds = %8
%17 = load i8, i8* %4
%18 = zext i8 %17 to i64
%19 = load i64, i64* %3
%20 = add i64 %19, 0
%21 = inttoptr i64 %20 to i64*
store volatile i64 %18, i64* %21
ret void
}

LLVM IR (-O2):
define void @UARTCharPut(i64 %0, i8 zeroext %1) {
%3 = tail call i32 @UARTBaseValid(i64 %0)
%4 = tail call i32 @DEBUG_ASSERT(i32 %3)
%5 = add i64 %0, 24
%6 = inttoptr i64 %5 to i64*
br label %7
7: ; preds = %7, %2
%8 = load volatile i64, i64* %6
%9 = and i64 %8, 32
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %7
11: ; preds = %7
%12 = zext i8 %1 to i64
%13 = inttoptr i64 %0 to i64*
store volatile i64 %12, i64* %13
ret void
}
char num2char(char nc) {
  char c;
  c = 'n';
  switch (nc) {
  case 1:
    c = 'a';
    break;
  case 2:
    c = 'c';
    break;
  case 3:
    c = 'g';
    break;
  case 4:
    c = 't';
    break;
  }
  return c;
}


x86 assembly (clang, -O0):
<num2char>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movb   $0x6e,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     1157 <num2char+0x57>
mov    -0x10(%rbp),%rax
lea    0xed1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x61,-0x2(%rbp)
jmp    1157 <num2char+0x57>
movb   $0x63,-0x2(%rbp)
jmp    1157 <num2char+0x57>
movb   $0x67,-0x2(%rbp)
jmp    1157 <num2char+0x57>
movb   $0x74,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<num2char>:
lea    -0x8(,%rdi,8),%ecx
mov    %edi,%eax
add    $0xffffffff,%eax
mov    $0x74676361,%edx
shr    %cl,%edx
cmp    $0x4,%eax
mov    $0x6e,%eax
cmovb  %edx,%eax
ret

LLVM IR (-O0):
define signext i8 @num2char(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
store i8 110, i8* %3
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
switch i32 %5, label %10 [
i32 1, label %6
i32 2, label %7
i32 3, label %8
i32 4, label %9
]
6: ; preds = %1
store i8 97, i8* %3
br label %10
7: ; preds = %1
store i8 99, i8* %3
br label %10
8: ; preds = %1
store i8 103, i8* %3
br label %10
9: ; preds = %1
store i8 116, i8* %3
br label %10
10: ; preds = %1, %9, %8, %7, %6
%11 = load i8, i8* %3
ret i8 %11
}

LLVM IR (-O2):
define signext i8 @num2char(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -1
%4 = icmp ult i32 %3, 4
%5 = shl nsw i32 %3, 3
%6 = lshr i32 1952932705, %5
%7 = trunc i32 %6 to i8
%8 = select i1 %4, i8 %7, i8 110
ret i8 %8
}
/* Variables and functions */
int strncmp(char const *, char *, int);
int not_a_switch(const char *input) { return strncmp(input, "-", 1); }


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

x86 assembly (clang, -O2):
<not_a_switch>:
lea    0xee9(%rip),%rsi
mov    $0x1,%edx
jmp    1030 <strncmp@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"-\00"
define i32 @not_a_switch(i8* %0) {
%2 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ clearok(int /*<<< orphan*/, int);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ stdscr;
void redraw(void) {
  clearok(stdscr, 1);
  refresh();
}


x86 assembly (clang, -O0):
<redraw>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
call   1030 <clearok@plt>
mov    $0x0,%al
call   1040 <refresh@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<redraw>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
call   1030 <clearok@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <refresh@plt>

LLVM IR (-O0):
@stdscr = global i32 0
define void @redraw() {
%1 = load i32, i32* @stdscr
%2 = call i32 @clearok(i32 %1, i32 1)
%3 = call i32 (...) @refresh()
ret void
}

LLVM IR (-O2):
@stdscr = global i32 0
define void @redraw() {
%1 = load i32, i32* @stdscr
%2 = tail call i32 @clearok(i32 %1, i32 1)
%3 = tail call i32 (...) @refresh()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dot(double *, double *);
double sqrt(int /*<<< orphan*/);
double veclen(double *va) { return sqrt(dot(va, va)); }


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

x86 assembly (clang, -O2):
<veclen>:
push   %rax
mov    %rdi,%rsi
call   1030 <dot@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <sqrt@plt>

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

LLVM IR (-O2):
define double @veclen(double* %0) {
%2 = tail call i32 @dot(double* %0, double* %0)
%3 = tail call double @sqrt(i32 %2)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void menu_busca(void) {
  printf("1 - Buscar pelo codigo\n");
  printf("2 - Buscar pelo nome\n");
  printf("0 - Sair\n");
}


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

x86 assembly (clang, -O2):
<menu_busca>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xef3(%rip),%rdi
call   1030 <puts@plt>
lea    0xefc(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"1 - Buscar pelo codigo\0A\00"
@.str.1 = [22 x i8] c"2 - Buscar pelo nome\0A\00"
@.str.2 = [10 x i8] c"0 - Sair\0A\00"
define void @menu_busca() {
%1 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [23 x i8] c"1 - Buscar pelo codigo\00"
@str.3 = [21 x i8] c"2 - Buscar pelo nome\00"
@str.4 = [9 x i8] c"0 - Sair\00"
define void @menu_busca() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.4, i64 0, i64 0))
ret void
}
void EC_GROUP_set_seed(void) {}


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

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

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

LLVM IR (-O2):
define void @EC_GROUP_set_seed() {
ret void
}
void _Unwind_GetTextRelBase() {}


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

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

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

LLVM IR (-O2):
define void @_Unwind_GetTextRelBase() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ glEdgeFlag(unsigned char);
void EdgeFlag(unsigned char f) { glEdgeFlag(f); }


x86 assembly (clang, -O0):
<EdgeFlag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edi
call   1030 <glEdgeFlag@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EdgeFlag>:
jmp    1030 <glEdgeFlag@plt>

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

LLVM IR (-O2):
define void @EdgeFlag(i8 zeroext %0) {
%2 = tail call i32 @glEdgeFlag(i8 zeroext %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ d_printf(char *, ...);
void print_link(const char *value) {
  d_printf("* [%s]\n", value);
  d_printf("<!-- -->\n");
}


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

x86 assembly (clang, -O2):
<print_link>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <d_printf@plt>
lea    0xedf(%rip),%rdi
xor    %eax,%eax
pop    %rcx
jmp    1030 <d_printf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"* [%s]\0A\00"
@.str.1 = [10 x i8] c"<!-- -->\0A\00"
define void @print_link(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @d_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @d_printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"* [%s]\0A\00"
@.str.1 = [10 x i8] c"<!-- -->\0A\00"
define void @print_link(i8* %0) {
%2 = tail call i32 (i8*, ...) @d_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 (i8*, ...) @d_printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void calc1_error(const char *s) { fprintf(stderr, "%s\n", s); }


x86 assembly (clang, -O0):
<calc1_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc1_error>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @calc1_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @calc1_error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int32_t lt_int32_t(int32_t a, int32_t b) { return a < b; }


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

x86 assembly (clang, -O2):
<lt_int32_t>:
xor    %eax,%eax
cmp    %esi,%edi
setl   %al
ret

LLVM IR (-O0):
define i32 @lt_int32_t(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 = icmp slt i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @lt_int32_t(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
struct fosphor {
  int dummy;
};

/* Variables and functions */
int fosphor_cl_get_waterfall_position(struct fosphor *);
int /*<<< orphan*/ fosphor_gl_draw(struct fosphor *, int, int, int);
void fosphor_draw(struct fosphor *self, int w, int h) {
  int wf_pos = fosphor_cl_get_waterfall_position(self);
  fosphor_gl_draw(self, w, h, wf_pos);
}


x86 assembly (clang, -O0):
<fosphor_draw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fosphor_cl_get_waterfall_position@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1040 <fosphor_gl_draw@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fosphor_draw>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <fosphor_cl_get_waterfall_position@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %eax,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <fosphor_gl_draw@plt>

LLVM IR (-O0):
%struct.fosphor = type { i32 }
define void @fosphor_draw(%struct.fosphor* %0, i32 %1, i32 %2) {
%4 = alloca %struct.fosphor*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store %struct.fosphor* %0, %struct.fosphor** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load %struct.fosphor*, %struct.fosphor** %4
%9 = call i32 @fosphor_cl_get_waterfall_position(%struct.fosphor* %8)
store i32 %9, i32* %7
%10 = load %struct.fosphor*, %struct.fosphor** %4
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = call i32 @fosphor_gl_draw(%struct.fosphor* %10, i32 %11, i32 %12, i32 %13)
ret void
}

LLVM IR (-O2):
%struct.fosphor = type { i32 }
define void @fosphor_draw(%struct.fosphor* %0, i32 %1, i32 %2) {
%4 = tail call i32 @fosphor_cl_get_waterfall_position(%struct.fosphor* %0)
%5 = tail call i32 @fosphor_gl_draw(%struct.fosphor* %0, i32 %1, i32 %2, i32 %4)
ret void
}
int main(void) {
  int var;
  while (1) {
    break;
    ++var;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
jmp    1110 <main+0x10>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %0
br label %4
4: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(unsigned int *);
void freenum(unsigned int *num) { free(num); }


x86 assembly (clang, -O0):
<freenum>:
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):
<freenum>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @freenum(i32* nocapture %0) {
%2 = tail call i32 @free(i32* %0)
ret void
}
int fselLoad(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @fselLoad() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ rgph_u32_xxh32s_data64(double const *, size_t, uintptr_t);
uint32_t rgph_u32_xxh32s_f64a(const double *key, size_t len, uintptr_t seed) {
  return rgph_u32_xxh32s_data64(key, len, seed);
}


x86 assembly (clang, -O0):
<rgph_u32_xxh32s_f64a>:
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 <rgph_u32_xxh32s_data64@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rgph_u32_xxh32s_f64a>:
jmp    1030 <rgph_u32_xxh32s_data64@plt>

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

LLVM IR (-O2):
define i32 @rgph_u32_xxh32s_f64a(double* %0, i64 %1, i64 %2) {
%4 = tail call i32 @rgph_u32_xxh32s_data64(double* %0, i64 %1, i64 %2)
ret i32 %4
}
/* Type definitions */
typedef long uint8_t;

/* Variables and functions */
void set_bit(uint8_t *x, int bit_num) { *x |= (1L << bit_num); }


x86 assembly (clang, -O0):
<set_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%rax
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
or     (%rax),%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_bit>:
mov    %esi,%ecx
mov    $0x1,%eax
shl    %cl,%rax
or     %rax,(%rdi)
ret

LLVM IR (-O0):
define void @set_bit(i64* %0, i32 %1) {
%3 = alloca i64*
%4 = alloca i32
store i64* %0, i64** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = zext i32 %5 to i64
%7 = shl i64 1, %6
%8 = load i64*, i64** %3
%9 = load i64, i64* %8
%10 = or i64 %9, %7
store i64 %10, i64* %8
ret void
}

LLVM IR (-O2):
define void @set_bit(i64* nocapture %0, i32 %1) {
%3 = zext i32 %1 to i64
%4 = shl nuw i64 1, %3
%5 = load i64, i64* %0
%6 = or i64 %5, %4
store i64 %6, i64* %0
ret void
}
unsigned int GET_UAA32LE(void *p, unsigned int i) {
  unsigned char *_p = (unsigned char *)&((unsigned int *)p)[i];
  return (unsigned int)_p[0] | (unsigned int)_p[1] << 8 |
         (unsigned int)_p[2] << 16 | (unsigned int)_p[3] << 24;
}


x86 assembly (clang, -O0):
<GET_UAA32LE>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x18(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x18(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GET_UAA32LE>:
mov    %esi,%eax
mov    (%rdi,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @GET_UAA32LE(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i32*
%8 = load i32, i32* %4
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds i32, i32* %7, i64 %9
%11 = bitcast i32* %10 to i8*
store i8* %11, i8** %5
%12 = load i8*, i8** %5
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = load i8*, i8** %5
%17 = getelementptr inbounds i8, i8* %16, i64 1
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = shl i32 %19, 8
%21 = or i32 %15, %20
%22 = load i8*, i8** %5
%23 = getelementptr inbounds i8, i8* %22, i64 2
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = shl i32 %25, 16
%27 = or i32 %21, %26
%28 = load i8*, i8** %5
%29 = getelementptr inbounds i8, i8* %28, i64 3
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = shl i32 %31, 24
%33 = or i32 %27, %32
ret i32 %33
}

LLVM IR (-O2):
define i32 @GET_UAA32LE(i8* nocapture %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = zext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %3, i64 %4
%6 = bitcast i32* %5 to i8*
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = shl nuw nsw i32 %11, 8
%13 = or i32 %12, %8
%14 = getelementptr inbounds i8, i8* %6, i64 2
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = shl nuw nsw i32 %16, 16
%18 = or i32 %13, %17
%19 = getelementptr inbounds i8, i8* %6, i64 3
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = shl nuw i32 %21, 24
%23 = or i32 %18, %22
ret i32 %23
}
f(int x) { int ar[2][x]; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %4
%9 = mul nuw i64 2, %7
%10 = alloca i32, i64 %9
store i64 %7, i64* %5
%11 = load i8*, i8** %4
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @f(i32 %0) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int catAnetClose(int fd) {
  close(fd);
  return 1;
}


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

x86 assembly (clang, -O2):
<catAnetClose>:
push   %rax
call   1030 <close@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @catAnetClose(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int endmntent(FILE *fp) {
  if (fp)
    fclose(fp);
  return 1;
}


x86 assembly (clang, -O0):
<endmntent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <endmntent+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<endmntent>:
test   %rdi,%rdi
je     111f <endmntent+0xf>
push   %rax
call   1030 <fclose@plt>
add    $0x8,%rsp
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @endmntent(i32* %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @fclose(i32* %0)
br label %5
5: ; preds = %3, %1
ret i32 1
}
int op_add(int a, int b) { return (a + b); }


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

x86 assembly (clang, -O2):
<op_add>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @op_add(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 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @op_add(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
int /*<<< orphan*/ serial_write(char *);
void puts(unsigned short target, char *buf) {
  switch (target) {
  case 0:
    print(buf);
    break;
  case 1:
    serial_write(buf);
    break;
  default:
    print(buf);
  }
}


x86 assembly (clang, -O0):
<puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
movzwl -0x2(%rbp),%eax
mov    %eax,-0x14(%rbp)
test   %eax,%eax
je     1158 <puts+0x38>
jmp    1147 <puts+0x27>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
je     1166 <puts+0x46>
jmp    1174 <puts+0x54>
mov    -0x10(%rbp),%rdi
call   1030 <print@plt>
jmp    117d <puts+0x5d>
mov    -0x10(%rbp),%rdi
call   1040 <serial_write@plt>
jmp    117d <puts+0x5d>
mov    -0x10(%rbp),%rdi
call   1030 <print@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<puts>:
cmp    $0x1,%di
je     1131 <puts+0x11>
test   %di,%di
mov    %rsi,%rdi
jmp    1030 <print@plt>
mov    %rsi,%rdi
jmp    1040 <serial_write@plt>

LLVM IR (-O0):
define void @puts(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 = zext i16 %5 to i32
switch i32 %6, label %13 [
i32 0, label %7
i32 1, label %10
]
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = call i32 @print(i8* %8)
br label %16
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = call i32 @serial_write(i8* %11)
br label %16
13: ; preds = %2
%14 = load i8*, i8** %4
%15 = call i32 @print(i8* %14)
br label %16
16: ; preds = %13, %10, %7
ret void
}

LLVM IR (-O2):
define void @puts(i16 zeroext %0, i8* %1) {
switch i16 %0, label %7 [
i16 0, label %3
i16 1, label %5
]
3: ; preds = %2
%4 = tail call i32 @print(i8* %1)
br label %9
5: ; preds = %2
%6 = tail call i32 @serial_write(i8* %1)
br label %9
7: ; preds = %2
%8 = tail call i32 @print(i8* %1)
br label %9
9: ; preds = %7, %5, %3
ret void
}
int mm_free2os() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @mm_free2os() {
ret i32 0
}
int do_216() { return 216; }


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

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

LLVM IR (-O0):
define i32 @do_216() {
ret i32 216
}

LLVM IR (-O2):
define i32 @do_216() {
ret i32 216
}
float getRandomNumber() { return 4.0; }


x86 assembly (clang, -O0):
<getRandomNumber>:
push   %rbp
mov    %rsp,%rbp
movss  0xef4(%rip),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<getRandomNumber>:
movss  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define float @getRandomNumber() {
ret float 4.000000e+00
}

LLVM IR (-O2):
define float @getRandomNumber() {
ret float 4.000000e+00
}
/* Type definitions */
typedef int time_t;

/* Variables and functions */
int /*<<< orphan*/ date_string(int, int, char *, int);
int /*<<< orphan*/ localtime(int *);
int /*<<< orphan*/ time(int *);
int tm_to_time_t(int /*<<< orphan*/);
void datestamp(char *buf, int bufsize) {
  time_t now;
  int offset;
  time(&now);
  offset = tm_to_time_t(localtime(&now)) - now;
  offset /= 60;
  date_string(now, offset, buf, bufsize);
}


x86 assembly (clang, -O0):
<datestamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x10(%rbp),%rdi
call   1060 <time@plt>
lea    -0x10(%rbp),%rdi
call   1030 <localtime@plt>
mov    %eax,%edi
call   1050 <tm_to_time_t@plt>
sub    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
call   1040 <date_string@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<datestamp>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%r14d
mov    %rdi,%rbx
lea    0xc(%rsp),%rbp
mov    %rbp,%rdi
call   1060 <time@plt>
mov    %rbp,%rdi
call   1030 <localtime@plt>
mov    %eax,%edi
call   1050 <tm_to_time_t@plt>
mov    0xc(%rsp),%edi
sub    %edi,%eax
movslq %eax,%rsi
imul   $0xffffffff88888889,%rsi,%rax
shr    $0x20,%rax
add    %eax,%esi
mov    %esi,%eax
shr    $0x1f,%eax
sar    $0x5,%esi
add    %eax,%esi
mov    %rbx,%rdx
mov    %r14d,%ecx
call   1040 <date_string@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @datestamp(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = call i32 @time(i32* %5)
%8 = call i32 @localtime(i32* %5)
%9 = call i32 @tm_to_time_t(i32 %8)
%10 = load i32, i32* %5
%11 = sub nsw i32 %9, %10
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = sdiv i32 %12, 60
store i32 %13, i32* %6
%14 = load i32, i32* %5
%15 = load i32, i32* %6
%16 = load i8*, i8** %3
%17 = load i32, i32* %4
%18 = call i32 @date_string(i32 %14, i32 %15, i8* %16, i32 %17)
ret void
}

LLVM IR (-O2):
define void @datestamp(i8* %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @time(i32* %3)
%6 = call i32 @localtime(i32* %3)
%7 = call i32 @tm_to_time_t(i32 %6)
%8 = load i32, i32* %3
%9 = sub nsw i32 %7, %8
%10 = sdiv i32 %9, 60
%11 = call i32 @date_string(i32 %8, i32 %10, i8* %0, i32 %1)
ret void
}
/* Type definitions */
typedef int int16_t;

/* Variables and functions */
float Ltc4151ShuntRawToAmps(int16_t shunt_raw, float shunt_resistor) {
  return (float)(shunt_raw >> 4) * 20e-6f / shunt_resistor;
}


x86 assembly (clang, -O0):
<Ltc4151ShuntRawToAmps>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
cvtsi2ss %eax,%xmm0
movss  0xee2(%rip),%xmm1
mulss  %xmm1,%xmm0
divss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Ltc4151ShuntRawToAmps>:
sar    $0x4,%edi
cvtsi2ss %edi,%xmm1
mulss  0xef1(%rip),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @Ltc4151ShuntRawToAmps(i32 %0, float %1) {
%3 = alloca i32
%4 = alloca float
store i32 %0, i32* %3
store float %1, float* %4
%5 = load i32, i32* %3
%6 = ashr i32 %5, 4
%7 = sitofp i32 %6 to float
%8 = fmul float %7, 0x3EF4F8B580000000
%9 = load float, float* %4
%10 = fdiv float %8, %9
ret float %10
}

LLVM IR (-O2):
define float @Ltc4151ShuntRawToAmps(i32 %0, float %1) {
%3 = ashr i32 %0, 4
%4 = sitofp i32 %3 to float
%5 = fmul float %4, 0x3EF4F8B580000000
%6 = fdiv float %5, %1
ret float %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ test1();
int /*<<< orphan*/ test2();
int /*<<< orphan*/ test3();
int main() {
  test1();
  test2();
  test3();
  printf("success\n");
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <test1@plt>
xor    %eax,%eax
call   1060 <test2@plt>
xor    %eax,%eax
call   1040 <test3@plt>
lea    0xea3(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [8 x i8] c"success\00"
define i32 @main() {
%1 = tail call i32 (...) @test1()
%2 = tail call i32 (...) @test2()
%3 = tail call i32 (...) @test3()
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char);
unsigned char read_di(int n) {
  unsigned char val;
  val = ((n % 2) == 0);
  printf("DI %d, return %c\n", n, val ? 'T' : 'F');
  return val;
}


x86 assembly (clang, -O0):
<read_di>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%esi
movzbl -0x5(%rbp),%edx
mov    $0x46,%eax
mov    $0x54,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
lea    0xeae(%rip),%rdi
movsbl %al,%edx
call   1030 <printf@plt>
movzbl -0x5(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_di>:
push   %rbx
mov    %edi,%esi
mov    %esi,%ebx
not    %bl
and    $0x1,%bl
test   $0x1,%sil
mov    $0x46,%eax
mov    $0x54,%edx
cmovne %eax,%edx
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"DI %d, return %c\0A\00"
define zeroext i8 @read_di(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = srem i32 %4, 2
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
%8 = trunc i32 %7 to i8
store i8 %8, i8* %3
%9 = load i32, i32* %2
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = icmp ne i32 %11, 0
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 84, i32 70
%15 = trunc i32 %14 to i8
%16 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %9, i8 signext %15)
%17 = load i8, i8* %3
ret i8 %17
}

LLVM IR (-O2):
@.str = [18 x i8] c"DI %d, return %c\0A\00"
define zeroext i8 @read_di(i32 %0) {
%2 = trunc i32 %0 to i8
%3 = and i8 %2, 1
%4 = xor i8 %3, 1
%5 = icmp eq i8 %4, 0
%6 = select i1 %5, i8 70, i8 84
%7 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %0, i8 signext %6)
ret i8 %4
}
int gcd(int a, int b) {
  if (b == 0) {
    return 1;
  }
  while (b) {
    int rem = a % b;
    a = b;
    b = rem;
  }
  return a;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1120 <gcd+0x20>
movl   $0x1,-0x4(%rbp)
jmp    1150 <gcd+0x50>
jmp    1125 <gcd+0x25>
cmpl   $0x0,-0xc(%rbp)
je     114a <gcd+0x4a>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <gcd+0x25>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
test   %esi,%esi
je     111e <gcd+0x1e>
mov    %esi,%edx
mov    %edi,%eax
nopl   0x0(%rax,%rax,1)
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <gcd+0x10>
mov    %ecx,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %1, %2 ]
%6 = phi i32 [ %5, %4 ], [ %0, %2 ]
%7 = srem i32 %6, %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ 1, %2 ], [ %5, %4 ]
ret i32 %10
}
/* Variables and functions */
int preload(int);
int /*<<< orphan*/ printf(char *, int, char *);
int main(void) {
  int res = preload(42);
  printf("preload (42) = %d, %s\n", res, res == 92 ? "ok" : "wrong");
  return res != 92;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2a,%edi
call   1040 <preload@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%ecx
lea    0xed1(%rip),%rdx
lea    0xec7(%rip),%rax
cmp    $0x5c,%ecx
cmove  %rax,%rdx
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x5c,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x2a,%edi
call   1040 <preload@plt>
xor    %ebx,%ebx
cmp    $0x5c,%eax
lea    0xee0(%rip),%rcx
lea    0xedc(%rip),%rdx
cmove  %rcx,%rdx
lea    0xeb7(%rip),%rdi
setne  %bl
mov    %eax,%esi
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"preload (42) = %d, %s\0A\00"
@.str.1 = [3 x i8] c"ok\00"
@.str.2 = [6 x i8] c"wrong\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @preload(i32 42)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 92
%7 = zext i1 %6 to i64
%8 = select i1 %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
%9 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %4, i8* %8)
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, 92
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
@.str = [23 x i8] c"preload (42) = %d, %s\0A\00"
@.str.1 = [3 x i8] c"ok\00"
@.str.2 = [6 x i8] c"wrong\00"
define i32 @main() {
%1 = tail call i32 @preload(i32 42)
%2 = icmp eq i32 %1, 92
%3 = select i1 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %1, i8* %3)
%5 = icmp ne i32 %1, 92
%6 = zext i1 %5 to i32
ret i32 %6
}
double log10(double x) {
  double r;
  if (!x)
    return __pole_error(1);
  __asm__ __volatile__("fld1; fyl2x; fldl2t; fdivrp" : "=t"(r) : "0"(x));
  return r;
}


x86 assembly (clang, -O0):
<log10>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    114f <log10+0x3f>
jp     114f <log10+0x3f>
mov    $0x1,%edi
mov    $0x0,%al
call   1030 <__pole_error@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    117b <log10+0x6b>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
fldl   -0x20(%rbp)
fld1
fyl2x
fldl2t
fdivrp %st,%st(1)
fstpl  -0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log10>:
sub    $0x18,%rsp
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1120 <log10+0x10>
jnp    1141 <log10+0x31>
movsd  %xmm0,0x10(%rsp)
fldl   0x10(%rsp)
fld1
fyl2x
fldl2t
fdivrp %st,%st(1)
fstpl  0x8(%rsp)
movsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret
mov    $0x1,%edi
xor    %eax,%eax
call   1030 <__pole_error@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @log10(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %3
%5 = load double, double* %3
%6 = fcmp une double %5, 0.000000e+00
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = call i32 (i32, ...) bitcast (i32 (...)* @__pole_error to i32 (i32, ...)*)(i32 1)
%9 = sitofp i32 %8 to double
store double %9, double* %2
br label %14
10: ; preds = %1
%11 = load double, double* %3
%12 = call double asm sideeffect "fld1; fyl2x; fldl2t; fdivrp", "={st},0,~{dirflag},~{fpsr},~{flags}"(double %11)
store double %12, double* %4
%13 = load double, double* %4
store double %13, double* %2
br label %14
14: ; preds = %10, %7
%15 = load double, double* %2
ret double %15
}

LLVM IR (-O2):
define double @log10(double %0) {
%2 = fcmp une double %0, 0.000000e+00
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @__pole_error to i32 (i32, ...)*)(i32 1)
%5 = sitofp i32 %4 to double
br label %8
6: ; preds = %1
%7 = tail call double asm sideeffect "fld1; fyl2x; fldl2t; fdivrp", "={st},0,~{dirflag},~{fpsr},~{flags}"(double %0)
br label %8
8: ; preds = %6, %3
%9 = phi double [ %7, %6 ], [ %5, %3 ]
ret double %9
}
void bar(long x, long y, long z) {
  struct __attribute__((aligned(16))) S {
    long a, b, c, d;
  } s;
  char *p = (char *)&s;
  __asm("" : "+r"(p));
  if (((long unsigned int)p) & 15)
    __builtin_abort();
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
and    $0xf,%rax
cmp    $0x0,%rax
je     114b <bar+0x3b>
call   1030 <abort@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
sub    $0x28,%rsp
mov    %rsp,%rax
test   $0xf,%al
jne    1120 <bar+0x10>
add    $0x28,%rsp
ret
call   1030 <abort@plt>

LLVM IR (-O0):
%struct.S = type { i64, i64, i64, i64 }
define void @bar(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca %struct.S
%8 = alloca i8*
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%9 = bitcast %struct.S* %7 to i8*
store i8* %9, i8** %8
%10 = load i8*, i8** %8
%11 = call i8* asm "", "=r,0,~{dirflag},~{fpsr},~{flags}"(i8* %10)
store i8* %11, i8** %8
%12 = load i8*, i8** %8
%13 = ptrtoint i8* %12 to i64
%14 = and i64 %13, 15
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %3
unreachable
17: ; preds = %3
ret void
}

LLVM IR (-O2):
%struct.S = type { i64, i64, i64, i64 }
define void @bar(i64 %0, i64 %1, i64 %2) {
%4 = alloca %struct.S
%5 = bitcast %struct.S* %4 to i8*
%6 = call i8* asm "", "=r,0,~{dirflag},~{fpsr},~{flags}"(i8* %5)
%7 = ptrtoint i8* %6 to i64
%8 = and i64 %7, 15
%9 = icmp eq i64 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %3
unreachable
11: ; preds = %3
ret void
}
int hfsplus_posix_acl_chmod(struct inode *inode) { return 0; }


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

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

LLVM IR (-O0):
%struct.inode = type opaque
define i32 @hfsplus_posix_acl_chmod(%struct.inode* %0) {
%2 = alloca %struct.inode*
store %struct.inode* %0, %struct.inode** %2
ret i32 0
}

LLVM IR (-O2):
%struct.inode = type opaque
define i32 @hfsplus_posix_acl_chmod(%struct.inode* nocapture readnone %0) {
ret i32 0
}
void g_node_traverse() {}


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

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

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

LLVM IR (-O2):
define void @g_node_traverse() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ clear_cmd;

/* Variables and functions */
int /*<<< orphan*/ drv_GU311_send_string(char *, int);
int /*<<< orphan*/ ndelay(int);
void drv_GU311_clear(void) {
  static char clear_cmd[] = {0x01, 'O', 'P'};
  drv_GU311_send_string(clear_cmd, sizeof(clear_cmd));
  ndelay(500);
}


x86 assembly (clang, -O0):
<drv_GU311_clear>:
push   %rbp
mov    %rsp,%rbp
lea    0x2f05(%rip),%rdi
mov    $0x3,%esi
call   1030 <drv_GU311_send_string@plt>
mov    $0x1f4,%edi
call   1040 <ndelay@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<drv_GU311_clear>:
push   %rax
lea    0x2f08(%rip),%rdi
mov    $0x3,%esi
call   1030 <drv_GU311_send_string@plt>
mov    $0x1f4,%edi
pop    %rax
jmp    1040 <ndelay@plt>

LLVM IR (-O0):
@drv_GU311_clear.clear_cmd = internal global [3 x i8] c"\01OP"
define void @drv_GU311_clear() {
%1 = call i32 @drv_GU311_send_string(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @drv_GU311_clear.clear_cmd, i64 0, i64 0), i32 3)
%2 = call i32 @ndelay(i32 500)
ret void
}

LLVM IR (-O2):
@drv_GU311_clear.clear_cmd = internal global [3 x i8] c"\01OP"
define void @drv_GU311_clear() {
%1 = tail call i32 @drv_GU311_send_string(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @drv_GU311_clear.clear_cmd, i64 0, i64 0), i32 3)
%2 = tail call i32 @ndelay(i32 500)
ret void
}
int test_threefourths(int x) {
  long long llx = (long long)x;
  long long val = 3 * llx / 4;
  return (int)val;
}


x86 assembly (clang, -O0):
<test_threefourths>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
imul   $0x3,-0x10(%rbp),%rax
mov    $0x4,%ecx
cqto
idiv   %rcx
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_threefourths>:
movslq %edi,%rax
lea    (%rax,%rax,2),%rcx
lea    (%rax,%rax,2),%rax
add    $0x3,%rax
test   %rcx,%rcx
cmovns %rcx,%rax
shr    $0x2,%rax
ret

LLVM IR (-O0):
define i32 @test_threefourths(i32 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = mul nsw i64 3, %7
%9 = sdiv i64 %8, 4
store i64 %9, i64* %4
%10 = load i64, i64* %4
%11 = trunc i64 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @test_threefourths(i32 %0) {
%2 = sext i32 %0 to i64
%3 = mul nsw i64 %2, 3
%4 = sdiv i64 %3, 4
%5 = trunc i64 %4 to i32
ret i32 %5
}
/* Variables and functions */
float poly(float, float, float, int /*<<< orphan*/, int);
float linear(float fraction, float start, float delta) {
  return poly(fraction, start, delta, 0, 1);
}


x86 assembly (clang, -O0):
<linear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <poly@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<linear>:
xor    %edi,%edi
mov    $0x1,%esi
jmp    1030 <poly@plt>

LLVM IR (-O0):
define float @linear(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = load float, float* %6
%10 = call float @poly(float %7, float %8, float %9, i32 0, i32 1)
ret float %10
}

LLVM IR (-O2):
define float @linear(float %0, float %1, float %2) {
%4 = tail call float @poly(float %0, float %1, float %2, i32 0, i32 1)
ret float %4
}