xunge/DecIR huggingface dataset:
/* Type definitions */
struct nouveau_channel {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ OUT_RING(struct nouveau_channel *, int);
void BEGIN_NV04(struct nouveau_channel *chan, int subc, int mthd, int size) {
  OUT_RING(chan, 0x00000000 | (subc << 13) | (size << 18) | mthd);
}


x86 assembly (clang, -O0):
<BEGIN_NV04>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
shl    $0xd,%esi
or     $0x0,%esi
mov    -0x14(%rbp),%eax
shl    $0x12,%eax
or     %eax,%esi
or     -0x10(%rbp),%esi
call   1030 <OUT_RING@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BEGIN_NV04>:
shl    $0xd,%esi
shl    $0x12,%ecx
or     %edx,%esi
or     %ecx,%esi
jmp    1030 <OUT_RING@plt>

LLVM IR (-O0):
%struct.nouveau_channel = type { i32 }
define void @BEGIN_NV04(%struct.nouveau_channel* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca %struct.nouveau_channel*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store %struct.nouveau_channel* %0, %struct.nouveau_channel** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load %struct.nouveau_channel*, %struct.nouveau_channel** %5
%10 = load i32, i32* %6
%11 = shl i32 %10, 13
%12 = or i32 0, %11
%13 = load i32, i32* %8
%14 = shl i32 %13, 18
%15 = or i32 %12, %14
%16 = load i32, i32* %7
%17 = or i32 %15, %16
%18 = call i32 @OUT_RING(%struct.nouveau_channel* %9, i32 %17)
ret void
}

LLVM IR (-O2):
%struct.nouveau_channel = type { i32 }
define void @BEGIN_NV04(%struct.nouveau_channel* %0, i32 %1, i32 %2, i32 %3) {
%5 = shl i32 %1, 13
%6 = shl i32 %3, 18
%7 = or i32 %5, %2
%8 = or i32 %7, %6
%9 = tail call i32 @OUT_RING(%struct.nouveau_channel* %0, i32 %8)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
FILE *xfopen(char *fn, char *mode) { return (fopen(fn, mode)); }


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

x86 assembly (clang, -O2):
<xfopen>:
jmp    1030 <fopen@plt>

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

LLVM IR (-O2):
define noalias i32* @xfopen(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32* @fopen(i8* %0, i8* %1)
ret i32* %3
}
/* Variables and functions */
scalar_t__ floor(double);
double gps_time(double julday, int *week) {
  double tow, days_gps;
  int wn;
  julday += (13.0 / 86400.0);
  days_gps = (julday - 2444244.5);
  wn = (int)floor(days_gps / 7);
  tow = (days_gps - wn * 7) * 86400;
  *week = wn;
  return tow;
}


x86 assembly (clang, -O0):
<gps_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  0xeef(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xed0(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xeb2(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <floor@plt>
mov    %eax,-0x24(%rbp)
movsd  -0x20(%rbp),%xmm0
imul   $0x7,-0x24(%rbp),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  0xe85(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x24(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movsd  -0x18(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gps_time>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
addsd  0xee0(%rip),%xmm0
addsd  0xee0(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
divsd  0xeda(%rip),%xmm0
call   1030 <floor@plt>
lea    0x0(,%rax,8),%ecx
sub    %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xebb(%rip),%xmm1
movapd %xmm1,%xmm0
mov    %eax,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @gps_time(double %0, i32* %1) {
%3 = alloca double
%4 = alloca i32*
%5 = alloca double
%6 = alloca double
%7 = alloca i32
store double %0, double* %3
store i32* %1, i32** %4
%8 = load double, double* %3
%9 = fadd double %8, 0x3F23B8B302A7A1F2
store double %9, double* %3
%10 = load double, double* %3
%11 = fsub double %10, 0x4142A5EA40000000
store double %11, double* %6
%12 = load double, double* %6
%13 = fdiv double %12, 7.000000e+00
%14 = call i64 @floor(double %13)
%15 = trunc i64 %14 to i32
store i32 %15, i32* %7
%16 = load double, double* %6
%17 = load i32, i32* %7
%18 = mul nsw i32 %17, 7
%19 = sitofp i32 %18 to double
%20 = fsub double %16, %19
%21 = fmul double %20, 8.640000e+04
store double %21, double* %5
%22 = load i32, i32* %7
%23 = load i32*, i32** %4
store i32 %22, i32* %23
%24 = load double, double* %5
ret double %24
}

LLVM IR (-O2):
define double @gps_time(double %0, i32* nocapture writeonly %1) {
%3 = fadd double %0, 0x3F23B8B302A7A1F2
%4 = fadd double %3, 0xC142A5EA40000000
%5 = fdiv double %4, 7.000000e+00
%6 = tail call i64 @floor(double %5)
%7 = trunc i64 %6 to i32
%8 = mul nsw i32 %7, 7
%9 = sitofp i32 %8 to double
%10 = fsub double %4, %9
%11 = fmul double %10, 8.640000e+04
store i32 %7, i32* %1
ret double %11
}
/* Variables and functions */
double __ieee754_scalb(double, double);
scalar_t__ ilogb(double);
double significand(double x) { return __ieee754_scalb(x, (double)-ilogb(x)); }


x86 assembly (clang, -O0):
<significand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <ilogb@plt>
movsd  -0x10(%rbp),%xmm0
mov    %rax,%rcx
xor    %eax,%eax
sub    %rcx,%rax
cvtsi2sd %rax,%xmm1
call   1030 <__ieee754_scalb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<significand>:
push   %rax
movsd  %xmm0,(%rsp)
call   1040 <ilogb@plt>
neg    %rax
cvtsi2sd %rax,%xmm1
movsd  (%rsp),%xmm0
pop    %rax
jmp    1030 <__ieee754_scalb@plt>

LLVM IR (-O0):
define double @significand(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = call i64 @ilogb(double %4)
%6 = sub nsw i64 0, %5
%7 = sitofp i64 %6 to double
%8 = call double @__ieee754_scalb(double %3, double %7)
ret double %8
}

LLVM IR (-O2):
define double @significand(double %0) {
%2 = tail call i64 @ilogb(double %0)
%3 = sub nsw i64 0, %2
%4 = sitofp i64 %3 to double
%5 = tail call double @__ieee754_scalb(double %0, double %4)
ret double %5
}
void gtk_combo_box_new_text() {}


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

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

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

LLVM IR (-O2):
define void @gtk_combo_box_new_text() {
ret void
}
void cam_interrupt_enable(const int c) {}


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

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

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

LLVM IR (-O2):
define void @cam_interrupt_enable(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
void print_5(char c) { printf("%c", c); }


x86 assembly (clang, -O0):
<print_5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    0xedb(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_5>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @print_5(i8 signext %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %0)
ret void
}
char *get_file_ext(char *filename) {
  char **words;
  char *ext;
  int w_count;
  words = split_str(filename, '.', &w_count);
  ext = words[1];
  free(words[0]);
  free(words);
  return ext;
}


x86 assembly (clang, -O0):
<get_file_ext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2e,%esi
lea    -0x1c(%rbp),%rdx
mov    $0x0,%al
call   1040 <split_str@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_file_ext>:
push   %r14
push   %rbx
push   %rax
lea    0x4(%rsp),%rdx
mov    $0x2e,%esi
xor    %eax,%eax
call   1040 <split_str@plt>
movslq %eax,%rbx
mov    (%rbx),%rdi
mov    0x8(%rbx),%r14
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @get_file_ext(i8* %0) {
%2 = alloca i8*
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 (i8*, i32, i32*, ...) bitcast (i32 (...)* @split_str to i32 (i8*, i32, i32*, ...)*)(i8* %6, i32 46, i32* %5)
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i8**
store i8** %9, i8*** %3
%10 = load i8**, i8*** %3
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
store i8* %12, i8** %4
%13 = load i8**, i8*** %3
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = load i8**, i8*** %3
%17 = bitcast i8** %16 to i8*
%18 = load i8*, i8** %4
ret i8* %18
}

LLVM IR (-O2):
define i8* @get_file_ext(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 (i8*, i32, i32*, ...) bitcast (i32 (...)* @split_str to i32 (i8*, i32, i32*, ...)*)(i8* %0, i32 46, i32* %2)
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8**
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = load i8*, i8** %6
%10 = inttoptr i64 %5 to i8*
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
void con_end(void) { endwin(); }


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

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

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

LLVM IR (-O2):
define void @con_end() {
%1 = tail call i32 (...) @endwin()
ret void
}
/* Variables and functions */
unsigned int htonl(unsigned int);
int /*<<< orphan*/ printf(char *);
int send(int, unsigned char *, int, int /*<<< orphan*/);
int send_dword(int sockfd, unsigned int data) {
  unsigned int temp = htonl(data);
  if (send(sockfd, (unsigned char *)&temp, 4, 0) == -1) {
    printf("Error sending to client\n");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<send_dword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <htonl@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
cmp    $0xffffffff,%eax
jne    117d <send_dword+0x4d>
lea    0xe94(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1184 <send_dword+0x54>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_dword>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    %esi,%edi
call   1050 <htonl@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rsi
xor    %ebx,%ebx
mov    %ebp,%edi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
cmp    $0xffffffff,%eax
jne    116b <send_dword+0x3b>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Error sending to client\0A\00"
define i32 @send_dword(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 = call i32 @htonl(i32 %7)
store i32 %8, i32* %6
%9 = load i32, i32* %4
%10 = bitcast i32* %6 to i8*
%11 = call i32 @send(i32 %9, i8* %10, i32 4, i32 0)
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %16
15: ; preds = %2
store i32 0, i32* %3
br label %16
16: ; preds = %15, %13
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@str = [24 x i8] c"Error sending to client\00"
define i32 @send_dword(i32 %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @htonl(i32 %1)
store i32 %5, i32* %3
%6 = call i32 @send(i32 %0, i8* %4, i32 4, i32 0)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
br label %10
10: ; preds = %2, %8
%11 = phi i32 [ -1, %8 ], [ 0, %2 ]
ret i32 %11
}
void __attribute__((visibility("hidden"))) lib1_hidden(void) {}


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

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

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

LLVM IR (-O2):
define hidden void @lib1_hidden() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ atol(char *);
int create_file(char *, int /*<<< orphan*/);
int /*<<< orphan*/ error(char *);
int main(int argc, char *argv[]) {
  if (argc != 3) {
    error(argv[0]);
    return 1;
  } else
    return create_file(argv[1], atol(argv[2]));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1168 <main+0x38>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <error@plt>
movl   $0x1,-0x4(%rbp)
jmp    118f <main+0x5f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atol@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1050 <create_file@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x3,%edi
jne    114e <main+0x1e>
mov    0x8(%rsi),%rbx
mov    0x10(%rsi),%rdi
call   1040 <atol@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1050 <create_file@plt>
mov    (%rsi),%rdi
call   1030 <error@plt>
mov    $0x1,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @error(i8* %5)
br label %14
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i32 @atol(i8* %11)
%13 = tail call i32 @create_file(i8* %9, i32 %12)
br label %14
14: ; preds = %7, %4
%15 = phi i32 [ 1, %4 ], [ %13, %7 ]
ret i32 %15
}
int test_imm_EEuint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0xEE << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_EEuint64_highword_mem>:
testb  $0xee,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_EEuint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 1022202216448
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void bswap48(uint8_t *buf) { (void)buf; }


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

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

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

LLVM IR (-O2):
define void @bswap48(i32* nocapture %0) {
ret void
}
/* Variables and functions */
int RAND_MAX;
int scalanative_libc_rand_max() { return RAND_MAX; }


x86 assembly (clang, -O0):
<scalanative_libc_rand_max>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<scalanative_libc_rand_max>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@RAND_MAX = global i32 0
define i32 @scalanative_libc_rand_max() {
%1 = load i32, i32* @RAND_MAX
ret i32 %1
}

LLVM IR (-O2):
@RAND_MAX = global i32 0
define i32 @scalanative_libc_rand_max() {
%1 = load i32, i32* @RAND_MAX
ret i32 %1
}
/* Variables and functions */
int mkdir(char const *, int);
int fs_create_dir(const char *dir_name) { return mkdir(dir_name, 0764); }


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

x86 assembly (clang, -O2):
<fs_create_dir>:
mov    $0x1f4,%esi
jmp    1030 <mkdir@plt>

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

LLVM IR (-O2):
define i32 @fs_create_dir(i8* nocapture %0) {
%2 = tail call i32 @mkdir(i8* %0, i32 500)
ret i32 %2
}
void delay(unsigned int ii) {
  unsigned int jj;
  for (jj = ii; jj > 0; jj--)
    asm("nop");
}


x86 assembly (clang, -O0):
<delay>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jbe    1126 <delay+0x26>
nop
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    110d <delay+0xd>
pop    %rbp
ret

x86 assembly (clang, -O2):
<delay>:
test   %edi,%edi
je     1116 <delay+0x16>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
nop
add    $0xffffffff,%edi
jne    1110 <delay+0x10>
ret

LLVM IR (-O0):
define void @delay(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
store i32 %4, i32* %3
br label %5
5: ; preds = %9, %1
%6 = load i32, i32* %3
%7 = icmp ugt i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %5
br label %9
9: ; preds = %8
%10 = load i32, i32* %3
%11 = add i32 %10, -1
store i32 %11, i32* %3
br label %5
12: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @delay(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %7, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %5, %3 ], [ %0, %1 ]
tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"()
%5 = add i32 %4, -1
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %3
7: ; preds = %3, %1
ret void
}
int vga_switcheroo_register_client(
    struct pci_dev *dev, const struct vga_switcheroo_client_ops *ops) {
  return 0;
}


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

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

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

LLVM IR (-O2):
%struct.pci_dev = type opaque
%struct.vga_switcheroo_client_ops = type opaque
define i32 @vga_switcheroo_register_client(%struct.pci_dev* nocapture readnone %0, %struct.vga_switcheroo_client_ops* nocapture readnone %1) {
ret i32 0
}
int f3(int y, int x) { return (y | (~x)) & x; }


x86 assembly (clang, -O0):
<f3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
xor    $0xffffffff,%ecx
or     %ecx,%eax
and    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f3>:
mov    %edi,%eax
and    %esi,%eax
ret

LLVM IR (-O0):
define i32 @f3(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 = xor i32 %6, -1
%8 = or i32 %5, %7
%9 = load i32, i32* %4
%10 = and i32 %8, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @f3(i32 %0, i32 %1) {
%3 = and i32 %1, %0
ret i32 %3
}
/* Variables and functions */
scalar_t__ NOROM_DDI16BitfieldRead(int, int, int, int /*<<< orphan*/);
bool OSCHfSourceReady(void) {
  return (NOROM_DDI16BitfieldRead(0x400CA000, 0x00000034, 0x00000001, 0))
             ? true
             : false;
}


x86 assembly (clang, -O0):
<OSCHfSourceReady>:
push   %rbp
mov    %rsp,%rbp
mov    $0x400ca000,%edi
mov    $0x34,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <NOROM_DDI16BitfieldRead@plt>
mov    %rax,%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<OSCHfSourceReady>:
push   %rax
mov    $0x400ca000,%edi
mov    $0x34,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <NOROM_DDI16BitfieldRead@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @OSCHfSourceReady() {
%1 = call i64 @NOROM_DDI16BitfieldRead(i32 1074569216, i32 52, i32 1, i32 0)
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i64
%4 = select i1 %2, i32 1, i32 0
ret i32 %4
}

LLVM IR (-O2):
define i32 @OSCHfSourceReady() {
%1 = tail call i64 @NOROM_DDI16BitfieldRead(i32 1074569216, i32 52, i32 1, i32 0)
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
double test2(double a, double b, double c) { return a * b + c - b; }


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

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

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

LLVM IR (-O2):
define double @test2(double %0, double %1, double %2) {
%4 = tail call double @llvm.fmuladd.f64(double %0, double %1, double %2)
%5 = fsub double %4, %1
ret double %5
}
/* Type definitions */
typedef int /*<<< orphan*/ GLfloat;

/* Variables and functions */
int /*<<< orphan*/ glTexCoord4f(int /*<<< orphan*/, int /*<<< orphan*/,
                                int /*<<< orphan*/, int /*<<< orphan*/);
void TexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q) {
  glTexCoord4f(s, t, r, q);
}


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

x86 assembly (clang, -O2):
<TexCoord4f>:
jmp    1030 <glTexCoord4f@plt>

LLVM IR (-O0):
define void @TexCoord4f(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @glTexCoord4f(i32 %9, i32 %10, i32 %11, i32 %12)
ret void
}

LLVM IR (-O2):
define void @TexCoord4f(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @glTexCoord4f(i32 %0, i32 %1, i32 %2, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ link_error();
void foo(int a) {
  if (a < 0) {
    int y;
    a = -a;
    y = a / 7;
    y = y * 2;
    if (y > 1 << 30)
      link_error();
  }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    115d <foo+0x4d>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x40000000,-0x8(%rbp)
jle    1158 <foo+0x48>
mov    $0x0,%al
call   1030 <link_error@plt>
jmp    115d <foo+0x4d>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %18
6: ; preds = %1
%7 = load i32, i32* %2
%8 = sub nsw i32 0, %7
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = sdiv i32 %9, 7
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = mul nsw i32 %11, 2
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = icmp sgt i32 %13, 1073741824
br i1 %14, label %15, label %17
15: ; preds = %6
%16 = call i32 (...) @link_error()
br label %17
17: ; preds = %15, %6
br label %18
18: ; preds = %17, %1
ret void
}

LLVM IR (-O2):
define void @foo(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main(void) {
  int top, score;
  top = score = -(2 + 5) * 6 + (4 + 3 * (2 + 3));
  printf("top = %d, score = %d\n", top, score);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [22 x i8] c"top = %d, score = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 -23, i32 -23)
ret i32 0
}
int test_imm_B3uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0xB3 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_B3uint64_midword_reg>:
test   $0xb30000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_B3uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 11730944
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void sched_switch_user(struct task_struct *p) {}


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

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

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

LLVM IR (-O2):
%struct.task_struct = type opaque
define void @sched_switch_user(%struct.task_struct* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *program) {
  fprintf(stderr, "Usage: %s -i ontology -o output -c\n", program);
}


x86 assembly (clang, -O0):
<usage>:
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):
<usage>:
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 = [36 x i8] c"Usage: %s -i ontology -o output -c\0A\00"
define void @usage(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 ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [36 x i8] c"Usage: %s -i ontology -o output -c\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
struct passwd {
  char *pw_dir;
};

/* Variables and functions */
int /*<<< orphan*/ chdir(char const *);
struct passwd *getpwuid(int /*<<< orphan*/);
int /*<<< orphan*/ getuid();
int builtin_cd(int argc, const char *argv[]) {
  if (argc == 1) {
    struct passwd *pw = getpwuid(getuid());
    const char *homedir = pw->pw_dir;
    chdir(homedir);
  } else {
    chdir(argv[1]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<builtin_cd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1174 <builtin_cd+0x44>
mov    $0x0,%al
call   1050 <getuid@plt>
mov    %eax,%edi
call   1030 <getpwuid@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <chdir@plt>
jmp    1181 <builtin_cd+0x51>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <chdir@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<builtin_cd>:
push   %rax
cmp    $0x1,%edi
jne    1149 <builtin_cd+0x19>
xor    %eax,%eax
call   1050 <getuid@plt>
mov    %eax,%edi
call   1030 <getpwuid@plt>
mov    %rax,%rsi
jmp    114d <builtin_cd+0x1d>
add    $0x8,%rsi
mov    (%rsi),%rdi
call   1040 <chdir@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.passwd = type { i8* }
define i32 @builtin_cd(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca %struct.passwd*
%6 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %17
9: ; preds = %2
%10 = call i32 (...) @getuid()
%11 = call %struct.passwd* @getpwuid(i32 %10)
store %struct.passwd* %11, %struct.passwd** %5
%12 = load %struct.passwd*, %struct.passwd** %5
%13 = getelementptr inbounds %struct.passwd, %struct.passwd* %12, i32 0, i32 0
%14 = load i8*, i8** %13
store i8* %14, i8** %6
%15 = load i8*, i8** %6
%16 = call i32 @chdir(i8* %15)
br label %22
17: ; preds = %2
%18 = load i8**, i8*** %4
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @chdir(i8* %20)
br label %22
22: ; preds = %17, %9
ret i32 0
}

LLVM IR (-O2):
%struct.passwd = type { i8* }
define i32 @builtin_cd(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = tail call i32 (...) @getuid()
%6 = tail call %struct.passwd* @getpwuid(i32 %5)
%7 = getelementptr inbounds %struct.passwd, %struct.passwd* %6, i64 0, i32 0
br label %10
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
br label %10
10: ; preds = %8, %4
%11 = phi i8** [ %9, %8 ], [ %7, %4 ]
%12 = load i8*, i8** %11
%13 = tail call i32 @chdir(i8* %12)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
__attribute__((always_)) void tu_clear_right(void) { fputs("\x1b[0K", stdout); }


x86 assembly (clang, -O0):
<tu_clear_right>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <fputs@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<tu_clear_right>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdi
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"\1B[0K\00"
@stdout = global i32 0
define void @tu_clear_right() {
%1 = load i32, i32* @stdout
%2 = call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[0K\00"
@stdout = global i32 0
define void @tu_clear_right() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void powerlog6s_csv_header() {
  printf("interval,state,current (cA),voltage (cV),energy (mAh),");
  printf("cell1 (mV),cell2 (mV),cell3 (mV),cell4 (mV),cell5 (mV),cell6 (mV),");
  printf("rpm,internal_temp (ddC),temp2 (ddC),temp3 (ddC),temp4 (ddC),");
  printf("period,pulse\n");
}


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

x86 assembly (clang, -O2):
<powerlog6s_csv_header>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <printf@plt>
lea    0xf03(%rip),%rdi
call   1040 <printf@plt>
lea    0xf3a(%rip),%rdi
call   1040 <printf@plt>
lea    0xf6b(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [55 x i8] c"interval,state,current (cA),voltage (cV),energy (mAh),\00"
@.str.1 = [67 x i8] c"cell1 (mV),cell2 (mV),cell3 (mV),cell4 (mV),cell5 (mV),cell6 (mV),\00"
@.str.2 = [61 x i8] c"rpm,internal_temp (ddC),temp2 (ddC),temp3 (ddC),temp4 (ddC),\00"
@.str.3 = [14 x i8] c"period,pulse\0A\00"
define void @powerlog6s_csv_header() {
%1 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [55 x i8] c"interval,state,current (cA),voltage (cV),energy (mAh),\00"
@.str.1 = [67 x i8] c"cell1 (mV),cell2 (mV),cell3 (mV),cell4 (mV),cell5 (mV),cell6 (mV),\00"
@.str.2 = [61 x i8] c"rpm,internal_temp (ddC),temp2 (ddC),temp3 (ddC),temp4 (ddC),\00"
@str = [13 x i8] c"period,pulse\00"
define void @powerlog6s_csv_header() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret void
}
void list_init(void) { ; }


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

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

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

LLVM IR (-O2):
define void @list_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Q_strncpyz(char *, char *, int);
char *Sys_GetClipboardData();
int /*<<< orphan*/ Z_Free(char *);
void CL_GetClipboardData(char *buf, int buflen) {
  char *cbd;
  cbd = Sys_GetClipboardData();
  if (!cbd) {
    *buf = 0;
    return;
  }
  Q_strncpyz(buf, cbd, buflen);
  Z_Free(cbd);
}


x86 assembly (clang, -O0):
<CL_GetClipboardData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1040 <Sys_GetClipboardData@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1161 <CL_GetClipboardData+0x31>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
jmp    117a <CL_GetClipboardData+0x4a>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1050 <Q_strncpyz@plt>
mov    -0x18(%rbp),%rdi
call   1030 <Z_Free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CL_GetClipboardData>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <Sys_GetClipboardData@plt>
test   %rax,%rax
je     1163 <CL_GetClipboardData+0x33>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    %rax,%rsi
mov    %r14d,%edx
call   1050 <Q_strncpyz@plt>
mov    %rbp,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <Z_Free@plt>
movb   $0x0,(%rbx)
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @CL_GetClipboardData(i8* %0, i32 %1) {
%3 = tail call i8* (...) @Sys_GetClipboardData()
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %6
5: ; preds = %2
store i8 0, i8* %0
br label %9
6: ; preds = %2
%7 = tail call i32 @Q_strncpyz(i8* %0, i8* %3, i32 %1)
%8 = tail call i32 @Z_Free(i8* %3)
br label %9
9: ; preds = %6, %5
ret void
}
int padOut(int n) { return n + ((4 - (n % 4)) % 4); }


x86 assembly (clang, -O0):
<padOut>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    $0x4,%eax
sub    %edx,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%eax
add    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<padOut>:
mov    %edi,%eax
neg    %eax
and    $0x3,%eax
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @padOut(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = srem i32 %4, 4
%6 = sub nsw i32 4, %5
%7 = srem i32 %6, 4
%8 = add nsw i32 %3, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @padOut(i32 %0) {
%2 = sub i32 0, %0
%3 = and i32 %2, 3
%4 = add nsw i32 %3, %0
ret i32 %4
}
/* Variables and functions */
int detect();
int /*<<< orphan*/ printf(char *);
void get_libname(void) {
  int d = detect();
  switch (d) {
  case 2:
    printf("armv7\n");
    break;
  case 1:
    printf("armv6\n");
    break;
  }
}


x86 assembly (clang, -O0):
<get_libname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
call   1040 <detect@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x1,%eax
je     1168 <get_libname+0x48>
jmp    1146 <get_libname+0x26>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
jne    1174 <get_libname+0x54>
jmp    1157 <get_libname+0x37>
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
jmp    1174 <get_libname+0x54>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_libname>:
push   %rax
xor    %eax,%eax
call   1040 <detect@plt>
cmp    $0x2,%eax
je     113f <get_libname+0x1f>
cmp    $0x1,%eax
jne    114c <get_libname+0x2c>
lea    0xec7(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0xec0(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [7 x i8] c"armv7\0A\00"
@.str.1 = [7 x i8] c"armv6\0A\00"
define void @get_libname() {
%1 = alloca i32
%2 = call i32 (...) @detect()
store i32 %2, i32* %1
%3 = load i32, i32* %1
switch i32 %3, label %8 [
i32 2, label %4
i32 1, label %6
]
4: ; preds = %0
%5 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %0, %6, %4
ret void
}

LLVM IR (-O2):
@str = [6 x i8] c"armv6\00"
@str.2 = [6 x i8] c"armv7\00"
define void @get_libname() {
%1 = tail call i32 (...) @detect()
switch i32 %1, label %6 [
i32 2, label %3
i32 1, label %2
]
2: ; preds = %0
br label %3
3: ; preds = %0, %2
%4 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0), %2 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @str.2, i64 0, i64 0), %0 ]
%5 = tail call i32 @puts(i8* dereferenceable(1) %4)
br label %6
6: ; preds = %3, %0
ret void
}
/* Variables and functions */
long __copy_tofrom_user(void *, void const *, long, void *);
extern long copy_to_user(void *to, const void *from, long n) {
  return __copy_tofrom_user(to, from, n, to);
}


x86 assembly (clang, -O0):
<copy_to_user>:
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
mov    -0x8(%rbp),%rcx
call   1030 <__copy_tofrom_user@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_to_user>:
mov    %rdi,%rcx
jmp    1030 <__copy_tofrom_user@plt>

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

LLVM IR (-O2):
define i64 @copy_to_user(i8* %0, i8* %1, i64 %2) {
%4 = tail call i64 @__copy_tofrom_user(i8* %0, i8* %1, i64 %2, i8* %0)
ret i64 %4
}
/* Type definitions */
struct timeval {
  unsigned long tv_sec;
  scalar_t__ tv_usec;
};

/* Variables and functions */
unsigned long tv_to_ul(struct timeval *tv) {
  unsigned long ret = tv->tv_sec;
  ret *= 1000000;
  ret += tv->tv_usec;
  return ret;
}


x86 assembly (clang, -O0):
<tv_to_ul>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
imul   $0xf4240,-0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tv_to_ul>:
imul   $0xf4240,(%rdi),%rax
add    0x8(%rdi),%rax
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define i64 @tv_to_ul(%struct.timeval* %0) {
%2 = alloca %struct.timeval*
%3 = alloca i64
store %struct.timeval* %0, %struct.timeval** %2
%4 = load %struct.timeval*, %struct.timeval** %2
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 0
%6 = load i64, i64* %5
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = mul i64 %7, 1000000
store i64 %8, i64* %3
%9 = load %struct.timeval*, %struct.timeval** %2
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i32 0, i32 1
%11 = load i64, i64* %10
%12 = load i64, i64* %3
%13 = add i64 %12, %11
store i64 %13, i64* %3
%14 = load i64, i64* %3
ret i64 %14
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define i64 @tv_to_ul(%struct.timeval* nocapture %0) {
%2 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%3 = load i64, i64* %2
%4 = mul i64 %3, 1000000
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%6 = load i64, i64* %5
%7 = add i64 %4, %6
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void error(const char *msg) {
  fprintf(stderr,
          "This is to be run by UDEV only!\n"
          "%s\n",
          msg);
  exit(1);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [36 x i8] c"This is to be run by UDEV only!\0A%s\0A\00"
define void @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 ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [36 x i8] c"This is to be run by UDEV only!\0A%s\0A\00"
define void @error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
void *__talloc(void const *, size_t);
void *_talloc(const void *context, size_t size) {
  return __talloc(context, size);
}


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

x86 assembly (clang, -O2):
<_talloc>:
jmp    1030 <__talloc@plt>

LLVM IR (-O0):
define i8* @_talloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i8* @__talloc(i8* %5, i64 %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @_talloc(i8* %0, i64 %1) {
%3 = tail call i8* @__talloc(i8* %0, i64 %1)
ret i8* %3
}