xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
void fputc(char c, int fd) { write(fd, &c, 1); }


x86 assembly (clang, -O0):
<fputc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x1(%rbp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fputc>:
push   %rax
mov    %esi,%eax
mov    %dil,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    %eax,%edi
mov    $0x1,%edx
call   1030 <write@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @fputc(i8 signext %0, i32 %1) {
%3 = alloca i8
store i8 %0, i8* %3
%4 = call i32 @write(i32 %1, i8* %3, i32 1)
ret void
}
R0A1(r0, r1, x0, x1, p0, p1) double r0, r1;
double *p0, *p1;
{
  if (r0 <= (*((double *)11111111)))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<R0A1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
mov    %esi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm1
mov    $0xa98ac7,%eax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jb     1140 <R0A1+0x40>
movl   $0x1,-0x4(%rbp)
jmp    1147 <R0A1+0x47>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<R0A1>:
movsd  0xa98ac7,%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
setae  %al
ret

LLVM IR (-O0):
define i32 @R0A1(double %0, double %1, i32 %2, i32 %3, double* %4, double* %5) {
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca double*
%13 = alloca double*
store double %0, double* %8
store double %1, double* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store double* %4, double** %12
store double* %5, double** %13
%14 = load double, double* %8
%15 = load double, double* inttoptr (i64 11111111 to double*)
%16 = fcmp ole double %14, %15
br i1 %16, label %17, label %18
17: ; preds = %6
store i32 1, i32* %7
br label %19
18: ; preds = %6
store i32 0, i32* %7
br label %19
19: ; preds = %18, %17
%20 = load i32, i32* %7
ret i32 %20
}

LLVM IR (-O2):
define i32 @R0A1(double %0, double %1, i32 %2, i32 %3, double* nocapture readnone %4, double* nocapture readnone %5) {
%7 = load double, double* inttoptr (i64 11111111 to double*)
%8 = fcmp oge double %7, %0
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Type definitions */
struct ringbuffer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct ringbuffer *);
void ringbuffer_delete(struct ringbuffer *rb) { free(rb); }


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

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

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

LLVM IR (-O2):
%struct.ringbuffer = type { i32 }
define void @ringbuffer_delete(%struct.ringbuffer* nocapture %0) {
%2 = tail call i32 @free(%struct.ringbuffer* %0)
ret void
}
int indexOf(char *arr, int size, char val) {
  int i;
  for (i = 0; i < size; i++)
    if (val == arr[i])
      return i;
  return -1;
}


x86 assembly (clang, -O0):
<indexOf>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %al,-0x15(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1159 <indexOf+0x59>
movsbl -0x15(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    1146 <indexOf+0x46>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1160 <indexOf+0x60>
jmp    114b <indexOf+0x4b>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1117 <indexOf+0x17>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<indexOf>:
mov    $0xffffffff,%eax
test   %esi,%esi
jle    111e <indexOf+0x1e>
mov    %esi,%esi
xor    %ecx,%ecx
nopl   (%rax)
cmp    %dl,(%rdi,%rcx,1)
je     111f <indexOf+0x1f>
add    $0x1,%rcx
cmp    %rcx,%rsi
jne    1110 <indexOf+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @indexOf(i8* nocapture %0, i32 %1, i8 signext %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %12
%8 = phi i64 [ 0, %5 ], [ %13, %12 ]
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, %2
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %17, label %7
15: ; preds = %7
%16 = trunc i64 %8 to i32
br label %17
17: ; preds = %12, %15, %3
%18 = phi i32 [ -1, %3 ], [ %16, %15 ], [ -1, %12 ]
ret i32 %18
}
unsigned rdy_eth() { return 1; }


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

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

LLVM IR (-O0):
define i32 @rdy_eth() {
ret i32 1
}

LLVM IR (-O2):
define i32 @rdy_eth() {
ret i32 1
}
int abs(int num) {
  int tmp = num;
  num = num >> 31;
  tmp = tmp ^ num;
  tmp -= num;
  return tmp;
}


x86 assembly (clang, -O0):
<abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1f,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<abs>:
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
ret

LLVM IR (-O0):
define i32 @abs(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
store i32 %4, i32* %3
%5 = load i32, i32* %2
%6 = ashr i32 %5, 31
store i32 %6, i32* %2
%7 = load i32, i32* %3
%8 = load i32, i32* %2
%9 = xor i32 %7, %8
store i32 %9, i32* %3
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = sub nsw i32 %11, %10
store i32 %12, i32* %3
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
double cos(double);
double hanning(int n, int N) {
  return (0.5 * (1.0 - cos(2.0 * 3.14 * (double)n / (double)(N - 1))));
}


x86 assembly (clang, -O0):
<hanning>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xee5(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
call   1030 <cos@plt>
movsd  0xebe(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0xeaa(%rip),%xmm0
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hanning>:
push   %rax
cvtsi2sd %edi,%xmm0
mulsd  0xee3(%rip),%xmm0
add    $0xffffffff,%esi
cvtsi2sd %esi,%xmm1
divsd  %xmm1,%xmm0
call   1030 <cos@plt>
movsd  0xed3(%rip),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xecf(%rip),%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @hanning(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 = sitofp i32 %5 to double
%7 = fmul double 6.280000e+00, %6
%8 = load i32, i32* %4
%9 = sub nsw i32 %8, 1
%10 = sitofp i32 %9 to double
%11 = fdiv double %7, %10
%12 = call double @cos(double %11)
%13 = fsub double 1.000000e+00, %12
%14 = fmul double 5.000000e-01, %13
ret double %14
}

LLVM IR (-O2):
define double @hanning(i32 %0, i32 %1) {
%3 = sitofp i32 %0 to double
%4 = fmul double %3, 6.280000e+00
%5 = add nsw i32 %1, -1
%6 = sitofp i32 %5 to double
%7 = fdiv double %4, %6
%8 = tail call double @cos(double %7)
%9 = fsub double 1.000000e+00, %8
%10 = fmul double %9, 5.000000e-01
ret double %10
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int fgetc(int /*<<< orphan*/ *);
scalar_t__ isspace(int);
int next_symbol(FILE *fptr) {
  int ch;
  while (((ch = fgetc(fptr)) != EOF) && isspace(ch))
    ;
  return ch;
}


x86 assembly (clang, -O0):
<next_symbol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,%ecx
mov    %ecx,-0xc(%rbp)
xor    %eax,%eax
mov    0x2ea5(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0xd(%rbp)
je     1160 <next_symbol+0x40>
mov    -0xc(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1170 <next_symbol+0x50>
jmp    1175 <next_symbol+0x55>
jmp    112c <next_symbol+0xc>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_symbol>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    0x2eba(%rip),%r14
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebp
cmp    (%r14),%eax
je     114b <next_symbol+0x2b>
mov    %ebp,%edi
call   1040 <isspace@plt>
test   %rax,%rax
jne    1130 <next_symbol+0x10>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @next_symbol(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
br label %4
4: ; preds = %15, %1
%5 = load i32*, i32** %2
%6 = call i32 @fgetc(i32* %5)
store i32 %6, i32* %3
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %13
9: ; preds = %4
%10 = load i32, i32* %3
%11 = call i64 @isspace(i32 %10)
%12 = icmp ne i64 %11, 0
br label %13
13: ; preds = %9, %4
%14 = phi i1 [ false, %4 ], [ %12, %9 ]
br i1 %14, label %15, label %16
15: ; preds = %13
br label %4
16: ; preds = %13
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @next_symbol(i32* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = tail call i32 @fgetc(i32* %0)
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = tail call i64 @isspace(i32 %3)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %2
9: ; preds = %2, %6
ret i32 %3
}
void f2(_Bool p) {
  if (p) {
#pragma omp flush(x)
  } else {
#pragma omp flush(x, y, z)
  }
}


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
and    $0x1,%al
mov    %al,-0x1(%rbp)
testb  $0x1,-0x1(%rbp)
je     111b <f2+0x1b>
jmp    1120 <f2+0x20>
jmp    1120 <f2+0x20>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f2(i1 zeroext %0) {
%2 = alloca i8
%3 = zext i1 %0 to i8
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = trunc i8 %4 to i1
br i1 %5, label %6, label %7
6: ; preds = %1
br label %8
7: ; preds = %1
br label %8
8: ; preds = %7, %6
ret void
}

LLVM IR (-O2):
define void @f2(i1 zeroext %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mvprintw(int /*<<< orphan*/, int /*<<< orphan*/, char *,
                            char *);
int /*<<< orphan*/ refresh();
void errmsg(char *msg) {
  mvprintw(0, 0, "Error: %s", msg);
  refresh();
}


x86 assembly (clang, -O0):
<errmsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
xor    %esi,%esi
lea    0xec7(%rip),%rdx
mov    %esi,%edi
call   1040 <mvprintw@plt>
mov    $0x0,%al
call   1030 <refresh@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<errmsg>:
push   %rax
mov    %rdi,%rcx
lea    0xed5(%rip),%rdx
xor    %edi,%edi
xor    %esi,%esi
call   1040 <mvprintw@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <refresh@plt>

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

LLVM IR (-O2):
@.str = [10 x i8] c"Error: %s\00"
define void @errmsg(i8* %0) {
%2 = tail call i32 @mvprintw(i32 0, i32 0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 (...) @refresh()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ do_char(char *);
void eval(char *str) {
  for (char *s = str; *s; s++)
    do_char(s);
}


x86 assembly (clang, -O0):
<eval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     114b <eval+0x3b>
mov    -0x10(%rbp),%rdi
call   1030 <do_char@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <eval+0x14>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eval>:
push   %rbx
cmpb   $0x0,(%rdi)
je     1132 <eval+0x22>
mov    %rdi,%rbx
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <do_char@plt>
cmpb   $0x0,0x1(%rbx)
lea    0x1(%rbx),%rbx
jne    1120 <eval+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @eval(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %5, %1
ret void
5: ; preds = %1, %5
%6 = phi i8* [ %8, %5 ], [ %0, %1 ]
%7 = tail call i32 @do_char(i8* %6)
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %4, label %5
}
const char *getnextchar(const char *x, const char attr) {
  static char ch[3] = "  ";
  ch[0] = '\0';
  while (*x) {
    if (*x++ == attr) {
      ch[0] = attr;
      ch[1] = *x;
      break;
    }
  }
  return ch;
}


x86 assembly (clang, -O0):
<getnextchar>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movb   $0x0,0x2f0b(%rip)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     115f <getnextchar+0x5f>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    115a <getnextchar+0x5a>
mov    -0x9(%rbp),%al
mov    %al,0x2ed7(%rip)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,0x2ecc(%rip)
jmp    115f <getnextchar+0x5f>
jmp    1115 <getnextchar+0x15>
lea    0x2eba(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getnextchar>:
movb   $0x0,0x2f19(%rip)
nopw   0x0(%rax,%rax,1)
movzbl (%rdi),%eax
test   %al,%al
je     112f <getnextchar+0x2f>
add    $0x1,%rdi
cmp    %sil,%al
jne    1110 <getnextchar+0x10>
mov    %sil,0x2ef9(%rip)
mov    (%rdi),%al
mov    %al,0x2ef2(%rip)
lea    0x2eea(%rip),%rax
ret

LLVM IR (-O0):
@getnextchar.ch = internal global [3 x i8] c" \00"
define i8* @getnextchar(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
store i8 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @getnextchar.ch, i64 0, i64 0)
br label %5
5: ; preds = %21, %2
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %22
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %3
%12 = load i8, i8* %10
%13 = sext i8 %12 to i32
%14 = load i8, i8* %4
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %13, %15
br i1 %16, label %17, label %21
17: ; preds = %9
%18 = load i8, i8* %4
store i8 %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @getnextchar.ch, i64 0, i64 0)
%19 = load i8*, i8** %3
%20 = load i8, i8* %19
store i8 %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @getnextchar.ch, i64 0, i64 1)
br label %22
21: ; preds = %9
br label %5
22: ; preds = %17, %5
ret i8* getelementptr inbounds ([3 x i8], [3 x i8]* @getnextchar.ch, i64 0, i64 0)
}

LLVM IR (-O2):
@getnextchar.ch = internal global [3 x i8] c" \00"
define i8* @getnextchar(i8* nocapture %0, i8 signext %1) {
store i8 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @getnextchar.ch, i64 0, i64 0)
br label %3
3: ; preds = %7, %2
%4 = phi i8* [ %0, %2 ], [ %8, %7 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
br i1 %6, label %12, label %7
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %4, i64 1
%9 = icmp eq i8 %5, %1
br i1 %9, label %10, label %3
10: ; preds = %7
store i8 %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @getnextchar.ch, i64 0, i64 0)
%11 = load i8, i8* %8
store i8 %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @getnextchar.ch, i64 0, i64 1)
br label %12
12: ; preds = %3, %10
ret i8* getelementptr inbounds ([3 x i8], [3 x i8]* @getnextchar.ch, i64 0, i64 0)
}
/* Variables and functions */
int cbuf(int, int, int);
cbuf25(int f, int n) { return (cbuf(f, n, 25)); }


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

x86 assembly (clang, -O2):
<cbuf25>:
mov    $0x19,%edx
jmp    1030 <cbuf@plt>

LLVM IR (-O0):
define i32 @cbuf25(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 @cbuf(i32 %5, i32 %6, i32 25)
ret i32 %7
}

LLVM IR (-O2):
define i32 @cbuf25(i32 %0, i32 %1) {
%3 = tail call i32 @cbuf(i32 %0, i32 %1, i32 25)
ret i32 %3
}
int adds_si_test2(int a, int b, int c) {
  int d = a + 0xff;
  if (d == 0)
    return a + c;
  else
    return d;
}


x86 assembly (clang, -O0):
<adds_si_test2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xff,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1130 <adds_si_test2+0x30>
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1136 <adds_si_test2+0x36>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adds_si_test2>:
lea    (%rdx,%rdi,1),%eax
lea    0xff(%rdi),%ecx
test   %ecx,%ecx
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @adds_si_test2(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%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
%9 = load i32, i32* %5
%10 = add nsw i32 %9, 255
store i32 %10, i32* %8
%11 = load i32, i32* %8
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %3
%14 = load i32, i32* %5
%15 = load i32, i32* %7
%16 = add nsw i32 %14, %15
store i32 %16, i32* %4
br label %19
17: ; preds = %3
%18 = load i32, i32* %8
store i32 %18, i32* %4
br label %19
19: ; preds = %17, %13
%20 = load i32, i32* %4
ret i32 %20
}

LLVM IR (-O2):
define i32 @adds_si_test2(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %0, 255
%5 = icmp eq i32 %4, 0
%6 = add nsw i32 %2, %0
%7 = select i1 %5, i32 %6, i32 %4
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main(int argc, char *argv[]) { puts("Hola mundo!"); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [12 x i8] c"Hola mundo!\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"Hola mundo!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int seqlen(const char *s, int ch) {
  int len = 0;
  while (*s++ == ch)
    len++;
  return len;
}


x86 assembly (clang, -O0):
<seqlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
cmp    -0xc(%rbp),%eax
jne    113b <seqlen+0x3b>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <seqlen+0x12>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<seqlen>:
movsbl (%rdi),%ecx
xor    %eax,%eax
cmp    %esi,%ecx
jne    111d <seqlen+0x1d>
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
movsbl 0x1(%rdi,%rax,1),%ecx
add    $0x1,%rax
cmp    %esi,%ecx
je     1110 <seqlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @seqlen(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, %1
br i1 %5, label %6, label %14
6: ; preds = %2, %6
%7 = phi i32 [ %10, %6 ], [ 0, %2 ]
%8 = phi i8* [ %9, %6 ], [ %0, %2 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = add nuw nsw i32 %7, 1
%11 = load i8, i8* %9
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, %1
br i1 %13, label %6, label %14
14: ; preds = %6, %2
%15 = phi i32 [ 0, %2 ], [ %10, %6 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ perror(char const *);
int /*<<< orphan*/ printf(char *, char const *);
int /*<<< orphan*/ pthread_exit(void *);
int /*<<< orphan*/ removeclient(int);
void thread_error(int fd, const char *msg) {
  printf("thread error: %s\n", msg);
  perror(msg);
  removeclient(fd);
  pthread_exit((void *)1);
}


x86 assembly (clang, -O0):
<thread_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <perror@plt>
mov    -0x4(%rbp),%edi
call   1060 <removeclient@plt>
mov    $0x1,%edi
call   1040 <pthread_exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread_error>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1050 <perror@plt>
mov    %ebp,%edi
call   1060 <removeclient@plt>
mov    $0x1,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"thread error: %s\0A\00"
define void @thread_error(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i8*, i8** %4
%8 = call i32 @perror(i8* %7)
%9 = load i32, i32* %3
%10 = call i32 @removeclient(i32 %9)
%11 = call i32 @pthread_exit(i8* inttoptr (i64 1 to i8*))
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"thread error: %s\0A\00"
define void @thread_error(i32 %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %1)
%4 = tail call i32 @perror(i8* %1)
%5 = tail call i32 @removeclient(i32 %0)
%6 = tail call i32 @pthread_exit(i8* inttoptr (i64 1 to i8*))
ret void
}
int test_imm_DCint64_lowword_mem(long long *val) {
  return ((*val) & (0xDC << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_DCint64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 220
%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_DCint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 220
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void XkbBellEvent() {}


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

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

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

LLVM IR (-O2):
define void @XkbBellEvent() {
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int ntohl(int);
uint32_t letohl(uint32_t ledata) {
  uint32_t bedata =
      (((ledata >> 0) & 0xff) << 24) | (((ledata >> 8) & 0xff) << 16) |
      (((ledata >> 16) & 0xff) << 8) | (((ledata >> 24) & 0xff) << 0);
  return ntohl(bedata);
}


x86 assembly (clang, -O0):
<letohl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x0,%eax
and    $0xff,%eax
shl    $0x18,%eax
mov    -0x4(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
sar    $0x10,%ecx
and    $0xff,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
sar    $0x18,%ecx
and    $0xff,%ecx
shl    $0x0,%ecx
or     %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <ntohl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<letohl>:
bswap  %edi
jmp    1030 <ntohl@plt>

LLVM IR (-O0):
define i32 @letohl(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = ashr i32 %4, 0
%6 = and i32 %5, 255
%7 = shl i32 %6, 24
%8 = load i32, i32* %2
%9 = ashr i32 %8, 8
%10 = and i32 %9, 255
%11 = shl i32 %10, 16
%12 = or i32 %7, %11
%13 = load i32, i32* %2
%14 = ashr i32 %13, 16
%15 = and i32 %14, 255
%16 = shl i32 %15, 8
%17 = or i32 %12, %16
%18 = load i32, i32* %2
%19 = ashr i32 %18, 24
%20 = and i32 %19, 255
%21 = shl i32 %20, 0
%22 = or i32 %17, %21
store i32 %22, i32* %3
%23 = load i32, i32* %3
%24 = call i32 @ntohl(i32 %23)
ret i32 %24
}

LLVM IR (-O2):
define i32 @letohl(i32 %0) {
%2 = tail call i32 @llvm.bswap.i32(i32 %0)
%3 = tail call i32 @ntohl(i32 %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ send(int, char *, int, int /*<<< orphan*/);
int do_other(int fd) {
  send(fd, "-ERR not valid\r\n", sizeof("-ERR not valid\r\n"), 0);
  return 0;
}


x86 assembly (clang, -O0):
<do_other>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    0xedb(%rip),%rsi
mov    $0x11,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_other>:
push   %rax
lea    0xee8(%rip),%rsi
mov    $0x11,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"-ERR not valid\0D\0A\00"
define i32 @do_other(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @send(i32 %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 17, i32 0)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"-ERR not valid\0D\0A\00"
define i32 @do_other(i32 %0) {
%2 = tail call i32 @send(i32 %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 17, i32 0)
ret i32 0
}
int hammingDistance(int x, int y) {
  int h = x ^ y;
  int d = 0;
  while (h > 0) {
    if ((h & 1) == 1)
      d++;
    h >>= 1;
  }
  return d;
}


x86 assembly (clang, -O0):
<hammingDistance>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    114a <hammingDistance+0x4a>
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x1,%eax
jne    113c <hammingDistance+0x3c>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    111a <hammingDistance+0x1a>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hammingDistance>:
xor    %eax,%eax
xor    %esi,%edi
jle    1120 <hammingDistance+0x20>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
mov    %edi,%edx
and    $0x1,%edx
add    %edx,%eax
shr    %ecx
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <hammingDistance+0x10>
ret

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

LLVM IR (-O2):
define i32 @hammingDistance(i32 %0, i32 %1) {
%3 = xor i32 %1, %0
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %12
5: ; preds = %2, %5
%6 = phi i32 [ %9, %5 ], [ 0, %2 ]
%7 = phi i32 [ %10, %5 ], [ %3, %2 ]
%8 = and i32 %7, 1
%9 = add nuw nsw i32 %6, %8
%10 = lshr i32 %7, 1
%11 = icmp ult i32 %7, 2
br i1 %11, label %12, label %5
12: ; preds = %5, %2
%13 = phi i32 [ 0, %2 ], [ %9, %5 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ STA8(int /*<<< orphan*/);
int /*<<< orphan*/ StackRelativeIndirectIndexed(int);
void Op93M1(void) { STA8(StackRelativeIndirectIndexed(2)); }


x86 assembly (clang, -O0):
<Op93M1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1040 <StackRelativeIndirectIndexed@plt>
mov    %eax,%edi
call   1030 <STA8@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Op93M1>:
push   %rax
mov    $0x2,%edi
call   1040 <StackRelativeIndirectIndexed@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <STA8@plt>

LLVM IR (-O0):
define void @Op93M1() {
%1 = call i32 @StackRelativeIndirectIndexed(i32 2)
%2 = call i32 @STA8(i32 %1)
ret void
}

LLVM IR (-O2):
define void @Op93M1() {
%1 = tail call i32 @StackRelativeIndirectIndexed(i32 2)
%2 = tail call i32 @STA8(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void usage() {
  puts("USAGE: ping [-h] [-d] <host>\n"
       "       where <host> is IPv(4|6) address or domain name"
       "\n"
       "OPTIONS:\n"
       "   -h  print help\n"
       "   -d  debug mode on");
}


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

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

LLVM IR (-O0):
@.str = [132 x i8] c"USAGE: ping [-h] [-d] <host>\0A where <host> is IPv(4|6) address or domain name\0AOPTIONS:\0A -h print help\0A -d debug mode on\00"
define void @usage() {
%1 = call i32 @puts(i8* getelementptr inbounds ([132 x i8], [132 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [132 x i8] c"USAGE: ping [-h] [-d] <host>\0A where <host> is IPv(4|6) address or domain name\0AOPTIONS:\0A -h print help\0A -d debug mode on\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([132 x i8], [132 x i8]* @.str, i64 0, i64 0))
ret void
}
int plus_linear_min(int i) {
  int linear = i + 1;
  if (i >= 0 && i < 10) {
    return linear + i;
  }
  return 0;
}


x86 assembly (clang, -O0):
<plus_linear_min>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1132 <plus_linear_min+0x32>
cmpl   $0xa,-0x8(%rbp)
jge    1132 <plus_linear_min+0x32>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1139 <plus_linear_min+0x39>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<plus_linear_min>:
xor    %ecx,%ecx
cmp    $0xa,%edi
lea    0x1(%rdi,%rdi,1),%eax
cmovae %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @plus_linear_min(i32 %0) {
%2 = icmp ult i32 %0, 10
%3 = shl i32 %0, 1
%4 = or i32 %3, 1
%5 = select i1 %2, i32 %4, i32 0
ret i32 %5
}
unsigned char KSG128(unsigned char *state) {
  return (state[12] ^ state[154] ^
          (((state[235]) & (state[61])) ^ ((state[235]) & (state[193])) ^
           ((state[61]) & (state[193]))));
}


x86 assembly (clang, -O0):
<KSG128>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0xc(%rax),%eax
mov    -0x8(%rbp),%rcx
movzbl 0x9a(%rcx),%ecx
xor    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0xeb(%rcx),%ecx
mov    -0x8(%rbp),%rdx
movzbl 0x3d(%rdx),%edx
and    %edx,%ecx
mov    -0x8(%rbp),%rdx
movzbl 0xeb(%rdx),%edx
mov    -0x8(%rbp),%rsi
movzbl 0xc1(%rsi),%esi
and    %esi,%edx
xor    %edx,%ecx
mov    -0x8(%rbp),%rdx
movzbl 0x3d(%rdx),%edx
mov    -0x8(%rbp),%rsi
movzbl 0xc1(%rsi),%esi
and    %esi,%edx
xor    %edx,%ecx
xor    %ecx,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<KSG128>:
mov    0x3d(%rdi),%sil
mov    0x9a(%rdi),%al
mov    0xc1(%rdi),%cl
mov    %ecx,%edx
xor    %sil,%dl
and    0xeb(%rdi),%dl
and    %sil,%cl
xor    0xc(%rdi),%al
xor    %cl,%al
xor    %dl,%al
ret

LLVM IR (-O0):
define zeroext i8 @KSG128(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 12
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 154
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = xor i32 %6, %10
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i64 235
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i64 61
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = and i32 %15, %19
%21 = load i8*, i8** %2
%22 = getelementptr inbounds i8, i8* %21, i64 235
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = load i8*, i8** %2
%26 = getelementptr inbounds i8, i8* %25, i64 193
%27 = load i8, i8* %26
%28 = zext i8 %27 to i32
%29 = and i32 %24, %28
%30 = xor i32 %20, %29
%31 = load i8*, i8** %2
%32 = getelementptr inbounds i8, i8* %31, i64 61
%33 = load i8, i8* %32
%34 = zext i8 %33 to i32
%35 = load i8*, i8** %2
%36 = getelementptr inbounds i8, i8* %35, i64 193
%37 = load i8, i8* %36
%38 = zext i8 %37 to i32
%39 = and i32 %34, %38
%40 = xor i32 %30, %39
%41 = xor i32 %11, %40
%42 = trunc i32 %41 to i8
ret i8 %42
}

LLVM IR (-O2):
define zeroext i8 @KSG128(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 12
%3 = load i8, i8* %2
%4 = getelementptr inbounds i8, i8* %0, i64 154
%5 = load i8, i8* %4
%6 = getelementptr inbounds i8, i8* %0, i64 235
%7 = load i8, i8* %6
%8 = getelementptr inbounds i8, i8* %0, i64 61
%9 = load i8, i8* %8
%10 = getelementptr inbounds i8, i8* %0, i64 193
%11 = load i8, i8* %10
%12 = xor i8 %11, %9
%13 = and i8 %12, %7
%14 = and i8 %11, %9
%15 = xor i8 %5, %3
%16 = xor i8 %15, %14
%17 = xor i8 %16, %13
ret i8 %17
}
void replace_char(char *s, char find, char replace) {
  while (*s != 0) {
    if (*s == find)
      *s = replace;
    s++;
  }
}


x86 assembly (clang, -O0):
<replace_char>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1150 <replace_char+0x50>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    113f <replace_char+0x3f>
mov    -0xa(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1113 <replace_char+0x13>
pop    %rbp
ret

x86 assembly (clang, -O2):
<replace_char>:
mov    (%rdi),%al
test   %al,%al
je     1125 <replace_char+0x25>
add    $0x1,%rdi
jmp    111b <replace_char+0x1b>
nopl   0x0(%rax)
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
je     1125 <replace_char+0x25>
cmp    %sil,%al
jne    1110 <replace_char+0x10>
mov    %dl,-0x1(%rdi)
jmp    1110 <replace_char+0x10>
ret

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

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


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

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

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

LLVM IR (-O2):
define void @ws_front_cam_getframe() {
ret void
}
int hasFlag(int flags, int flag) { return (flags & flag) == flag; }


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

x86 assembly (clang, -O2):
<hasFlag>:
not    %edi
xor    %eax,%eax
test   %edi,%esi
sete   %al
ret

LLVM IR (-O0):
define i32 @hasFlag(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 = and i32 %5, %6
%8 = load i32, i32* %4
%9 = icmp eq i32 %7, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @hasFlag(i32 %0, i32 %1) {
%3 = and i32 %1, %0
%4 = icmp eq i32 %3, %1
%5 = zext i1 %4 to i32
ret i32 %5
}
void orphans(argv) char **argv;
{
  for (; *argv; ++argv)
    warnx("%s: not found in archive", *argv);
}


x86 assembly (clang, -O0):
<orphans>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1150 <orphans+0x40>
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <warnx@plt>
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <orphans+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<orphans>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%rsi
test   %rsi,%rsi
je     1146 <orphans+0x36>
mov    %rdi,%rbx
add    $0x8,%rbx
lea    0xed6(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <warnx@plt>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1130 <orphans+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [25 x i8] c"%s: not found in archive\00"
define void @orphans(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
br label %3
3: ; preds = %11, %1
%4 = load i8**, i8*** %2
%5 = load i8*, i8** %4
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %14
7: ; preds = %3
%8 = load i8**, i8*** %2
%9 = load i8*, i8** %8
%10 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @warnx to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %11
11: ; preds = %7
%12 = load i8**, i8*** %2
%13 = getelementptr inbounds i8*, i8** %12, i32 1
store i8** %13, i8*** %2
br label %3
14: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"%s: not found in archive\00"
define void @orphans(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %9, %4 ], [ %2, %1 ]
%6 = phi i8** [ %8, %4 ], [ %0, %1 ]
%7 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @warnx to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %5)
%8 = getelementptr inbounds i8*, i8** %6, i64 1
%9 = load i8*, i8** %8
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
char *longestPalindrom(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (argc != 2) {
    fprintf(stderr, "Usage: ./test string\n");
    exit(-1);
  }
  printf("%s\n", longestPalindrom(argv[1]));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     117f <main+0x3f>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <longestPalindrom@plt>
mov    %rax,%rsi
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1162 <main+0x22>
mov    0x8(%rsi),%rdi
call   1050 <longestPalindrom@plt>
lea    0xec0(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
lea    0xe8e(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"Usage: ./test string\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
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, 2
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 -1)
unreachable
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i8* @longestPalindrom(i8* %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %16)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"Usage: ./test string\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 -1)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i8* @longestPalindrom(i8* %10)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %11)
ret i32 0
}
void BN_bn2bin(void) {}


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

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

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

LLVM IR (-O2):
define void @BN_bn2bin() {
ret void
}
void foo(void) {
#pragma omp simd linear(p) linear(f : 1)
  for (int i = 0; i < 10; i++)
    ;
#pragma omp simd linear(j : 7.0)
  for (int i = 0; i < 10; i++)
    ;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1128 <foo+0x28>
jmp    111a <foo+0x1a>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <foo+0xb>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    114c <foo+0x4c>
jmp    113e <foo+0x3e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112f <foo+0x2f>
pop    %rbp
ret

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

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

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