xunge/DecIR huggingface dataset:
char bin2hex(char ch) {
  ch = ch & 0x0f;
  ch += '0';
  if (ch > '9')
    ch += 7;
  return (ch);
}


x86 assembly (clang, -O0):
<bin2hex>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
and    $0xf,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
jle    1135 <bin2hex+0x35>
movsbl -0x1(%rbp),%eax
add    $0x7,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bin2hex>:
and    $0xf,%dil
lea    0x30(%rdi),%eax
add    $0x37,%dil
cmp    $0x3a,%al
movzbl %dil,%ecx
movzbl %al,%eax
cmovae %ecx,%eax
ret

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

LLVM IR (-O2):
define signext i8 @bin2hex(i8 signext %0) {
%2 = and i8 %0, 15
%3 = or i8 %2, 48
%4 = icmp ugt i8 %3, 57
%5 = add nuw nsw i8 %2, 55
%6 = select i1 %4, i8 %5, i8 %3
ret i8 %6
}
int strstart(const char *val, const char **str) {
  const char *p, *q;
  p = *str;
  q = val;
  while (*q) {
    if (*p != *q)
      return 0;
    p++;
    q++;
  }
  *str = p;
  return 1;
}


x86 assembly (clang, -O0):
<strstart>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmpb   $0x0,(%rax)
je     116b <strstart+0x6b>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
mov    -0x28(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     114e <strstart+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    117d <strstart+0x7d>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    111f <strstart+0x1f>
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strstart>:
mov    (%rsi),%rax
mov    (%rdi),%cl
test   %cl,%cl
je     1123 <strstart+0x23>
add    $0x1,%rdi
nopl   (%rax)
cmp    %cl,(%rax)
jne    112c <strstart+0x2c>
add    $0x1,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <strstart+0x10>
mov    %rax,(%rsi)
mov    $0x1,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @strstart(i8* nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %17, label %6
6: ; preds = %2, %12
%7 = phi i8 [ %15, %12 ], [ %4, %2 ]
%8 = phi i8* [ %14, %12 ], [ %0, %2 ]
%9 = phi i8* [ %13, %12 ], [ %3, %2 ]
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, %7
br i1 %11, label %12, label %19
12: ; preds = %6
%13 = getelementptr inbounds i8, i8* %9, i64 1
%14 = getelementptr inbounds i8, i8* %8, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %6
17: ; preds = %12, %2
%18 = phi i8* [ %3, %2 ], [ %13, %12 ]
store i8* %18, i8** %1
br label %19
19: ; preds = %6, %17
%20 = phi i32 [ 1, %17 ], [ 0, %6 ]
ret i32 %20
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ntohl(int /*<<< orphan*/);
uint32_t minipack_unpack_str32(void *ptr, size_t *sz) {
  *sz = 5;
  return ntohl(*((uint32_t *)(ptr + 1)));
}


x86 assembly (clang, -O0):
<minipack_unpack_str32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x5,(%rax)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%edi
call   1030 <ntohl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<minipack_unpack_str32>:
movq   $0x5,(%rsi)
mov    0x1(%rdi),%edi
jmp    1030 <ntohl@plt>

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

LLVM IR (-O2):
define i32 @minipack_unpack_str32(i8* nocapture %0, i64* nocapture writeonly %1) {
store i64 5, i64* %1
%3 = getelementptr i8, i8* %0, i64 1
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
%6 = tail call i32 @ntohl(i32 %5)
ret i32 %6
}
double calcerr(const double x, const double y) { return x - y; }


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

x86 assembly (clang, -O2):
<calcerr>:
subsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @calcerr(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fsub double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @calcerr(double %0, double %1) {
%3 = fsub double %0, %1
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ usleep(int);
int /*<<< orphan*/ write(int, char *, int);
void setPreamp(int fd, int on) {
  char cmd[8];
  if (on < 0 || on > 1)
    return;
  sprintf(cmd, "PA%d;", on);
  write(fd, cmd, 4);
  usleep(100e3);
}


x86 assembly (clang, -O0):
<setPreamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1152 <setPreamp+0x22>
cmpl   $0x1,-0x8(%rbp)
jle    1157 <setPreamp+0x27>
jmp    1185 <setPreamp+0x55>
lea    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xe9b(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x10(%rbp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    $0x186a0,%edi
call   1050 <usleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setPreamp>:
cmp    $0x1,%esi
jbe    1136 <setPreamp+0x6>
ret
push   %r14
push   %rbx
push   %rax
mov    %esi,%edx
mov    %edi,%ebx
lea    0xebb(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <sprintf@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    $0x186a0,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <usleep@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"PA%d;\00"
define void @setPreamp(i32 %0, i32 %1) {
%3 = alloca [8 x i8]
%4 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%5 = icmp ugt i32 %1, 1
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %1)
%8 = call i32 @write(i32 %0, i8* %4, i32 4)
%9 = tail call i32 @usleep(i32 100000)
br label %10
10: ; preds = %2, %6
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint8_t div10(uint8_t x, uint8_t *remainder) {
  uint8_t y = ((uint16_t)x * 205) >> 11;
  *remainder = x - (y * 10);
  return y;
}


x86 assembly (clang, -O0):
<div10>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
imul   $0xcd,-0x4(%rbp),%eax
sar    $0xb,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%ecx
imul   $0xa,-0x14(%rbp),%eax
sub    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<div10>:
imul   $0xcd,%edi,%eax
sar    $0xb,%eax
lea    (%rax,%rax,1),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%edi
mov    %edi,(%rsi)
ret

LLVM IR (-O0):
define i32 @div10(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
%6 = load i32, i32* %3
%7 = mul nsw i32 %6, 205
%8 = ashr i32 %7, 11
store i32 %8, i32* %5
%9 = load i32, i32* %3
%10 = load i32, i32* %5
%11 = mul nsw i32 %10, 10
%12 = sub nsw i32 %9, %11
%13 = load i32*, i32** %4
store i32 %12, i32* %13
%14 = load i32, i32* %5
ret i32 %14
}

LLVM IR (-O2):
define i32 @div10(i32 %0, i32* nocapture writeonly %1) {
%3 = mul nsw i32 %0, 205
%4 = ashr i32 %3, 11
%5 = mul nsw i32 %4, -10
%6 = add i32 %5, %0
store i32 %6, i32* %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_list() {
  printf("print_line");
  return;
}


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

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

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

LLVM IR (-O2):
@.str = [11 x i8] c"print_line\00"
define void @print_list() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gmvwrite_cell_header(char *);
void fgmvwrite_cell_header_(char *ncells) { gmvwrite_cell_header(ncells); }


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

x86 assembly (clang, -O2):
<fgmvwrite_cell_header_>:
jmp    1030 <gmvwrite_cell_header@plt>

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

LLVM IR (-O2):
define void @fgmvwrite_cell_header_(i8* %0) {
%2 = tail call i32 @gmvwrite_cell_header(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int cup(int p) {
  if (p > 50) {
    printf("\ntoo long\n");
    p = 50;
  } else
    ;
  return p;
}


x86 assembly (clang, -O0):
<cup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x32,-0x4(%rbp)
jle    113d <cup+0x2d>
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
movl   $0x32,-0x4(%rbp)
jmp    1142 <cup+0x32>
jmp    1142 <cup+0x32>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cup>:
mov    %edi,%eax
cmp    $0x33,%edi
jl     112d <cup+0x1d>
push   %rax
lea    0xee1(%rip),%rdi
call   1030 <puts@plt>
mov    $0x32,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"\0Atoo long\0A\00"
define i32 @cup(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 50
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i32 50, i32* %2
br label %8
7: ; preds = %1
br label %8
8: ; preds = %7, %5
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
@str = [10 x i8] c"\0Atoo long\00"
define i32 @cup(i32 %0) {
%2 = icmp sgt i32 %0, 50
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ 50, %3 ], [ %0, %1 ]
ret i32 %6
}
void prom_init_secondary(void) {}


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

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

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

LLVM IR (-O2):
define void @prom_init_secondary() {
ret void
}
syntax(int n) {
  int ar[n];
  int(*p)[n] = &ar;
  syntax(p);
}


x86 assembly (clang, -O0):
<syntax>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
mov    %rsp,%rax
mov    %rax,-0x10(%rbp)
lea    0xf(,%rcx,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rax
sub    %rdx,%rax
mov    %rax,%rsp
mov    %rcx,-0x18(%rbp)
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %eax,%edi
call   1030 <syntax@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<syntax>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,%eax
mov    %rsp,%rdi
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rdi
mov    %rdi,%rsp
call   1030 <syntax@plt>
mov    %rbp,%rsp
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @syntax(i32 %0) {
%2 = zext i32 %0 to i64
%3 = alloca i32, i64 %2
%4 = ptrtoint i32* %3 to i64
%5 = trunc i64 %4 to i32
%6 = call i32 @syntax(i32 %5)
ret i32 undef
}
/* Variables and functions */
int error();
void foo() { int x = error(); }


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

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

LLVM IR (-O0):
define void @foo() {
%1 = alloca i32
%2 = call i32 (...) @error()
store i32 %2, i32* %1
ret void
}

LLVM IR (-O2):
define void @foo() {
%1 = tail call i32 (...) @error()
ret void
}
/* Type definitions */
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
void USBIntEnableEndpoint(uint32_t ui32Base, uint32_t ui32Flags) {
  ;
  (*((volatile uint16_t *)(ui32Base + 0x00000006))) |=
      ui32Flags & (0x0000FFFE | 0x0000FFFE | 0x00000001);
  (*((volatile uint16_t *)(ui32Base + 0x00000008))) |=
      ((ui32Flags & (0xFFFE0000 | 0xFFFE0000)) >> 16);
}


x86 assembly (clang, -O0):
<USBIntEnableEndpoint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edx
and    $0xffff,%edx
mov    -0x4(%rbp),%eax
add    $0x6,%eax
cltq
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%edx
and    $0xfffe0000,%edx
shr    $0x10,%edx
mov    -0x4(%rbp),%eax
add    $0x8,%eax
cltq
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBIntEnableEndpoint>:
movzwl %si,%eax
movslq %edi,%rcx
or     %eax,0x6(%rcx)
shr    $0x10,%esi
and    $0xfffffffe,%esi
or     %esi,0x8(%rcx)
ret

LLVM IR (-O0):
define void @USBIntEnableEndpoint(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = and i32 %5, 65535
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 6
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
%11 = load volatile i32, i32* %10
%12 = or i32 %11, %6
store volatile i32 %12, i32* %10
%13 = load i32, i32* %4
%14 = and i32 %13, -131072
%15 = lshr i32 %14, 16
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 8
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to i32*
%20 = load volatile i32, i32* %19
%21 = or i32 %20, %15
store volatile i32 %21, i32* %19
ret void
}

LLVM IR (-O2):
define void @USBIntEnableEndpoint(i32 %0, i32 %1) {
%3 = and i32 %1, 65535
%4 = add nsw i32 %0, 6
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
%7 = load volatile i32, i32* %6
%8 = or i32 %7, %3
store volatile i32 %8, i32* %6
%9 = lshr i32 %1, 16
%10 = and i32 %9, 65534
%11 = add nsw i32 %0, 8
%12 = sext i32 %11 to i64
%13 = inttoptr i64 %12 to i32*
%14 = load volatile i32, i32* %13
%15 = or i32 %14, %10
store volatile i32 %15, i32* %13
ret void
}
int test_imm_2Fuint16_reg(unsigned short val) {
  return ((val) & (-0x2F << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_2Fuint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -47
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int main() {
  FILE *myFile;
  myFile = fopen("junk", "a");
  fprintf(myFile, "Hello world\n");
  fprintf(myFile, "All done ... goodbye.\n");
  fclose(myFile);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    0xeb8(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xea3(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xec6(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
lea    0xeb9(%rip),%rdi
mov    $0xc,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1050 <fwrite@plt>
lea    0xead(%rip),%rdi
mov    $0x16,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"junk\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [13 x i8] c"Hello world\0A\00"
@.str.3 = [23 x i8] c"All done ... goodbye.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i32* @fopen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @fprintf(i32* %4, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%6 = load i32*, i32** %2
%7 = call i32 @fprintf(i32* %6, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%8 = load i32*, i32** %2
%9 = call i32 @fclose(i32* %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"junk\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [13 x i8] c"Hello world\0A\00"
@.str.3 = [23 x i8] c"All done ... goodbye.\0A\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i64 12, i64 1, i32* %1)
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i64 22, i64 1, i32* %1)
%4 = tail call i32 @fclose(i32* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ union_ar();
int /*<<< orphan*/ union_full_zero();
int /*<<< orphan*/ union_init();
main() {
  union_init();
  union_full_zero();
  union_ar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <union_init@plt>
mov    $0x0,%al
call   1050 <union_full_zero@plt>
mov    $0x0,%al
call   1040 <union_ar@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @union_init()
%2 = call i32 (...) @union_full_zero()
%3 = call i32 (...) @union_ar()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @union_init()
%2 = tail call i32 (...) @union_full_zero()
%3 = tail call i32 (...) @union_ar()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void showError() {
  fprintf(stderr, "Chyba!\n"
                  "Zle zadane parametre! Pre napovedu pouzite prepinac --help\n"
                  "Program sa ukonci!\n");
}


x86 assembly (clang, -O0):
<showError>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<showError>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [86 x i8] c"Chyba!\0AZle zadane parametre! Pre napovedu pouzite prepinac --help\0AProgram sa ukonci!\0A\00"
define void @showError() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [86 x i8] c"Chyba!\0AZle zadane parametre! Pre napovedu pouzite prepinac --help\0AProgram sa ukonci!\0A\00"
define void @showError() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int __get_cpuid_count(int /*<<< orphan*/, int /*<<< orphan*/,
                      int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                      int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int gccgoGetCpuidCount(uint32_t leaf, uint32_t subleaf, uint32_t *eax,
                       uint32_t *ebx, uint32_t *ecx, uint32_t *edx) {
  return __get_cpuid_count(leaf, subleaf, eax, ebx, ecx, edx);
}


x86 assembly (clang, -O0):
<gccgoGetCpuidCount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
call   1030 <__get_cpuid_count@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gccgoGetCpuidCount>:
jmp    1030 <__get_cpuid_count@plt>

LLVM IR (-O0):
define i32 @gccgoGetCpuidCount(i32 %0, i32 %1, i32* %2, i32* %3, i32* %4, i32* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32* %2, i32** %9
store i32* %3, i32** %10
store i32* %4, i32** %11
store i32* %5, i32** %12
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = load i32*, i32** %9
%16 = load i32*, i32** %10
%17 = load i32*, i32** %11
%18 = load i32*, i32** %12
%19 = call i32 @__get_cpuid_count(i32 %13, i32 %14, i32* %15, i32* %16, i32* %17, i32* %18)
ret i32 %19
}

LLVM IR (-O2):
define i32 @gccgoGetCpuidCount(i32 %0, i32 %1, i32* %2, i32* %3, i32* %4, i32* %5) {
%7 = tail call i32 @__get_cpuid_count(i32 %0, i32 %1, i32* %2, i32* %3, i32* %4, i32* %5)
ret i32 %7
}
void testLocNonLocSymbolAssume(int a, int *b) {
  if ((int)b < a) {
  }
}


x86 assembly (clang, -O0):
<testLocNonLocSymbolAssume>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x4(%rbp),%eax
jge    111d <testLocNonLocSymbolAssume+0x1d>
jmp    111d <testLocNonLocSymbolAssume+0x1d>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @testLocNonLocSymbolAssume(i32 %0, i32* nocapture %1) {
ret void
}
/* Variables and functions */
#define AF_INET 128
int /*<<< orphan*/ EAFNOSUPPORT;
int /*<<< orphan*/ errno;
char *inet_net_ntop_ipv4(void const *, int, char *, size_t);
char *inet_net_ntop(int af, const void *netp, int bits, char *pres,
                    size_t psize) {
  switch (af) {
  case AF_INET:
    return inet_net_ntop_ipv4(netp, bits, pres, psize);
  default:
    errno = EAFNOSUPPORT;
    return NULL;
  }
}


x86 assembly (clang, -O0):
<inet_net_ntop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x80,%eax
jne    115a <inet_net_ntop+0x4a>
jmp    113d <inet_net_ntop+0x2d>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
call   1030 <inet_net_ntop_ipv4@plt>
mov    %rax,-0x8(%rbp)
jmp    1174 <inet_net_ntop+0x64>
mov    0x2e77(%rip),%rax
mov    (%rax),%ecx
mov    0x2e76(%rip),%rax
mov    %ecx,(%rax)
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inet_net_ntop>:
cmp    $0x80,%edi
jne    1128 <inet_net_ntop+0x18>
mov    %rsi,%rdi
mov    %edx,%esi
mov    %rcx,%rdx
mov    %r8,%rcx
jmp    1030 <inet_net_ntop_ipv4@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%eax
mov    0x2ea8(%rip),%rcx
mov    %eax,(%rcx)
xor    %eax,%eax
ret

LLVM IR (-O0):
@EAFNOSUPPORT = global i32 0
@errno = global i32 0
define i8* @inet_net_ntop(i32 %0, i8* %1, i32 %2, i8* %3, i64 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i64
store i32 %0, i32* %7
store i8* %1, i8** %8
store i32 %2, i32* %9
store i8* %3, i8** %10
store i64 %4, i64* %11
%12 = load i32, i32* %7
switch i32 %12, label %19 [
i32 128, label %13
]
13: ; preds = %5
%14 = load i8*, i8** %8
%15 = load i32, i32* %9
%16 = load i8*, i8** %10
%17 = load i64, i64* %11
%18 = call i8* @inet_net_ntop_ipv4(i8* %14, i32 %15, i8* %16, i64 %17)
store i8* %18, i8** %6
br label %21
19: ; preds = %5
%20 = load i32, i32* @EAFNOSUPPORT
store i32 %20, i32* @errno
store i8* null, i8** %6
br label %21
21: ; preds = %19, %13
%22 = load i8*, i8** %6
ret i8* %22
}

LLVM IR (-O2):
@EAFNOSUPPORT = global i32 0
@errno = global i32 0
define i8* @inet_net_ntop(i32 %0, i8* %1, i32 %2, i8* %3, i64 %4) {
%6 = icmp eq i32 %0, 128
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = tail call i8* @inet_net_ntop_ipv4(i8* %1, i32 %2, i8* %3, i64 %4)
br label %11
9: ; preds = %5
%10 = load i32, i32* @EAFNOSUPPORT
store i32 %10, i32* @errno
br label %11
11: ; preds = %9, %7
%12 = phi i8* [ %8, %7 ], [ null, %9 ]
ret i8* %12
}
/* Variables and functions */
scalar_t__ isdigit(int);
int isxdigit(int c) {
  return isdigit(c) || ((c >= 'A') && (c <= 'F')) || ((c >= 'a') && (c <= 'f'));
}


x86 assembly (clang, -O0):
<isxdigit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <isdigit@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
jne    116d <isxdigit+0x5d>
cmpl   $0x41,-0x4(%rbp)
jl     114e <isxdigit+0x3e>
mov    $0x1,%al
cmpl   $0x46,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    116d <isxdigit+0x5d>
xor    %eax,%eax
cmpl   $0x61,-0x4(%rbp)
mov    %al,-0x6(%rbp)
jl     1167 <isxdigit+0x57>
cmpl   $0x66,-0x4(%rbp)
setle  %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isxdigit>:
push   %rbx
mov    %edi,%ebx
call   1030 <isdigit@plt>
test   %rax,%rax
setne  %al
and    $0xffffffdf,%ebx
add    $0xffffffbf,%ebx
cmp    $0x6,%ebx
setb   %cl
or     %al,%cl
movzbl %cl,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @isxdigit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @isdigit(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %20, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp sge i32 %7, 65
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %2
%11 = icmp sle i32 %10, 70
br i1 %11, label %20, label %12
12: ; preds = %9, %6
%13 = load i32, i32* %2
%14 = icmp sge i32 %13, 97
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32, i32* %2
%17 = icmp sle i32 %16, 102
br label %18
18: ; preds = %15, %12
%19 = phi i1 [ false, %12 ], [ %17, %15 ]
br label %20
20: ; preds = %18, %9, %1
%21 = phi i1 [ true, %9 ], [ true, %1 ], [ %19, %18 ]
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
define i32 @isxdigit(i32 %0) {
%2 = tail call i64 @isdigit(i32 %0)
%3 = icmp ne i64 %2, 0
%4 = and i32 %0, -33
%5 = add i32 %4, -65
%6 = icmp ult i32 %5, 6
%7 = or i1 %6, %3
%8 = zext i1 %7 to i32
ret i32 %8
}
void set_fpu_trap_exceptions(int trap __attribute__((unused)),
                             int notrap __attribute__((unused))) {}


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

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

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

LLVM IR (-O2):
define void @set_fpu_trap_exceptions(i32 %0, i32 %1) {
ret void
}
void SPIDisable(unsigned long ulBase) {
  (*((volatile unsigned long *)(ulBase + 0x00000134))) &= ~0x00000001;
}


x86 assembly (clang, -O0):
<SPIDisable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x134(%rax),%rcx
and    $0xfffffffffffffffe,%rcx
mov    %rcx,0x134(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SPIDisable>:
andq   $0xfffffffffffffffe,0x134(%rdi)
fe
ret

LLVM IR (-O0):
define void @SPIDisable(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add i64 %3, 308
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
%7 = and i64 %6, -2
store volatile i64 %7, i64* %5
ret void
}

LLVM IR (-O2):
define void @SPIDisable(i64 %0) {
%2 = add i64 %0, 308
%3 = inttoptr i64 %2 to i64*
%4 = load volatile i64, i64* %3
%5 = and i64 %4, -2
store volatile i64 %5, i64* %3
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ etna_float_to_fixp55(float);
float logf(float);
uint32_t etna_log2_fixp55(unsigned width) {
  return etna_float_to_fixp55(logf((float)width) * (1.4426950408889634f));
}


x86 assembly (clang, -O0):
<etna_log2_fixp55>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cvtsi2ss %rax,%xmm0
call   1040 <logf@plt>
movss  0xec0(%rip),%xmm1
mulss  %xmm1,%xmm0
call   1030 <etna_float_to_fixp55@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<etna_log2_fixp55>:
push   %rax
mov    %edi,%eax
cvtsi2ss %rax,%xmm0
call   1040 <logf@plt>
mulss  0xecb(%rip),%xmm0
pop    %rax
jmp    1030 <etna_float_to_fixp55@plt>

LLVM IR (-O0):
define i32 @etna_log2_fixp55(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = uitofp i32 %3 to float
%5 = call float @logf(float %4)
%6 = fmul float %5, 0x3FF7154760000000
%7 = call i32 @etna_float_to_fixp55(float %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @etna_log2_fixp55(i32 %0) {
%2 = uitofp i32 %0 to float
%3 = tail call float @logf(float %2)
%4 = fmul float %3, 0x3FF7154760000000
%5 = tail call i32 @etna_float_to_fixp55(float %4)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ add_scriptb(int);
void add_scripti(int a) {
  while (a >= 0x40) {
    add_scriptb(a | 0xc0);
    a = (a - 0x40) >> 6;
  }
  add_scriptb(a | 0x80);
}


x86 assembly (clang, -O0):
<add_scripti>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x40,-0x4(%rbp)
jl     1144 <add_scripti+0x34>
mov    -0x4(%rbp),%edi
or     $0xc0,%edi
call   1030 <add_scriptb@plt>
mov    -0x4(%rbp),%eax
sub    $0x40,%eax
sar    $0x6,%eax
mov    %eax,-0x4(%rbp)
jmp    111b <add_scripti+0xb>
mov    -0x4(%rbp),%edi
or     $0x80,%edi
call   1030 <add_scriptb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_scripti>:
push   %rbx
mov    %edi,%ebx
cmp    $0x40,%edi
jl     1141 <add_scripti+0x31>
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
or     $0xc0,%edi
call   1030 <add_scriptb@plt>
add    $0xffffffc0,%ebx
mov    %ebx,%edi
shr    $0x6,%edi
cmp    $0xfff,%ebx
mov    %edi,%ebx
ja     1120 <add_scripti+0x10>
jmp    1143 <add_scripti+0x33>
mov    %ebx,%edi
or     $0x80,%edi
pop    %rbx
jmp    1030 <add_scriptb@plt>

LLVM IR (-O0):
define void @add_scripti(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %6, %1
%4 = load i32, i32* %2
%5 = icmp sge i32 %4, 64
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = load i32, i32* %2
%8 = or i32 %7, 192
%9 = call i32 @add_scriptb(i32 %8)
%10 = load i32, i32* %2
%11 = sub nsw i32 %10, 64
%12 = ashr i32 %11, 6
store i32 %12, i32* %2
br label %3
13: ; preds = %3
%14 = load i32, i32* %2
%15 = or i32 %14, 128
%16 = call i32 @add_scriptb(i32 %15)
ret void
}

LLVM IR (-O2):
define void @add_scripti(i32 %0) {
%2 = icmp sgt i32 %0, 63
br i1 %2, label %3, label %10
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ %0, %1 ]
%5 = or i32 %4, 192
%6 = tail call i32 @add_scriptb(i32 %5)
%7 = add nsw i32 %4, -64
%8 = lshr i32 %7, 6
%9 = icmp ugt i32 %7, 4095
br i1 %9, label %3, label %10
10: ; preds = %3, %1
%11 = phi i32 [ %0, %1 ], [ %8, %3 ]
%12 = or i32 %11, 128
%13 = tail call i32 @add_scriptb(i32 %12)
ret void
}
/* Variables and functions */
float FloatSwap(float const *);
float BigFloat(const float *l) { return FloatSwap(l); }


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

x86 assembly (clang, -O2):
<BigFloat>:
jmp    1030 <FloatSwap@plt>

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

LLVM IR (-O2):
define float @BigFloat(float* %0) {
%2 = tail call float @FloatSwap(float* %0)
ret float %2
}
const char *get_version_info() { return "1.0"; }


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"1.0\00"
define i8* @get_version_info() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [4 x i8] c"1.0\00"
define i8* @get_version_info() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int _strcmpi(char const *, char const *);
int strcmpi(const char *s1, const char *s2) { return _strcmpi(s1, s2); }


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

x86 assembly (clang, -O2):
<strcmpi>:
jmp    1030 <_strcmpi@plt>

LLVM IR (-O0):
define i32 @strcmpi(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 @_strcmpi(i8* %5, i8* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @strcmpi(i8* %0, i8* %1) {
%3 = tail call i32 @_strcmpi(i8* %0, i8* %1)
ret i32 %3
}
int test_imm_38int64_midword_reg(long long val) {
  return ((val >> 16) & (0x38 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_38int64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 16
%5 = and i64 %4, 56
%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_38int64_midword_reg(i64 %0) {
%2 = and i64 %0, 3670016
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long);
void *print_hello(void *data) {
  long tid = (long)data;
  printf("Executing thread: %ld\n", tid);
  printf("Exiting Thread: %ld\n", tid);
}


x86 assembly (clang, -O0):
<print_hello>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_hello>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xeed(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"Executing thread: %ld\0A\00"
@.str.1 = [21 x i8] c"Exiting Thread: %ld\0A\00"
define i8* @print_hello(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = ptrtoint i8* %5 to i64
store i64 %6, i64* %4
%7 = load i64, i64* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i64 %7)
%9 = load i64, i64* %4
%10 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i64 %9)
%11 = load i8*, i8** %2
ret i8* %11
}

LLVM IR (-O2):
@.str = [23 x i8] c"Executing thread: %ld\0A\00"
@.str.1 = [21 x i8] c"Exiting Thread: %ld\0A\00"
define noalias i8* @print_hello(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i64 %2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i64 %2)
ret i8* undef
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ memcmp(int /*<<< orphan*/ const *,
                          int /*<<< orphan*/ const *, int);
bool a52e_sync_compare_formats(const uint8_t *p_a521, const uint8_t *p_a522) {
  return !memcmp(p_a521, p_a522, 5);
}


x86 assembly (clang, -O0):
<a52e_sync_compare_formats>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x5,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<a52e_sync_compare_formats>:
push   %rax
mov    $0x5,%edx
call   1030 <memcmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @a52e_sync_compare_formats(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 = call i32 @memcmp(i32* %5, i32* %6, i32 5)
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @a52e_sync_compare_formats(i32* %0, i32* %1) {
%3 = tail call i32 @memcmp(i32* %0, i32* %1, i32 5)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ doubleindirect1();
void __attribute__((flatten)) doubleindirect(void) { doubleindirect1(); }


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

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

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

LLVM IR (-O2):
define void @doubleindirect() {
%1 = tail call i32 (...) @doubleindirect1()
ret void
}
void flush_hugetlb_page(struct vm_area_struct *vma, unsigned long vmaddr) {}


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

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

LLVM IR (-O0):
%struct.vm_area_struct = type opaque
define void @flush_hugetlb_page(%struct.vm_area_struct* %0, i64 %1) {
%3 = alloca %struct.vm_area_struct*
%4 = alloca i64
store %struct.vm_area_struct* %0, %struct.vm_area_struct** %3
store i64 %1, i64* %4
ret void
}

LLVM IR (-O2):
%struct.vm_area_struct = type opaque
define void @flush_hugetlb_page(%struct.vm_area_struct* nocapture %0, i64 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
main() {
  int i;
  for (i = 1; i < 500; i++) {
    printf("CONST w(R2) = w(R%d)\n", i);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x1f4,-0x8(%rbp)
jge    1150 <main+0x40>
mov    -0x8(%rbp),%esi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
lea    0xee0(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x1f4,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [22 x i8] c"CONST w(R2) = w(R%d)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
br label %3
3: ; preds = %9, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 500
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %6
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
store i32 %11, i32* %2
br label %3
12: ; preds = %3
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@.str = [22 x i8] c"CONST w(R2) = w(R%d)\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 1, %0 ], [ %4, %1 ]
%3 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 500
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 0
}
void main(void) {
  for (;;) {
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <main+0x9>
jmp    1109 <main+0x9>

x86 assembly (clang, -O2):
<main>:
jmp    1100 <main>

LLVM IR (-O0):
define void @main() {
br label %1
1: ; preds = %1, %0
br label %1
}

LLVM IR (-O2):
define void @main() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ getppid();
int kill(int /*<<< orphan*/, int);
zkself() { return (kill(getppid(), 1)); }


x86 assembly (clang, -O0):
<zkself>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <getppid@plt>
mov    %eax,%edi
mov    $0x1,%esi
call   1030 <kill@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<zkself>:
push   %rax
xor    %eax,%eax
call   1040 <getppid@plt>
mov    %eax,%edi
mov    $0x1,%esi
pop    %rax
jmp    1030 <kill@plt>

LLVM IR (-O0):
define i32 @zkself() {
%1 = call i32 (...) @getppid()
%2 = call i32 @kill(i32 %1, i32 1)
ret i32 %2
}

LLVM IR (-O2):
define i32 @zkself() {
%1 = tail call i32 (...) @getppid()
%2 = tail call i32 @kill(i32 %1, i32 1)
ret i32 %2
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
scalar_t__ stat(char const *, struct stat *);
int _file_exists(const char *file_name) {
  struct stat file_stat;
  return ((stat(file_name, &file_stat) == 0) ? 1 : 0);
}


x86 assembly (clang, -O0):
<_file_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <stat@plt>
mov    %rax,%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmove  %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_file_exists>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @_file_exists(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @stat(i8* %4, %struct.stat* %3)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 1, i32 0
ret i32 %8
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @_file_exists(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
int do_879() { return 879; }


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

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

LLVM IR (-O0):
define i32 @do_879() {
ret i32 879
}

LLVM IR (-O2):
define i32 @do_879() {
ret i32 879
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void testUnaryPlus() { printf("+%d = %d\n", 10, +10); }


x86 assembly (clang, -O0):
<testUnaryPlus>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0xa,%edx
mov    %edx,%esi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<testUnaryPlus>:
lea    0xee9(%rip),%rdi
mov    $0xa,%esi
mov    $0xa,%edx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"+%d = %d\0A\00"
define void @testUnaryPlus() {
%1 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 10, i32 10)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"+%d = %d\0A\00"
define void @testUnaryPlus() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 10, i32 10)
ret void
}