xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
void *calloc(int, size_t);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
void *alloc(size_t size) {
  void *ptr = calloc(1, size);
  if (!ptr) {
    perror("gthread");
    exit(EXIT_FAILURE);
  };
  return ptr;
}


x86 assembly (clang, -O0):
<alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x1,%edi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1173 <alloc+0x43>
lea    0xea0(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc>:
push   %rax
mov    %rdi,%rsi
mov    $0x1,%edi
call   1030 <calloc@plt>
test   %rax,%rax
je     1145 <alloc+0x15>
pop    %rcx
ret
lea    0xeb4(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"gthread\00"
@EXIT_FAILURE = global i32 0
define i8* @alloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @calloc(i32 1, i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %12, label %8
8: ; preds = %1
%9 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
12: ; preds = %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@.str = [8 x i8] c"gthread\00"
@EXIT_FAILURE = global i32 0
define i8* @alloc(i64 %0) {
%2 = tail call i8* @calloc(i32 1, i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %1
ret i8* %2
}
int isHexDigit(char c) {
  return (((c >= '0') && (c <= '9')) || ((c >= 'a') && (c <= 'f')) ||
          ((c >= 'A') && (c <= 'F')));
}


x86 assembly (clang, -O0):
<isHexDigit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x30,%eax
jl     1129 <isHexDigit+0x29>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x39,%ecx
mov    %al,-0x2(%rbp)
jle    116d <isHexDigit+0x6d>
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jl     1148 <isHexDigit+0x48>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x66,%ecx
mov    %al,-0x2(%rbp)
jle    116d <isHexDigit+0x6d>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x41,%ecx
mov    %al,-0x3(%rbp)
jl     1167 <isHexDigit+0x67>
movsbl -0x1(%rbp),%eax
cmp    $0x46,%eax
setle  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isHexDigit>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%al
setb   %al
and    $0xdf,%dil
add    $0xbf,%dil
cmp    $0x6,%dil
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @isHexDigit(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 57
br i1 %9, label %28, label %10
10: ; preds = %6, %1
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp sge i32 %12, 97
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 102
br i1 %17, label %28, label %18
18: ; preds = %14, %10
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp sge i32 %20, 65
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
%25 = icmp sle i32 %24, 70
br label %26
26: ; preds = %22, %18
%27 = phi i1 [ false, %18 ], [ %25, %22 ]
br label %28
28: ; preds = %26, %14, %6
%29 = phi i1 [ true, %14 ], [ true, %6 ], [ %27, %26 ]
%30 = zext i1 %29 to i32
ret i32 %30
}

LLVM IR (-O2):
define i32 @isHexDigit(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = and i8 %0, -33
%5 = add i8 %4, -65
%6 = icmp ult i8 %5, 6
%7 = or i1 %3, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ fc_host_get_statistic(char *, char const *);
uint64_t fc_stat_rx_frames(const char *host) {
  return fc_host_get_statistic("rx_frames", host);
}


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

x86 assembly (clang, -O2):
<fc_stat_rx_frames>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <fc_host_get_statistic@plt>

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

LLVM IR (-O2):
@.str = [10 x i8] c"rx_frames\00"
define i32 @fc_stat_rx_frames(i8* %0) {
%2 = tail call i32 @fc_host_get_statistic(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 %2
}
int ndrx_tux_dummy(void) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @ndrx_tux_dummy() {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char const *);
void erreur(const char *message) {
  printf("ERREUR : %s\n", message);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<erreur>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<erreur>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"ERREUR : %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @erreur(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i32, i32* @EXIT_FAILURE
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@.str = [13 x i8] c"ERREUR : %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @erreur(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
void gtk_icon_view_unselect_all() {}


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

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

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

LLVM IR (-O2):
define void @gtk_icon_view_unselect_all() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo(short *);
void bar(short x, int y) {
  if (y)
    x = x << 8 | (unsigned short)x >> 8;
  foo(&x);
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1140 <bar+0x30>
movswl -0x2(%rbp),%eax
shl    $0x8,%eax
movzwl -0x2(%rbp),%ecx
sar    $0x8,%ecx
or     %ecx,%eax
mov    %ax,-0x2(%rbp)
lea    -0x2(%rbp),%rdi
call   1030 <foo@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rax
mov    %edi,%eax
rol    $0x8,%ax
test   %esi,%esi
cmove  %edi,%eax
mov    %ax,0x6(%rsp)
lea    0x6(%rsp),%rdi
call   1030 <foo@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @bar(i16 signext %0, i32 %1) {
%3 = alloca i16
%4 = alloca i32
store i16 %0, i16* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %2
%8 = load i16, i16* %3
%9 = sext i16 %8 to i32
%10 = shl i32 %9, 8
%11 = load i16, i16* %3
%12 = zext i16 %11 to i32
%13 = ashr i32 %12, 8
%14 = or i32 %10, %13
%15 = trunc i32 %14 to i16
store i16 %15, i16* %3
br label %16
16: ; preds = %7, %2
%17 = call i32 @foo(i16* %3)
ret void
}

LLVM IR (-O2):
define void @bar(i16 signext %0, i32 %1) {
%3 = alloca i16
%4 = icmp eq i32 %1, 0
%5 = tail call i16 @llvm.bswap.i16(i16 %0)
%6 = select i1 %4, i16 %0, i16 %5
store i16 %6, i16* %3
%7 = call i32 @foo(i16* %3)
ret void
}
int move_from_wthor(int x) { return 8 * ((x - 11) / 10) + ((x - 11) % 10); }


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

x86 assembly (clang, -O2):
<move_from_wthor>:
add    $0xfffffff5,%edi
movslq %edi,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,1),%edx
lea    (%rdx,%rdx,4),%edx
sub    %edx,%eax
lea    (%rax,%rcx,8),%eax
ret

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

LLVM IR (-O2):
define i32 @move_from_wthor(i32 %0) {
%2 = add nsw i32 %0, -11
%3 = sdiv i32 %2, 10
%4 = shl nsw i32 %3, 3
%5 = srem i32 %2, 10
%6 = add nsw i32 %4, %5
ret i32 %6
}
h() {}


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

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

LLVM IR (-O0):
define i32 @h() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @h() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ gpost2l_(float *, float *, float *, int *, int *, int *,
                            int *);
void cgpost2l(float part[], float q[], float qm, int nop, int idimp, int nxv,
              int nyv) {
  gpost2l_(part, q, &qm, &nop, &idimp, &nxv, &nyv);
  return;
}


x86 assembly (clang, -O0):
<cgpost2l>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
lea    -0x20(%rbp),%r9
lea    -0x24(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <gpost2l_@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgpost2l>:
sub    $0x28,%rsp
movss  %xmm0,0x24(%rsp)
mov    %edx,0x20(%rsp)
mov    %ecx,0x1c(%rsp)
mov    %r8d,0x18(%rsp)
mov    %r9d,0x14(%rsp)
lea    0x14(%rsp),%rax
mov    %rax,(%rsp)
lea    0x24(%rsp),%rdx
lea    0x20(%rsp),%rcx
lea    0x1c(%rsp),%r8
lea    0x18(%rsp),%r9
call   1030 <gpost2l_@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
define void @cgpost2l(float* %0, float* %1, float %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca float*
%9 = alloca float*
%10 = alloca float
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store float* %0, float** %8
store float* %1, float** %9
store float %2, float* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%15 = load float*, float** %8
%16 = load float*, float** %9
%17 = call i32 @gpost2l_(float* %15, float* %16, float* %10, i32* %11, i32* %12, i32* %13, i32* %14)
ret void
}

LLVM IR (-O2):
define void @cgpost2l(float* %0, float* %1, float %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca float
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store float %2, float* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
store i32 %5, i32* %11
store i32 %6, i32* %12
%13 = call i32 @gpost2l_(float* %0, float* %1, float* %8, i32* %9, i32* %10, i32* %11, i32* %12)
ret void
}
long long setBit_fun_llong(long long x, unsigned i) { return x | 1 << i; }


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

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

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

LLVM IR (-O2):
define i64 @setBit_fun_llong(i64 %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = sext i32 %3 to i64
%5 = or i64 %4, %0
ret i64 %5
}
/* Variables and functions */
int U_WMRCORENONE_get(char *);
int U_WMR69_get(void) { return U_WMRCORENONE_get("U_WMR69"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"U_WMR69\00"
define i32 @U_WMR69_get() {
%1 = call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMR69\00"
define i32 @U_WMR69_get() {
%1 = tail call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ __coverity_free__(void *);
void _freea(void *ptr) { __coverity_free__(ptr); }


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

x86 assembly (clang, -O2):
<_freea>:
jmp    1030 <__coverity_free__@plt>

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

LLVM IR (-O2):
define void @_freea(i8* %0) {
%2 = tail call i32 @__coverity_free__(i8* %0)
ret void
}
int ENTIER(statlink, a)
int *statlink;
register double a;
{
  int n;
  n = (int)a;
  return (n < 0 && (double)n != a ? n - 1 : n);
}


x86 assembly (clang, -O0):
<ENTIER>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
cvttsd2si -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1148 <ENTIER+0x48>
cvtsi2sdl -0x14(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jne    113a <ENTIER+0x3a>
jp     113a <ENTIER+0x3a>
jmp    1148 <ENTIER+0x48>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114e <ENTIER+0x4e>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ENTIER>:
cvttsd2si %xmm0,%eax
test   %eax,%eax
sets   %sil
cvttpd2dq %xmm0,%xmm1
cvtdq2pd %xmm1,%xmm1
ucomisd %xmm0,%xmm1
setp   %dl
setne  %cl
or     %dl,%cl
and    %sil,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @ENTIER(i32* %0, double %1) {
%3 = alloca i32*
%4 = alloca double
%5 = alloca i32
store i32* %0, i32** %3
store double %1, double* %4
%6 = load double, double* %4
%7 = fptosi double %6 to i32
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %2
%11 = load i32, i32* %5
%12 = sitofp i32 %11 to double
%13 = load double, double* %4
%14 = fcmp une double %12, %13
br i1 %14, label %15, label %18
15: ; preds = %10
%16 = load i32, i32* %5
%17 = sub nsw i32 %16, 1
br label %20
18: ; preds = %10, %2
%19 = load i32, i32* %5
br label %20
20: ; preds = %18, %15
%21 = phi i32 [ %17, %15 ], [ %19, %18 ]
ret i32 %21
}

LLVM IR (-O2):
define i32 @ENTIER(i32* nocapture readnone %0, double %1) {
%3 = fptosi double %1 to i32
%4 = icmp slt i32 %3, 0
%5 = sitofp i32 %3 to double
%6 = fcmp une double %5, %1
%7 = and i1 %4, %6
%8 = sext i1 %7 to i32
%9 = add nsw i32 %8, %3
ret i32 %9
}
/* Variables and functions */
int ishex(unsigned char);
int ishexorx(unsigned char c) {
  int result;
  result = 0;
  if (ishex(c) == 1)
    result = 1;
  else if (c == 'x')
    result = 1;
  return result;
}


x86 assembly (clang, -O0):
<ishexorx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x0,-0x8(%rbp)
movzbl -0x1(%rbp),%edi
call   1030 <ishex@plt>
cmp    $0x1,%eax
jne    1143 <ishexorx+0x33>
movl   $0x1,-0x8(%rbp)
jmp    115c <ishexorx+0x4c>
movzbl -0x1(%rbp),%eax
cmp    $0x78,%eax
jne    1157 <ishexorx+0x47>
movl   $0x1,-0x8(%rbp)
jmp    115c <ishexorx+0x4c>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ishexorx>:
push   %rbx
mov    %edi,%ebx
call   1030 <ishex@plt>
cmp    $0x1,%eax
sete   %al
cmp    $0x78,%bl
sete   %cl
or     %al,%cl
movzbl %cl,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ishexorx(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
store i32 0, i32* %3
%4 = load i8, i8* %2
%5 = call i32 @ishex(i8 zeroext %4)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %3
br label %14
8: ; preds = %1
%9 = load i8, i8* %2
%10 = zext i8 %9 to i32
%11 = icmp eq i32 %10, 120
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 1, i32* %3
br label %13
13: ; preds = %12, %8
br label %14
14: ; preds = %13, %7
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @ishexorx(i8 zeroext %0) {
%2 = tail call i32 @ishex(i8 zeroext %0)
%3 = icmp eq i32 %2, 1
%4 = icmp eq i8 %0, 120
%5 = or i1 %4, %3
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ pthread_self();
int /*<<< orphan*/ sleep(int);
void *say_hello(void *data) {
  int *i = data;
  while (1) {
    printf("pthread_id=%p, i=%d\n", pthread_self(), *i);
    sleep(1);
  }
out:
  return NULL;
}


x86 assembly (clang, -O0):
<say_hello>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <pthread_self@plt>
mov    %eax,%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
jmp    1144 <say_hello+0x14>

x86 assembly (clang, -O2):
<say_hello>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xec2(%rip),%r14
xchg   %ax,%ax
xor    %eax,%eax
call   1040 <pthread_self@plt>
mov    (%rbx),%edx
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
jmp    1140 <say_hello+0x10>

LLVM IR (-O0):
@.str = [21 x i8] c"pthread_id=%p, i=%d\0A\00"
define i8* @say_hello(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %3
br label %6
6: ; preds = %1, %6
%7 = call i32 (...) @pthread_self()
%8 = load i32*, i32** %3
%9 = load i32, i32* %8
%10 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %9)
%11 = call i32 @sleep(i32 1)
br label %6
12: ; No predecessors!
ret i8* null
}

LLVM IR (-O2):
@.str = [21 x i8] c"pthread_id=%p, i=%d\0A\00"
define noalias i8* @say_hello(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
br label %3
3: ; preds = %3, %1
%4 = tail call i32 (...) @pthread_self()
%5 = load i32, i32* %2
%6 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5)
%7 = tail call i32 @sleep(i32 1)
br label %3
}
char test11(void) { return '\f'; }


x86 assembly (clang, -O0):
<test11>:
push   %rbp
mov    %rsp,%rbp
mov    $0xc,%al
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test11>:
mov    $0xc,%al
ret

LLVM IR (-O0):
define signext i8 @test11() {
ret i8 12
}

LLVM IR (-O2):
define signext i8 @test11() {
ret i8 12
}
/* Variables and functions */
int /*<<< orphan*/ _HibernateWriteComplete();
void HibernateTamperUnLock(void) {
  (*((volatile unsigned long *)(0x400FC360))) = 0xA3359554;
  _HibernateWriteComplete();
}


x86 assembly (clang, -O0):
<HibernateTamperUnLock>:
push   %rbp
mov    %rsp,%rbp
mov    $0x400fc360,%eax
mov    $0xa3359554,%ecx
mov    %rcx,(%rax)
mov    $0x0,%al
call   1030 <_HibernateWriteComplete@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<HibernateTamperUnLock>:
mov    $0xa3359554,%eax
mov    %rax,0x400fc360
40
xor    %eax,%eax
jmp    1030 <_HibernateWriteComplete@plt>

LLVM IR (-O0):
define void @HibernateTamperUnLock() {
store volatile i64 2738197844, i64* inttoptr (i64 1074774880 to i64*)
%1 = call i32 (...) @_HibernateWriteComplete()
ret void
}

LLVM IR (-O2):
define void @HibernateTamperUnLock() {
store volatile i64 2738197844, i64* inttoptr (i64 1074774880 to i64*)
%1 = tail call i32 (...) @_HibernateWriteComplete()
ret void
}
/* Type definitions */
typedef size_t uint32_t;

/* Variables and functions */
uint32_t f2m_is_equal(uint32_t t, uint32_t *A, uint32_t *B) {
  uint32_t i;
  for (i = 0; i < t; i++)
    if (A[i] != B[i])
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<f2m_is_equal>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1167 <f2m_is_equal+0x67>
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%rdx
cmp    (%rcx,%rdx,8),%rax
je     1151 <f2m_is_equal+0x51>
movq   $0x0,-0x8(%rbp)
jmp    116f <f2m_is_equal+0x6f>
jmp    1156 <f2m_is_equal+0x56>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1118 <f2m_is_equal+0x18>
movq   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2m_is_equal>:
mov    $0x1,%eax
test   %rdi,%rdi
je     1123 <f2m_is_equal+0x23>
xor    %r8d,%r8d
nopl   (%rax)
mov    (%rsi,%r8,8),%rcx
cmp    (%rdx,%r8,8),%rcx
jne    1124 <f2m_is_equal+0x24>
add    $0x1,%r8
cmp    %r8,%rdi
jne    1110 <f2m_is_equal+0x10>
ret
xor    %eax,%eax
ret

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

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


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

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

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

LLVM IR (-O2):
define void @LK_DWT_Enable() {
ret void
}
/* Variables and functions */
int extrafunction();
int main(int argc, char **argv) { return extrafunction(); }


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)
mov    $0x0,%al
call   1030 <extrafunction@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @extrafunction()
ret i32 %6
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @extrafunction()
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ abc();
int /*<<< orphan*/ puts(char *);
int main(void) {
  puts("Hello closed-source!");
  abc();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1040 <abc@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [21 x i8] c"Hello closed-source!\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @puts(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @abc()
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"Hello closed-source!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @abc()
ret i32 0
}
int test_imm_E5uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0xE5 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_E5uint64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
shr    $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_E5uint64_midword_reg>:
test   $0xe50000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_E5uint64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 16
%5 = and i64 %4, 229
%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_E5uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 15007744
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int u_int;
typedef int u_char;

/* Variables and functions */
u_int get2bytes(u_char *buf) {
  u_int ret;
  ret = buf[0] << 8;
  ret |= buf[1];
  return ret;
}


x86 assembly (clang, -O0):
<get2bytes>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
shl    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get2bytes>:
mov    (%rdi),%eax
shl    $0x8,%eax
or     0x4(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @get2bytes(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = getelementptr inbounds i32, i32* %4, i64 0
%6 = load i32, i32* %5
%7 = shl i32 %6, 8
store i32 %7, i32* %3
%8 = load i32*, i32** %2
%9 = getelementptr inbounds i32, i32* %8, i64 1
%10 = load i32, i32* %9
%11 = load i32, i32* %3
%12 = or i32 %11, %10
store i32 %12, i32* %3
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @get2bytes(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = shl i32 %2, 8
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = or i32 %3, %5
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;
struct serializer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ s_wb64(struct serializer *, int /*<<< orphan*/);
void s_wbd(struct serializer *s, double d) {
  s_wb64(s, *(uint64_t *)&d);
  return;
}


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

x86 assembly (clang, -O2):
<s_wbd>:
movq   %xmm0,%rsi
jmp    1030 <s_wb64@plt>

LLVM IR (-O0):
%struct.serializer = type { i32 }
define void @s_wbd(%struct.serializer* %0, double %1) {
%3 = alloca %struct.serializer*
%4 = alloca double
store %struct.serializer* %0, %struct.serializer** %3
store double %1, double* %4
%5 = load %struct.serializer*, %struct.serializer** %3
%6 = bitcast double* %4 to i32*
%7 = load i32, i32* %6
%8 = call i32 @s_wb64(%struct.serializer* %5, i32 %7)
ret void
}

LLVM IR (-O2):
%struct.serializer = type { i32 }
define void @s_wbd(%struct.serializer* %0, double %1) {
%3 = bitcast double %1 to i64
%4 = trunc i64 %3 to i32
%5 = tail call i32 @s_wb64(%struct.serializer* %0, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int f();
int main() {
  if (f() != 16)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <f@plt>
cmp    $0x10,%eax
je     1156 <main+0x26>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <f@plt>
cmp    $0x10,%eax
jne    1144 <main+0x14>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @f()
%3 = icmp ne i32 %2, 16
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @f()
%2 = icmp eq i32 %1, 16
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
uint8_t dummy_u8(void) { return 0; }


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

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

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

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

/* Variables and functions */
char *malloc(scalar_t__);
int /*<<< orphan*/ strcpy_wchar_to_char(char *, int /*<<< orphan*/ const *);
scalar_t__ wcslen(int /*<<< orphan*/ const *);
char *strdup_wchar_to_char(const wchar_t *src) {
  char *dst = malloc((wcslen(src) + 1));
  if (!dst)
    return NULL;
  strcpy_wchar_to_char(dst, src);
  return dst;
}


x86 assembly (clang, -O0):
<strdup_wchar_to_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <wcslen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    116d <strdup_wchar_to_char+0x3d>
movq   $0x0,-0x8(%rbp)
jmp    1182 <strdup_wchar_to_char+0x52>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcpy_wchar_to_char@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup_wchar_to_char>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <wcslen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1158 <strdup_wchar_to_char+0x28>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcpy_wchar_to_char@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strdup_wchar_to_char(i32* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
%5 = load i32*, i32** %3
%6 = call i64 @wcslen(i32* %5)
%7 = add nsw i64 %6, 1
%8 = call i8* @malloc(i64 %7)
store i8* %8, i8** %4
%9 = load i8*, i8** %4
%10 = icmp ne i8* %9, null
br i1 %10, label %12, label %11
11: ; preds = %1
store i8* null, i8** %2
br label %17
12: ; preds = %1
%13 = load i8*, i8** %4
%14 = load i32*, i32** %3
%15 = call i32 @strcpy_wchar_to_char(i8* %13, i32* %14)
%16 = load i8*, i8** %4
store i8* %16, i8** %2
br label %17
17: ; preds = %12, %11
%18 = load i8*, i8** %2
ret i8* %18
}

LLVM IR (-O2):
define i8* @strdup_wchar_to_char(i32* %0) {
%2 = tail call i64 @wcslen(i32* %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @strcpy_wchar_to_char(i8* %4, i32* %0)
br label %8
8: ; preds = %1, %6
ret i8* %4
}
/* Variables and functions */
int sancus_get_drll(long long, long long, long long, int *);
scalar_t__ sancus_get_lls(char const *, long long *);
bool sancus_get_drlls(const char *s, long long a, long long b, int *out) {
  long long v;
  bool ret = false;
  if (sancus_get_lls(s, &v))
    ret = sancus_get_drll(v, a, b, out);
  return ret;
}


x86 assembly (clang, -O0):
<sancus_get_drlls>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <sancus_get_lls@plt>
cmp    $0x0,%rax
je     116e <sancus_get_drlls+0x4e>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <sancus_get_drll@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sancus_get_drlls>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
lea    0x8(%rsp),%rsi
call   1040 <sancus_get_lls@plt>
test   %rax,%rax
je     1156 <sancus_get_drlls+0x36>
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
call   1030 <sancus_get_drll@plt>
jmp    1158 <sancus_get_drlls+0x38>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @sancus_get_drlls(i8* %0, i64 %1, i64 %2, i32* %3) {
%5 = alloca i64
%6 = bitcast i64* %5 to i8*
%7 = call i64 @sancus_get_lls(i8* %0, i64* %5)
%8 = icmp eq i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = load i64, i64* %5
%11 = call i32 @sancus_get_drll(i64 %10, i64 %1, i64 %2, i32* %3)
br label %12
12: ; preds = %9, %4
%13 = phi i32 [ %11, %9 ], [ 0, %4 ]
ret i32 %13
}
void uart_send_byte(char ch) {
  while (!((*(volatile unsigned long *)(0x50000000 + 0x10)) & 4))
    ;
  (*(volatile unsigned long *)(0x50000000 + 0x20)) = ch;
}


x86 assembly (clang, -O0):
<uart_send_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x50000010,%eax
mov    (%rax),%rax
and    $0x4,%rax
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    112c <uart_send_byte+0x2c>
jmp    1131 <uart_send_byte+0x31>
jmp    110a <uart_send_byte+0xa>
movsbq -0x1(%rbp),%rcx
mov    $0x50000020,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_send_byte>:
testq  $0x4,0x50000010
je     1100 <uart_send_byte>
movsbq %dil,%rax
mov    %rax,0x50000020
50
ret

LLVM IR (-O0):
define void @uart_send_byte(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
br label %3
3: ; preds = %8, %1
%4 = load volatile i64, i64* inttoptr (i64 1342177296 to i64*)
%5 = and i64 %4, 4
%6 = icmp ne i64 %5, 0
%7 = xor i1 %6, true
br i1 %7, label %8, label %9
8: ; preds = %3
br label %3
9: ; preds = %3
%10 = load i8, i8* %2
%11 = sext i8 %10 to i64
store volatile i64 %11, i64* inttoptr (i64 1342177312 to i64*)
ret void
}

LLVM IR (-O2):
define void @uart_send_byte(i8 signext %0) {
br label %2
2: ; preds = %2, %1
%3 = load volatile i64, i64* inttoptr (i64 1342177296 to i64*)
%4 = and i64 %3, 4
%5 = icmp eq i64 %4, 0
br i1 %5, label %2, label %6
6: ; preds = %2
%7 = sext i8 %0 to i64
store volatile i64 %7, i64* inttoptr (i64 1342177312 to i64*)
ret void
}
int test_imm_3Cuint16_reg(unsigned short val) {
  return ((val) & (-0x3C << 0)) ? -20 : -40;
}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ file64_to_cpu(int /*<<< orphan*/);
uint64_t struct_val_u64(char *ptr, unsigned int offset) {
  return (file64_to_cpu(*(uint64_t *)(ptr + offset)));
}


x86 assembly (clang, -O0):
<struct_val_u64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    (%rax,%rcx,1),%edi
call   1030 <file64_to_cpu@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<struct_val_u64>:
mov    %esi,%eax
mov    (%rdi,%rax,1),%edi
jmp    1030 <file64_to_cpu@plt>

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

LLVM IR (-O2):
define i32 @struct_val_u64(i8* nocapture %0, i32 %1) {
%3 = zext i32 %1 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = bitcast i8* %4 to i32*
%6 = load i32, i32* %5
%7 = tail call i32 @file64_to_cpu(i32 %6)
ret i32 %7
}
void __trace_call__(const char *msg, ...) {}


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

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

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

LLVM IR (-O2):
define void @__trace_call__(i8* nocapture %0, ...) {
ret void
}
int f(int x) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @f(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ cp_n();
void opcode_fe() { cp_n(); }


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

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

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

LLVM IR (-O2):
define void @opcode_fe() {
%1 = tail call i32 (...) @cp_n()
ret void
}
/* Variables and functions */
int errno;
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sleep(int);
void *thr_func(void *arg) {
  while (1) {
    errno = 5;
    sleep(3);
    printf("     errno = %d\n", errno);
  }
}


x86 assembly (clang, -O0):
<thr_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
movl   $0x5,(%rax)
mov    $0x3,%edi
call   1040 <sleep@plt>
mov    0x2e96(%rip),%rax
mov    (%rax),%esi
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
jmp    112c <thr_func+0xc>

x86 assembly (clang, -O2):
<thr_func>:
push   %r14
push   %rbx
push   %rax
mov    0x2eb5(%rip),%rbx
lea    0xece(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movl   $0x5,(%rbx)
mov    $0x3,%edi
call   1040 <sleep@plt>
mov    (%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
jmp    1140 <thr_func+0x20>

LLVM IR (-O0):
@errno = global i32 0
@.str = [17 x i8] c" errno = %d\0A\00"
define i8* @thr_func(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %1, %3
store i32 5, i32* @errno
%4 = call i32 @sleep(i32 3)
%5 = load i32, i32* @errno
%6 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %3
}

LLVM IR (-O2):
@errno = global i32 0
@.str = [17 x i8] c" errno = %d\0A\00"
define noalias i8* @thr_func(i8* nocapture readnone %0) {
br label %2
2: ; preds = %1, %2
store i32 5, i32* @errno
%3 = tail call i32 @sleep(i32 3)
%4 = load i32, i32* @errno
%5 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %2
}
/* Variables and functions */
int count_matches(const char *s1, char c) {
  const char *ptr = s1;
  int n = 0;
  do {
    if (*ptr == c)
      n++;
  } while (*(ptr++));
  return n;
}


x86 assembly (clang, -O0):
<count_matches>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1139 <count_matches+0x39>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113e <count_matches+0x3e>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
cmpb   $0x0,(%rax)
jne    111d <count_matches+0x1d>
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_matches>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rdi),%ecx
xor    %edx,%edx
cmp    %sil,%cl
sete   %dl
add    %edx,%eax
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <count_matches+0x10>
ret

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

LLVM IR (-O2):
define i32 @count_matches(i8* nocapture %0, i8 signext %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %10, %3 ]
%5 = phi i32 [ 0, %2 ], [ %9, %3 ]
%6 = load i8, i8* %4
%7 = icmp eq i8 %6, %1
%8 = zext i1 %7 to i32
%9 = add nuw nsw i32 %5, %8
%10 = getelementptr inbounds i8, i8* %4, i64 1
%11 = icmp eq i8 %6, 0
br i1 %11, label %12, label %3
12: ; preds = %3
ret i32 %9
}
void x_loop(void) {}


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

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

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

LLVM IR (-O2):
define void @x_loop() {
ret void
}
int main() {
  int arg = 0xA0000000;
  int out1 = 0;
  int out2 = 0;
  __asm__("movl %2, %0; movl %2, %1;" : "=m"(out1), "=m"(out2) : "r"(arg));
  return (arg == out1) && (arg == out2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0xa0000000,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%ecx
xor    %eax,%eax
cmp    -0xc(%rbp),%ecx
mov    %al,-0x11(%rbp)
jne    1146 <main+0x46>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
movl   $0x0,-0x4(%rsp)
movl   $0x0,-0x8(%rsp)
mov    $0xa0000000,%ecx
mov    %ecx,-0x4(%rsp)
mov    %ecx,-0x8(%rsp)
mov    -0x4(%rsp),%edx
xor    %ecx,%edx
xor    -0x8(%rsp),%ecx
xor    %eax,%eax
or     %edx,%ecx
sete   %al
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 -1610612736, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
%5 = load i32, i32* %2
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = icmp eq i32 %6, %7
br i1 %8, label %9, label %13
9: ; preds = %0
%10 = load i32, i32* %2
%11 = load i32, i32* %4
%12 = icmp eq i32 %10, %11
br label %13
13: ; preds = %9, %0
%14 = phi i1 [ false, %0 ], [ %12, %9 ]
%15 = zext i1 %14 to i32
ret i32 %15
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, -1610612736
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, -1610612736
%9 = select i1 %6, i1 %8, i1 false
%10 = zext i1 %9 to i32
ret i32 %10
}
int test_imm_BDuint8_mem(unsigned char *val) {
  return ((*val) & (-0xBD << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_BDuint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, -189
%7 = icmp ne i32 %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_BDuint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 67
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}