xunge/DecIR huggingface dataset:
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int style;
};
typedef TYPE_1__ XIMPreeditCaretCallbackStruct;

/* Variables and functions */
void set_XIMPreeditCaretCallbackStruct_style(void *_p, int _v) {
  ((XIMPreeditCaretCallbackStruct *)_p)->style = (int)_v;
}


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

x86 assembly (clang, -O2):
<set_XIMPreeditCaretCallbackStruct_style>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XIMPreeditCaretCallbackStruct_style(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XIMPreeditCaretCallbackStruct_style(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
double to_radian(double degree) {
  return (3.14159265358979323846 / 180) * degree;
}


x86 assembly (clang, -O0):
<to_radian>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define double @to_radian(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double 0x3F91DF46A2529D39, %3
ret double %4
}

LLVM IR (-O2):
define double @to_radian(double %0) {
%2 = fmul double %0, 0x3F91DF46A2529D39
ret double %2
}
int g(int x, int y) {
  do
    x += y;
  while (y < 100);
  return x;
}


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x64,-0x8(%rbp)
jl     110a <g+0xa>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<g>:
mov    %edi,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    %esi,%eax
cmp    $0x64,%esi
jl     1110 <g+0x10>
ret

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

LLVM IR (-O2):
define i32 @g(i32 %0, i32 %1) {
%3 = icmp slt i32 %1, 100
br label %4
4: ; preds = %4, %2
%5 = phi i32 [ %0, %2 ], [ %6, %4 ]
%6 = add nsw i32 %5, %1
br i1 %3, label %4, label %7
7: ; preds = %4
ret i32 %6
}
void __t() {
label1:
  __attribute__((unused)) return;
}


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

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

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

LLVM IR (-O2):
define void @__t() {
ret void
}
int __attribute__((no, noclone)) foo(int a) { return a + 5; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x5,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
lea    0x5(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 5
ret i32 %4
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = add nsw i32 %0, 5
ret i32 %2
}
void speicher_freigeben_2dim_char_array_free(int zeilen, char **array) {
  for (int i = 0; i < zeilen; i++) {
    free(array[i]);
  }
  free(array);
}


x86 assembly (clang, -O0):
<speicher_freigeben_2dim_char_array_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1151 <speicher_freigeben_2dim_char_array_free+0x41>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <speicher_freigeben_2dim_char_array_free+0x16>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<speicher_freigeben_2dim_char_array_free>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
test   %edi,%edi
jle    1142 <speicher_freigeben_2dim_char_array_free+0x32>
mov    %edi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <speicher_freigeben_2dim_char_array_free+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @speicher_freigeben_2dim_char_array_free(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %8
6: ; preds = %8, %2
%7 = bitcast i8** %1 to i8*
tail call void @free(i8* %7)
ret void
8: ; preds = %4, %8
%9 = phi i64 [ 0, %4 ], [ %12, %8 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
tail call void @free(i8* %11)
%12 = add nuw nsw i64 %9, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %6, label %8
}
/* Variables and functions */
double sin(double);
double math__Float__sin(double self) {
  double var;
  double var1;
  var1 = sin(self);
  var = var1;
  goto RET_LABEL;
RET_LABEL:;
  return var;
}


x86 assembly (clang, -O0):
<math__Float__sin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<math__Float__sin>:
jmp    1030 <sin@plt>

LLVM IR (-O0):
define double @math__Float__sin(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
%5 = load double, double* %2
%6 = call double @sin(double %5)
store double %6, double* %4
%7 = load double, double* %4
store double %7, double* %3
br label %8
8: ; preds = %1
%9 = load double, double* %3
ret double %9
}

LLVM IR (-O2):
define double @math__Float__sin(double %0) {
%2 = tail call double @sin(double %0)
ret double %2
}
int umod(unsigned int a, unsigned int b) {
  int r = a % b;
  return r < 0 ? r + b : r;
}


x86 assembly (clang, -O0):
<umod>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    %edx,%edx
divl   -0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    112d <umod+0x2d>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1133 <umod+0x33>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<umod>:
mov    %edi,%eax
xor    %edx,%edx
div    %esi
mov    %edx,%eax
sar    $0x1f,%eax
and    %esi,%eax
add    %edx,%eax
ret

LLVM IR (-O0):
define i32 @umod(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 = load i32, i32* %4
%8 = urem i32 %6, %7
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* %5
%13 = load i32, i32* %4
%14 = add i32 %12, %13
br label %17
15: ; preds = %2
%16 = load i32, i32* %5
br label %17
17: ; preds = %15, %11
%18 = phi i32 [ %14, %11 ], [ %16, %15 ]
ret i32 %18
}

LLVM IR (-O2):
define i32 @umod(i32 %0, i32 %1) {
%3 = urem i32 %0, %1
%4 = icmp slt i32 %3, 0
%5 = select i1 %4, i32 %1, i32 0
%6 = add i32 %5, %3
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ CE_High();
int /*<<< orphan*/ CE_Low();
int /*<<< orphan*/ Send_Byte(unsigned long);
void Block_Erase_64K(unsigned long Dst) {
  CE_Low();
  Send_Byte(0xD8);
  Send_Byte(((Dst & 0xFFFFFF) >> 16));
  Send_Byte(((Dst & 0xFFFF) >> 8));
  Send_Byte(Dst & 0xFF);
  CE_High();
}


x86 assembly (clang, -O0):
<Block_Erase_64K>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1050 <CE_Low@plt>
mov    $0xd8,%edi
call   1030 <Send_Byte@plt>
mov    -0x8(%rbp),%rdi
and    $0xffffff,%rdi
shr    $0x10,%rdi
call   1030 <Send_Byte@plt>
mov    -0x8(%rbp),%rdi
and    $0xffff,%rdi
shr    $0x8,%rdi
call   1030 <Send_Byte@plt>
mov    -0x8(%rbp),%rdi
and    $0xff,%rdi
call   1030 <Send_Byte@plt>
mov    $0x0,%al
call   1040 <CE_High@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Block_Erase_64K>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <CE_Low@plt>
mov    $0xd8,%edi
call   1030 <Send_Byte@plt>
mov    %ebx,%eax
shr    $0x10,%eax
movzbl %al,%edi
call   1030 <Send_Byte@plt>
movzbl %bh,%edi
call   1030 <Send_Byte@plt>
movzbl %bl,%edi
call   1030 <Send_Byte@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <CE_High@plt>

LLVM IR (-O0):
define void @Block_Erase_64K(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = call i32 (...) @CE_Low()
%4 = call i32 @Send_Byte(i64 216)
%5 = load i64, i64* %2
%6 = and i64 %5, 16777215
%7 = lshr i64 %6, 16
%8 = call i32 @Send_Byte(i64 %7)
%9 = load i64, i64* %2
%10 = and i64 %9, 65535
%11 = lshr i64 %10, 8
%12 = call i32 @Send_Byte(i64 %11)
%13 = load i64, i64* %2
%14 = and i64 %13, 255
%15 = call i32 @Send_Byte(i64 %14)
%16 = call i32 (...) @CE_High()
ret void
}

LLVM IR (-O2):
define void @Block_Erase_64K(i64 %0) {
%2 = tail call i32 (...) @CE_Low()
%3 = tail call i32 @Send_Byte(i64 216)
%4 = lshr i64 %0, 16
%5 = and i64 %4, 255
%6 = tail call i32 @Send_Byte(i64 %5)
%7 = lshr i64 %0, 8
%8 = and i64 %7, 255
%9 = tail call i32 @Send_Byte(i64 %8)
%10 = and i64 %0, 255
%11 = tail call i32 @Send_Byte(i64 %10)
%12 = tail call i32 (...) @CE_High()
ret void
}
/* Variables and functions */
void *fcitx_utils_calloc(int, size_t);
void *fcitx_utils_malloc0(size_t size) { return fcitx_utils_calloc(1, size); }


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

x86 assembly (clang, -O2):
<fcitx_utils_malloc0>:
mov    %rdi,%rsi
mov    $0x1,%edi
jmp    1030 <fcitx_utils_calloc@plt>

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

LLVM IR (-O2):
define i8* @fcitx_utils_malloc0(i64 %0) {
%2 = tail call i8* @fcitx_utils_calloc(i32 1, i64 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ merge(int *, int, int);
void merge_sort(int *a, int n) {
  if (n < 2)
    return;
  int m = n / 2;
  merge_sort(a, m);
  merge_sort(a + m, n - m);
  merge(a, n, m);
}


x86 assembly (clang, -O0):
<merge_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    113e <merge_sort+0x1e>
jmp    1181 <merge_sort+0x61>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1040 <merge_sort@plt>
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0xc(%rbp),%esi
sub    -0x10(%rbp),%esi
call   1040 <merge_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <merge@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<merge_sort>:
cmp    $0x1,%esi
jg     1126 <merge_sort+0x6>
ret
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
mov    %esi,%ebx
shr    %ebx
mov    %ebx,%esi
call   1040 <merge_sort@plt>
lea    (%r14,%rbx,4),%rdi
mov    %ebp,%esi
sub    %ebx,%esi
call   1040 <merge_sort@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <merge@plt>

LLVM IR (-O0):
define void @merge_sort(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* %4
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %9
8: ; preds = %2
br label %25
9: ; preds = %2
%10 = load i32, i32* %4
%11 = sdiv i32 %10, 2
store i32 %11, i32* %5
%12 = load i32*, i32** %3
%13 = load i32, i32* %5
%14 = load i32*, i32** %3
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = sub nsw i32 %18, %19
%21 = load i32*, i32** %3
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = call i32 @merge(i32* %21, i32 %22, i32 %23)
br label %25
25: ; preds = %9, %8
ret void
}

LLVM IR (-O2):
define void @merge_sort(i32* %0, i32 %1) {
%3 = icmp slt i32 %1, 2
br i1 %3, label %4, label %5
4: ; preds = %2, %5
ret void
5: ; preds = %2
%6 = lshr i32 %1, 1
tail call void @merge_sort(i32* %0, i32 %6)
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = sub nsw i32 %1, %6
tail call void @merge_sort(i32* %8, i32 %9)
%10 = tail call i32 @merge(i32* %0, i32 %1, i32 %6)
br label %4
}
/* Variables and functions */
double fabs(double);
double nsl_geom_point_line_dist_y(double x1, double y1, double x2, double y2,
                                  double xp, double yp) {
  return fabs(yp - y1 - (y2 - y1) * (xp - x1) / (x2 - x1));
}


x86 assembly (clang, -O0):
<nsl_geom_point_line_dist_y>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
subsd  -0x8(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  -0x18(%rbp),%xmm2
subsd  -0x8(%rbp),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movaps 0xea3(%rip),%xmm1
pand   %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<nsl_geom_point_line_dist_y>:
subsd  %xmm1,%xmm5
subsd  %xmm1,%xmm3
subsd  %xmm0,%xmm4
mulsd  %xmm3,%xmm4
subsd  %xmm0,%xmm2
divsd  %xmm2,%xmm4
subsd  %xmm4,%xmm5
andpd  0xedc(%rip),%xmm5
movapd %xmm5,%xmm0
ret

LLVM IR (-O0):
define double @nsl_geom_point_line_dist_y(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
store double %5, double* %12
%13 = load double, double* %12
%14 = load double, double* %8
%15 = fsub double %13, %14
%16 = load double, double* %10
%17 = load double, double* %8
%18 = fsub double %16, %17
%19 = load double, double* %11
%20 = load double, double* %7
%21 = fsub double %19, %20
%22 = fmul double %18, %21
%23 = load double, double* %9
%24 = load double, double* %7
%25 = fsub double %23, %24
%26 = fdiv double %22, %25
%27 = fsub double %15, %26
%28 = call double @llvm.fabs.f64(double %27)
ret double %28
}

LLVM IR (-O2):
define double @nsl_geom_point_line_dist_y(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = fsub double %5, %1
%8 = fsub double %3, %1
%9 = fsub double %4, %0
%10 = fmul double %8, %9
%11 = fsub double %2, %0
%12 = fdiv double %10, %11
%13 = fsub double %7, %12
%14 = tail call double @llvm.fabs.f64(double %13)
ret double %14
}
unsigned int count_bits(unsigned int v) {
  unsigned int c;
  for (c = 0; v; c++) {
    v &= v - 1;
  }
  return c;
}


x86 assembly (clang, -O0):
<count_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1132 <count_bits+0x32>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <count_bits+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_bits>:
xor    %eax,%eax
test   %edi,%edi
je     111c <count_bits+0x1c>
cs nopw 0x0(%rax,%rax,1)
lea    -0x1(%rdi),%ecx
add    $0x1,%eax
and    %edi,%ecx
mov    %ecx,%edi
jne    1110 <count_bits+0x10>
ret

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

LLVM IR (-O2):
define i32 @count_bits(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ 0, %1 ]
%5 = phi i32 [ %7, %3 ], [ %0, %1 ]
%6 = add i32 %5, -1
%7 = and i32 %6, %5
%8 = add i32 %4, 1
%9 = icmp eq i32 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %8, %3 ]
ret i32 %11
}
int test_imm_E5int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0xE5 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_E5int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 15007744
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
struct timespec {
  int tv_nsec;
  scalar_t__ tv_sec;
};
typedef int int64_t;

/* Variables and functions */
int64_t timespec_to_usec(const struct timespec *a) {
  return (int64_t)a->tv_sec * 1000000 + a->tv_nsec / 1000;
}


x86 assembly (clang, -O0):
<timespec_to_usec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
imul   $0xf4240,%eax,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<timespec_to_usec>:
imul   $0xf4240,0x8(%rdi),%ecx
movslq (%rdi),%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rax
add    %edx,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i64 }
define i32 @timespec_to_usec(%struct.timespec* %0) {
%2 = alloca %struct.timespec*
store %struct.timespec* %0, %struct.timespec** %2
%3 = load %struct.timespec*, %struct.timespec** %2
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = mul nsw i32 %6, 1000000
%8 = load %struct.timespec*, %struct.timespec** %2
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 0
%10 = load i32, i32* %9
%11 = sdiv i32 %10, 1000
%12 = add nsw i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
%struct.timespec = type { i32, i64 }
define i32 @timespec_to_usec(%struct.timespec* nocapture %0) {
%2 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
%5 = mul nsw i32 %4, 1000000
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
%7 = load i32, i32* %6
%8 = sdiv i32 %7, 1000
%9 = add nsw i32 %5, %8
ret i32 %9
}
int ioctl_ready(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @ioctl_ready() {
ret i32 0
}
int gs_is_affix(const char *string, const char *affix) {
  while (*affix) {
    if (*string != *affix)
      return 0;
    string++;
    affix++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<gs_is_affix>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1158 <gs_is_affix+0x58>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     113b <gs_is_affix+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    115f <gs_is_affix+0x5f>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    110c <gs_is_affix+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gs_is_affix>:
mov    (%rsi),%cl
mov    $0x1,%eax
test   %cl,%cl
je     1122 <gs_is_affix+0x22>
xor    %edx,%edx
nopl   (%rax)
cmp    %cl,(%rdi,%rdx,1)
jne    1123 <gs_is_affix+0x23>
movzbl 0x1(%rsi,%rdx,1),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1110 <gs_is_affix+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @gs_is_affix(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %11
%6 = phi i8 [ %14, %11 ], [ %3, %2 ]
%7 = phi i8* [ %13, %11 ], [ %1, %2 ]
%8 = phi i8* [ %12, %11 ], [ %0, %2 ]
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, %6
br i1 %10, label %11, label %16
11: ; preds = %5
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = getelementptr inbounds i8, i8* %7, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %11, %2
%17 = phi i32 [ 1, %2 ], [ 1, %11 ], [ 0, %5 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i = 1;
  for (i; i < 100; i++) {
    if (i % 2 == 1) {
      printf("%d -", i);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    1166 <main+0x56>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    1153 <main+0x43>
mov    -0x8(%rbp),%esi
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
jmp    1158 <main+0x48>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%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
jmp    1138 <main+0x28>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
cmp    $0x64,%ebx
je     1149 <main+0x39>
test   $0x1,%bl
je     1130 <main+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
jmp    1130 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%d -\00"
define i32 @main() {
br label %1
1: ; preds = %0, %7
%2 = phi i32 [ 1, %0 ], [ %8, %7 ]
%3 = and i32 %2, 1
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %7
7: ; preds = %1, %5
%8 = add nuw nsw i32 %2, 1
%9 = icmp eq i32 %8, 100
br i1 %9, label %10, label %1
10: ; preds = %7
ret i32 0
}
void isr_int_co_error() {}


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

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

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

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

/* Variables and functions */
uint32_t get_mask(uint8_t prefix) {
  uint32_t mask = (1 << (32 - prefix)) - 1;
  return ~mask;
}


x86 assembly (clang, -O0):
<get_mask>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x20,%ecx
sub    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
xor    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_mask>:
mov    %edi,%ecx
neg    %cl
mov    $0xffffffff,%eax
shl    %cl,%eax
ret

LLVM IR (-O0):
define i32 @get_mask(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sub nsw i32 32, %4
%6 = shl i32 1, %5
%7 = sub nsw i32 %6, 1
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = xor i32 %8, -1
ret i32 %9
}

LLVM IR (-O2):
define i32 @get_mask(i32 %0) {
%2 = sub nsw i32 32, %0
%3 = shl nsw i32 -1, %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ err(int, char *, char *);
int /*<<< orphan*/ execvp(char *, char **);
void child(char *argv[]) {
  execvp(argv[0], argv);
  err(71, "executing %s", argv[0]);
}


x86 assembly (clang, -O0):
<child>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <execvp@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
mov    $0x47,%edi
lea    0xeb1(%rip),%rsi
call   1030 <err@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<child>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
mov    %rbx,%rsi
call   1040 <execvp@plt>
mov    (%rbx),%rdx
lea    0xec7(%rip),%rsi
mov    $0x47,%edi
pop    %rbx
jmp    1030 <err@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"executing %s\00"
define void @child(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = getelementptr inbounds i8*, i8** %3, i64 0
%5 = load i8*, i8** %4
%6 = load i8**, i8*** %2
%7 = call i32 @execvp(i8* %5, i8** %6)
%8 = load i8**, i8*** %2
%9 = getelementptr inbounds i8*, i8** %8, i64 0
%10 = load i8*, i8** %9
%11 = call i32 @err(i32 71, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"executing %s\00"
define void @child(i8** %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @execvp(i8* %2, i8** %0)
%4 = load i8*, i8** %0
%5 = tail call i32 @err(i32 71, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}
void clearstr(unsigned char *s) {
  int i;
  for (i = 0; i < 256; i++)
    s[i] = 0;
  return;
}


x86 assembly (clang, -O0):
<clearstr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x100,-0xc(%rbp)
jge    1136 <clearstr+0x36>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <clearstr+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearstr>:
xorps  %xmm0,%xmm0
movups %xmm0,0xf0(%rdi)
movups %xmm0,0xe0(%rdi)
movups %xmm0,0xd0(%rdi)
movups %xmm0,0xc0(%rdi)
movups %xmm0,0xb0(%rdi)
movups %xmm0,0xa0(%rdi)
movups %xmm0,0x90(%rdi)
movups %xmm0,0x80(%rdi)
movups %xmm0,0x70(%rdi)
movups %xmm0,0x60(%rdi)
movups %xmm0,0x50(%rdi)
movups %xmm0,0x40(%rdi)
movups %xmm0,0x30(%rdi)
movups %xmm0,0x20(%rdi)
movups %xmm0,0x10(%rdi)
movups %xmm0,(%rdi)
ret

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

LLVM IR (-O2):
define void @clearstr(i8* nocapture writeonly %0) {
ret void
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t vga_entry(char c, uint8_t color) {
  return ((uint16_t)c) | (((uint16_t)color) << 8);
}


x86 assembly (clang, -O0):
<vga_entry>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movsbl -0x1(%rbp),%eax
mov    -0x10(%rbp),%rcx
shl    $0x8,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vga_entry>:
mov    %rsi,%rax
shl    $0x8,%eax
or     %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @vga_entry(i8 signext %0, i64 %1) {
%3 = sext i8 %0 to i32
%4 = trunc i64 %1 to i32
%5 = shl i32 %4, 8
%6 = or i32 %5, %3
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ Errors__fatal(char *);
int CStrings__check_len(int n) {
  if ((n > 8 * 1024) || (n < 0))
    Errors__fatal("String overflow\n");
  return n;
}


x86 assembly (clang, -O0):
<CStrings__check_len>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x2000,-0x4(%rbp)
jg     1132 <CStrings__check_len+0x22>
cmpl   $0x0,-0x4(%rbp)
jge    113e <CStrings__check_len+0x2e>
lea    0xec7(%rip),%rdi
call   1030 <Errors__fatal@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CStrings__check_len>:
push   %rbx
mov    %edi,%ebx
cmp    $0x2001,%edi
jb     1127 <CStrings__check_len+0x17>
lea    0xede(%rip),%rdi
call   1030 <Errors__fatal@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [17 x i8] c"String overflow\0A\00"
define i32 @CStrings__check_len(i32 returned %0) {
%2 = icmp ugt i32 %0, 8192
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @Errors__fatal(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %1, %3
ret i32 %0
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
wchar_t *wmemcpy(wchar_t *restrict d, const wchar_t *restrict s, size_t n) {
  wchar_t *a = d;
  while (n--)
    *d++ = *s++;
  return a;
}


x86 assembly (clang, -O0):
<wmemcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x18(%rbp)
cmp    $0x0,%rax
je     1158 <wmemcpy+0x58>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x8(%rbp)
mov    %ecx,(%rax)
jmp    1118 <wmemcpy+0x18>
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wmemcpy>:
push   %rbx
mov    %rdi,%rbx
test   %rdx,%rdx
je     1125 <wmemcpy+0x15>
shl    $0x2,%rdx
mov    %rbx,%rdi
call   1030 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32* @wmemcpy(i32* noalias returned writeonly %0, i32* noalias nocapture %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %0 to i8*
%8 = shl nuw i64 %2, 2
br label %9
9: ; preds = %5, %3
ret i32* %0
}
unsigned int PC1(int starterKey) {
  int shifted = ((starterKey << 1) | (starterKey >> (8 - 1))) & 0xff;
  return shifted;
}


x86 assembly (clang, -O0):
<PC1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    -0x4(%rbp),%ecx
sar    $0x7,%ecx
or     %ecx,%eax
and    $0xff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<PC1>:
lea    (%rdi,%rdi,1),%eax
shr    $0x7,%edi
or     %eax,%edi
movzbl %dil,%eax
ret

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

LLVM IR (-O2):
define i32 @PC1(i32 %0) {
%2 = shl i32 %0, 1
%3 = lshr i32 %0, 7
%4 = or i32 %2, %3
%5 = and i32 %4, 255
ret i32 %5
}
int test_imm_F3int32_reg(int val) { return ((val) & (0xF3 << 0)) ? -20 : -40; }


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

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

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

LLVM IR (-O2):
define i32 @test_imm_F3int32_reg(i32 %0) {
%2 = and i32 %0, 243
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int rb(int x, int b) { return (x > 9) ? rb(x / 10, b) * b + (x % 10) : x; }


x86 assembly (clang, -O0):
<rb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x9,-0x4(%rbp)
jle    115c <rb+0x4c>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
mov    -0x8(%rbp),%esi
call   1030 <rb@plt>
imul   -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%eax
add    %edx,%eax
mov    %eax,-0xc(%rbp)
jmp    1162 <rb+0x52>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rb>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
cmp    $0x9,%edi
jle    1142 <rb+0x32>
mov    %esi,%r14d
mov    %ebx,%eax
mov    $0xcccccccd,%ebp
imul   %rax,%rbp
shr    $0x23,%rbp
mov    %ebp,%edi
call   1030 <rb@plt>
imul   %r14d,%eax
add    %ebp,%ebp
lea    0x0(%rbp,%rbp,4),%ecx
sub    %ecx,%ebx
add    %eax,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @rb(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 = icmp sgt i32 %5, 9
br i1 %6, label %7, label %17
7: ; preds = %2
%8 = load i32, i32* %3
%9 = sdiv i32 %8, 10
%10 = load i32, i32* %4
%11 = call i32 @rb(i32 %9, i32 %10)
%12 = load i32, i32* %4
%13 = mul nsw i32 %11, %12
%14 = load i32, i32* %3
%15 = srem i32 %14, 10
%16 = add nsw i32 %13, %15
br label %19
17: ; preds = %2
%18 = load i32, i32* %3
br label %19
19: ; preds = %17, %7
%20 = phi i32 [ %16, %7 ], [ %18, %17 ]
ret i32 %20
}

LLVM IR (-O2):
define i32 @rb(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, 9
br i1 %3, label %6, label %4
4: ; preds = %2, %6
%5 = phi i32 [ %11, %6 ], [ %0, %2 ]
ret i32 %5
6: ; preds = %2
%7 = udiv i32 %0, 10
%8 = tail call i32 @rb(i32 %7, i32 %1)
%9 = mul nsw i32 %8, %1
%10 = urem i32 %0, 10
%11 = add nsw i32 %9, %10
br label %4
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
int S_ISDIR(int /*<<< orphan*/);
int stat(char const *, struct stat *);
bool is_dir(const char *path) {
  struct stat st;
  int err;
  err = stat(path, &st);
  if (err)
    return false;
  return S_ISDIR(st.st_mode);
}


x86 assembly (clang, -O0):
<is_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <stat@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1152 <is_dir+0x32>
movl   $0x0,-0x4(%rbp)
jmp    115d <is_dir+0x3d>
mov    -0x18(%rbp),%edi
call   1030 <S_ISDIR@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_dir>:
push   %rax
mov    %rsp,%rsi
call   1040 <stat@plt>
test   %eax,%eax
je     1131 <is_dir+0x11>
xor    %eax,%eax
pop    %rcx
ret
mov    (%rsp),%edi
pop    %rax
jmp    1030 <S_ISDIR@plt>

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

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @is_dir(i8* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = tail call i32 @S_ISDIR(i32 %8)
br label %10
10: ; preds = %1, %6
%11 = phi i32 [ %9, %6 ], [ 0, %1 ]
ret i32 %11
}
/* Variables and functions */
scalar_t__ checkChar(int);
int rand();
int genChar() {
  int n;
  do
    n = rand() % 128;
  while (checkChar(n));
  return n;
}


x86 assembly (clang, -O0):
<genChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x80,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <checkChar@plt>
cmp    $0x0,%rax
jne    1128 <genChar+0x8>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<genChar>:
push   %rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%ebx
lea    0x7f(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xffffff80,%eax
sub    %eax,%ebx
mov    %ebx,%edi
call   1030 <checkChar@plt>
test   %rax,%rax
jne    1130 <genChar+0x10>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @genChar() {
%1 = alloca i32
br label %2
2: ; preds = %5, %0
%3 = call i32 (...) @rand()
%4 = srem i32 %3, 128
store i32 %4, i32* %1
br label %5
5: ; preds = %2
%6 = load i32, i32* %1
%7 = call i64 @checkChar(i32 %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %2, label %9
9: ; preds = %5
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
define i32 @genChar() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, 128
%4 = tail call i64 @checkChar(i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
double sqrt(int);
void calcSpringComp(double m, double v, int k) {
  double ke;
  double c;
  ke = 0.5 * m * v * v;
  c = sqrt(2 * ke / k);
  printf("\nMaximum Spring Compression (m): %.2lf", c);
  return;
}


x86 assembly (clang, -O0):
<calcSpringComp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
movsd  0xecb(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xea7(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sqrt@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcSpringComp>:
push   %rax
mulsd  0xed7(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %edi,%xmm1
addsd  %xmm0,%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sqrt@plt>
lea    0xeb8(%rip),%rdi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"\0AMaximum Spring Compression (m): %.2lf\00"
define void @calcSpringComp(double %0, double %1, i32 %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca i32
%7 = alloca double
%8 = alloca double
store double %0, double* %4
store double %1, double* %5
store i32 %2, i32* %6
%9 = load double, double* %4
%10 = fmul double 5.000000e-01, %9
%11 = load double, double* %5
%12 = fmul double %10, %11
%13 = load double, double* %5
%14 = fmul double %12, %13
store double %14, double* %7
%15 = load double, double* %7
%16 = fmul double 2.000000e+00, %15
%17 = load i32, i32* %6
%18 = sitofp i32 %17 to double
%19 = fdiv double %16, %18
%20 = fptosi double %19 to i32
%21 = call double @sqrt(i32 %20)
store double %21, double* %8
%22 = load double, double* %8
%23 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), double %22)
ret void
}

LLVM IR (-O2):
@.str = [39 x i8] c"\0AMaximum Spring Compression (m): %.2lf\00"
define void @calcSpringComp(double %0, double %1, i32 %2) {
%4 = fmul double %0, 5.000000e-01
%5 = fmul double %4, %1
%6 = fmul double %5, %1
%7 = fmul double %6, 2.000000e+00
%8 = sitofp i32 %2 to double
%9 = fdiv double %7, %8
%10 = fptosi double %9 to i32
%11 = tail call double @sqrt(i32 %10)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), double %11)
ret void
}
/* Type definitions */
struct navi_port {
  int dummy;
};

/* Variables and functions */
int navi_port_is_output_port(struct navi_port *);
int navi_extern_port_is_ouput_port(struct navi_port *p) {
  return navi_port_is_output_port(p);
}


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

x86 assembly (clang, -O2):
<navi_extern_port_is_ouput_port>:
jmp    1030 <navi_port_is_output_port@plt>

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

LLVM IR (-O2):
%struct.navi_port = type { i32 }
define i32 @navi_extern_port_is_ouput_port(%struct.navi_port* %0) {
%2 = tail call i32 @navi_port_is_output_port(%struct.navi_port* %0)
ret i32 %2
}
int foo(void) {
  do {
  } while (0);
  do {
  } while (0 && 0);
  while (0) {
    unsigned a;
    if (a) {
      a++;
    } else {
      a--;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <foo+0x9>
jmp    110e <foo+0xe>
jmp    1113 <foo+0x13>
jmp    1118 <foo+0x18>
xor    %eax,%eax
test   $0x1,%al
jne    1127 <foo+0x27>
jmp    114d <foo+0x4d>
cmpl   $0x0,-0x4(%rbp)
je     113f <foo+0x3f>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1148 <foo+0x48>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    1118 <foo+0x18>
xor    %eax,%eax
pop    %rbp
ret

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

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

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