xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ json_value_free(void *);
void weibo_map_func_post(void *data) { json_value_free(data); }


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

x86 assembly (clang, -O2):
<weibo_map_func_post>:
jmp    1030 <json_value_free@plt>

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

LLVM IR (-O2):
define void @weibo_map_func_post(i8* %0) {
%2 = tail call i32 @json_value_free(i8* %0)
ret void
}
/* Variables and functions */
int my_putdouble_base(double, int);
int my_putdouble(double f) { return my_putdouble_base(f, 10); }


x86 assembly (clang, -O0):
<my_putdouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0xa,%edi
call   1030 <my_putdouble_base@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_putdouble>:
mov    $0xa,%edi
jmp    1030 <my_putdouble_base@plt>

LLVM IR (-O0):
define i32 @my_putdouble(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @my_putdouble_base(double %3, i32 10)
ret i32 %4
}

LLVM IR (-O2):
define i32 @my_putdouble(double %0) {
%2 = tail call i32 @my_putdouble_base(double %0, i32 10)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
uint8_t readint8(char *buf) { return *(uint8_t *)buf; }


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

x86 assembly (clang, -O2):
<readint8>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @readint8(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @readint8(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
/* Variables and functions */
double snorm();
void snormal_rndc(int n, double *randvec) {
  int i;
  for (i = 0; i < n; i++)
    randvec[i] = snorm();
}


x86 assembly (clang, -O0):
<snormal_rndc>:
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    1154 <snormal_rndc+0x44>
mov    $0x0,%al
call   1030 <snorm@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <snormal_rndc+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<snormal_rndc>:
push   %r15
push   %r14
push   %rbx
test   %edi,%edi
jle    1146 <snormal_rndc+0x36>
mov    %rsi,%r14
mov    %edi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <snorm@plt>
movsd  %xmm0,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <snormal_rndc+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @snormal_rndc(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca i32
store i32 %0, i32* %3
store double* %1, double** %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 = call double (...) @snorm()
%12 = load double*, double** %4
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds double, double* %12, i64 %14
store double %11, double* %15
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
ret void
}

LLVM IR (-O2):
define void @snormal_rndc(i32 %0, double* nocapture writeonly %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %12
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %10, %6 ]
%8 = tail call double (...) @snorm()
%9 = getelementptr inbounds double, double* %1, i64 %7
store double %8, double* %9
%10 = add nuw nsw i64 %7, 1
%11 = icmp eq i64 %10, %5
br i1 %11, label %12, label %6
12: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ permutar(int /*<<< orphan*/, int, int *);
long enum_permut(int n, int *v) { permutar(0, n, v); }


x86 assembly (clang, -O0):
<enum_permut>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
xor    %edi,%edi
call   1030 <permutar@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enum_permut>:
mov    %rsi,%rdx
mov    %edi,%esi
xor    %edi,%edi
jmp    1030 <permutar@plt>

LLVM IR (-O0):
define i64 @enum_permut(i32 %0, i32* %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32*
store i32 %0, i32* %4
store i32* %1, i32** %5
%6 = load i32, i32* %4
%7 = load i32*, i32** %5
%8 = call i32 @permutar(i32 0, i32 %6, i32* %7)
%9 = load i64, i64* %3
ret i64 %9
}

LLVM IR (-O2):
define i64 @enum_permut(i32 %0, i32* %1) {
%3 = tail call i32 @permutar(i32 0, i32 %0, i32* %1)
ret i64 undef
}
int vpx_mem_unset_functions() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @vpx_mem_unset_functions() {
ret i32 0
}
unsigned int _check_times(unsigned x, unsigned y) {
  unsigned long long whole_ans =
      ((unsigned long long)x) * ((unsigned long long)y);
  unsigned word_ans = (unsigned)whole_ans;
  if (word_ans < whole_ans || word_ans > (1 << 28))
    (_throw_badalloc_fn("/scratch/repos/new/home/jordi_armengol_estape/"
                        "c-scraper/outputs/2022-01-22/02-19-57/repos/FauxFaux/"
                        "cyclone/refs/heads/master/bin/genfiles/evexp.c",
                        284));
  return word_ans;
}


x86 assembly (clang, -O0):
<_check_times>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
imul   %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%rax
jb     114d <_check_times+0x3d>
cmpl   $0x10000000,-0x14(%rbp)
jbe    1160 <_check_times+0x50>
lea    0xeac(%rip),%rdi
mov    $0x11c,%esi
mov    $0x0,%al
call   1030 <_throw_badalloc_fn@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_check_times>:
push   %rbx
mov    %edi,%eax
mul    %esi
mov    %eax,%ebx
jo     1121 <_check_times+0x11>
cmp    $0x10000001,%ebx
jb     1134 <_check_times+0x24>
lea    0xed8(%rip),%rdi
mov    $0x11c,%esi
xor    %eax,%eax
call   1030 <_throw_badalloc_fn@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [146 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/FauxFaux/cyclone/refs/heads/master/bin/genfiles/evexp.c\00"
define i32 @_check_times(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = zext i32 %7 to i64
%9 = load i32, i32* %4
%10 = zext i32 %9 to i64
%11 = mul i64 %8, %10
store i64 %11, i64* %5
%12 = load i64, i64* %5
%13 = trunc i64 %12 to i32
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = zext i32 %14 to i64
%16 = load i64, i64* %5
%17 = icmp ult i64 %15, %16
br i1 %17, label %21, label %18
18: ; preds = %2
%19 = load i32, i32* %6
%20 = icmp ugt i32 %19, 268435456
br i1 %20, label %21, label %23
21: ; preds = %18, %2
%22 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @_throw_badalloc_fn to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str, i64 0, i64 0), i32 284)
br label %23
23: ; preds = %21, %18
%24 = load i32, i32* %6
ret i32 %24
}

LLVM IR (-O2):
@.str = [146 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/FauxFaux/cyclone/refs/heads/master/bin/genfiles/evexp.c\00"
define i32 @_check_times(i32 %0, i32 %1) {
%3 = tail call { i32, i1 } @llvm.umul.with.overflow.i32(i32 %0, i32 %1)
%4 = extractvalue { i32, i1 } %3, 0
%5 = extractvalue { i32, i1 } %3, 1
%6 = icmp ugt i32 %4, 268435456
%7 = or i1 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @_throw_badalloc_fn to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str, i64 0, i64 0), i32 284)
br label %10
10: ; preds = %2, %8
ret i32 %4
}
void ARGBExtractAlphaRow_SSE2() {}


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

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

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

LLVM IR (-O2):
define void @ARGBExtractAlphaRow_SSE2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
void expects(short a, short b) {
  if (!(a == b)) {
    printf("Failed\n");
    printf("  %d expected, but got %d\n", a, b);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<expects>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
movswl -0x2(%rbp),%eax
movswl -0x4(%rbp),%ecx
cmp    %ecx,%eax
je     1174 <expects+0x54>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movswl -0x2(%rbp),%esi
movswl -0x4(%rbp),%edx
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expects>:
cmp    %si,%di
jne    1136 <expects+0x6>
ret
push   %rbp
push   %rbx
push   %rax
movswl %si,%ebx
movswl %di,%ebp
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
lea    0xeae(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"Failed\0A\00"
@.str.1 = [27 x i8] c" %d expected, but got %d\0A\00"
define void @expects(i16 signext %0, i16 signext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
%6 = sext i16 %5 to i32
%7 = load i16, i16* %4
%8 = sext i16 %7 to i32
%9 = icmp eq i32 %6, %8
br i1 %9, label %18, label %10
10: ; preds = %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%12 = load i16, i16* %3
%13 = sext i16 %12 to i32
%14 = load i16, i16* %4
%15 = sext i16 %14 to i32
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %13, i32 %15)
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str.1 = [27 x i8] c" %d expected, but got %d\0A\00"
@str = [7 x i8] c"Failed\00"
define void @expects(i16 signext %0, i16 signext %1) {
%3 = icmp eq i16 %0, %1
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = sext i16 %1 to i32
%6 = sext i16 %0 to i32
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %6, i32 %5)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
ret void
}
/* Type definitions */
struct castable {
  int dummy;
};

/* Variables and functions */
int hash_ptr(struct castable *);
int hash_castable(struct castable *castable) { return hash_ptr(castable); }


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

x86 assembly (clang, -O2):
<hash_castable>:
jmp    1030 <hash_ptr@plt>

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

LLVM IR (-O2):
%struct.castable = type { i32 }
define i32 @hash_castable(%struct.castable* %0) {
%2 = tail call i32 @hash_ptr(%struct.castable* %0)
ret i32 %2
}
double nan(const char *tag) {
  return ({
    extern __typeof__(nan) module_libc_nan;
    &module_libc_nan;
  })(tag);
}


x86 assembly (clang, -O0):
<nan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ed5(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdi
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nan>:
jmp    1030 <module_libc_nan@plt>

LLVM IR (-O0):
define double @nan(i8* %0) {
%2 = alloca i8*
%3 = alloca double (i8*)*
store i8* %0, i8** %2
store double (i8*)* @module_libc_nan, double (i8*)** %3
%4 = load double (i8*)*, double (i8*)** %3
%5 = load i8*, i8** %2
%6 = call double %4(i8* %5)
ret double %6
}

LLVM IR (-O2):
define double @nan(i8* %0) {
%2 = tail call double @module_libc_nan(i8* %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *const);
void die(char *const str) {
  perror(str);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rax
call   1030 <perror@plt>
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
define void @die(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = load i32, i32* @EXIT_FAILURE
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define void @die(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ EX_SOFTWARE;
int /*<<< orphan*/ pfpanic(char *, unsigned short, unsigned short, char const *,
                           char const *, int, int, int /*<<< orphan*/);
void __pfpanic_sigmask(unsigned short _syslog, unsigned short _verbose,
                       const char *_function_name, const char *_file_name,
                       int _line_number, int _errno) {
  pfpanic("Unable to manipulate sigmask", _syslog, _verbose, _function_name,
          _file_name, _line_number, _errno, EX_SOFTWARE);
}


x86 assembly (clang, -O0):
<__pfpanic_sigmask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %si,%ax
mov    %di,%si
mov    %si,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0x2(%rbp),%si
mov    -0x4(%rbp),%dx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x1c(%rbp),%r9d
mov    -0x20(%rbp),%r10d
mov    0x2e8b(%rip),%rax
mov    (%rax),%eax
lea    0xea2(%rip),%rdi
movzwl %si,%esi
movzwl %dx,%edx
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <pfpanic@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__pfpanic_sigmask>:
push   %rax
mov    %r9d,%r10d
mov    %r8d,%r9d
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %esi,%edx
mov    %edi,%esi
mov    0x2eb8(%rip),%rdi
mov    (%rdi),%eax
lea    0xecf(%rip),%rdi
push   %rax
push   %r10
call   1030 <pfpanic@plt>
add    $0x10,%rsp
pop    %rax
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Unable to manipulate sigmask\00"
@EX_SOFTWARE = global i32 0
define void @__pfpanic_sigmask(i16 zeroext %0, i16 zeroext %1, i8* %2, i8* %3, i32 %4, i32 %5) {
%7 = alloca i16
%8 = alloca i16
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
store i16 %0, i16* %7
store i16 %1, i16* %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = load i16, i16* %7
%14 = load i16, i16* %8
%15 = load i8*, i8** %9
%16 = load i8*, i8** %10
%17 = load i32, i32* %11
%18 = load i32, i32* %12
%19 = load i32, i32* @EX_SOFTWARE
%20 = call i32 @pfpanic(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i16 zeroext %13, i16 zeroext %14, i8* %15, i8* %16, i32 %17, i32 %18, i32 %19)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"Unable to manipulate sigmask\00"
@EX_SOFTWARE = global i32 0
define void @__pfpanic_sigmask(i16 zeroext %0, i16 zeroext %1, i8* %2, i8* %3, i32 %4, i32 %5) {
%7 = load i32, i32* @EX_SOFTWARE
%8 = tail call i32 @pfpanic(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i16 zeroext %0, i16 zeroext %1, i8* %2, i8* %3, i32 %4, i32 %5, i32 %7)
ret void
}
unsigned char bcd2bin(unsigned char bcd) {
  return (bcd & 0xf) + (bcd >> 4) * 10;
}


x86 assembly (clang, -O0):
<bcd2bin>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0xf,%eax
movzbl -0x1(%rbp),%ecx
sar    $0x4,%ecx
imul   $0xa,%ecx,%ecx
add    %ecx,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bcd2bin>:
mov    %edi,%ecx
and    $0xf,%cl
shr    $0x4,%dil
movzbl %dil,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
add    %cl,%al
ret

LLVM IR (-O0):
define zeroext i8 @bcd2bin(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 15
%6 = load i8, i8* %2
%7 = zext i8 %6 to i32
%8 = ashr i32 %7, 4
%9 = mul nsw i32 %8, 10
%10 = add nsw i32 %5, %9
%11 = trunc i32 %10 to i8
ret i8 %11
}

LLVM IR (-O2):
define zeroext i8 @bcd2bin(i8 zeroext %0) {
%2 = and i8 %0, 15
%3 = lshr i8 %0, 4
%4 = mul nuw i8 %3, 10
%5 = add nuw i8 %4, %2
ret i8 %5
}
void reset(char *message, int size) {
  int i;
  for (i = 0; i < size; i++) {
    message[i] = '\0';
  }
}


x86 assembly (clang, -O0):
<reset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1138 <reset+0x38>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <reset+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<reset>:
test   %esi,%esi
jle    1122 <reset+0x12>
push   %rax
mov    %esi,%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @reset(i8* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ clearerr(int /*<<< orphan*/ *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
void nocrash_clearerr() {
  FILE *f;
  f = fopen("this_file_doesnt_exist", "r");
  if (f) {
    clearerr(f);
    fclose(f);
  }
}


x86 assembly (clang, -O0):
<nocrash_clearerr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xed1(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     116c <nocrash_clearerr+0x3c>
mov    -0x8(%rbp),%rdi
call   1040 <clearerr@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nocrash_clearerr>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xed8(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     115d <nocrash_clearerr+0x2d>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <clearerr@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <fclose@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"this_file_doesnt_exist\00"
@.str.1 = [2 x i8] c"r\00"
define void @nocrash_clearerr() {
%1 = alloca i32*
%2 = call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = icmp ne i32* %3, null
br i1 %4, label %5, label %10
5: ; preds = %0
%6 = load i32*, i32** %1
%7 = call i32 @clearerr(i32* %6)
%8 = load i32*, i32** %1
%9 = call i32 @fclose(i32* %8)
br label %10
10: ; preds = %5, %0
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"this_file_doesnt_exist\00"
@.str.1 = [2 x i8] c"r\00"
define void @nocrash_clearerr() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = tail call i32 @clearerr(i32* %1)
%5 = tail call i32 @fclose(i32* %1)
br label %6
6: ; preds = %3, %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M246_f(char *s) {
  debug("M246_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M246_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M246_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M246_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M246_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M246_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M246_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
double createDouble(double intNeg, double intValue, double frcValue,
                    int frcDecimalCount) {
  static const double g_pow10[] = {1,         10,        100,     1000,
                                   10000,     100000,    1000000, 10000000,
                                   100000000, 1000000000};
  return (intValue + (frcValue / g_pow10[frcDecimalCount])) * intNeg;
}


x86 assembly (clang, -O0):
<createDouble>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movslq -0x1c(%rbp),%rcx
lea    0xed5(%rip),%rax
divsd  (%rax,%rcx,8),%xmm1
addsd  %xmm1,%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<createDouble>:
movslq %edi,%rax
lea    0xef6(%rip),%rcx
divsd  (%rcx,%rax,8),%xmm2
addsd  %xmm1,%xmm2
mulsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
@createDouble.g_pow10 = internal constant [10 x double] [double 1.000000e+00, double 1.000000e+01, double 1.000000e+02, double 1.000000e+03, double 1.000000e+04, double 1.000000e+05, double 1.000000e+06, double 1.000000e+07, double 1.000000e+08, double 1.000000e+09]
define double @createDouble(double %0, double %1, double %2, i32 %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca i32
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store i32 %3, i32* %8
%9 = load double, double* %6
%10 = load double, double* %7
%11 = load i32, i32* %8
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [10 x double], [10 x double]* @createDouble.g_pow10, i64 0, i64 %12
%14 = load double, double* %13
%15 = fdiv double %10, %14
%16 = fadd double %9, %15
%17 = load double, double* %5
%18 = fmul double %16, %17
ret double %18
}

LLVM IR (-O2):
@createDouble.g_pow10 = internal unnamed_addr constant [10 x double] [double 1.000000e+00, double 1.000000e+01, double 1.000000e+02, double 1.000000e+03, double 1.000000e+04, double 1.000000e+05, double 1.000000e+06, double 1.000000e+07, double 1.000000e+08, double 1.000000e+09]
define double @createDouble(double %0, double %1, double %2, i32 %3) {
%5 = sext i32 %3 to i64
%6 = getelementptr inbounds [10 x double], [10 x double]* @createDouble.g_pow10, i64 0, i64 %5
%7 = load double, double* %6
%8 = fdiv double %2, %7
%9 = fadd double %8, %1
%10 = fmul double %9, %0
ret double %10
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
uint64_t minimum_uint64(uint64_t a, uint64_t b) { return (a < b) ? a : b; }


x86 assembly (clang, -O0):
<minimum_uint64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1127 <minimum_uint64+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <minimum_uint64+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<minimum_uint64>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovl  %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @minimum_uint64(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
void swap_str_ptrs(char **arg1, char **arg2) {
  char *tmp = *arg1;
  *arg1 = *arg2;
  *arg2 = tmp;
}


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

x86 assembly (clang, -O2):
<swap_str_ptrs>:
mov    (%rdi),%rax
mov    (%rsi),%rcx
mov    %rcx,(%rdi)
mov    %rax,(%rsi)
ret

LLVM IR (-O0):
define void @swap_str_ptrs(i8** %0, i8** %1) {
%3 = alloca i8**
%4 = alloca i8**
%5 = alloca i8*
store i8** %0, i8*** %3
store i8** %1, i8*** %4
%6 = load i8**, i8*** %3
%7 = load i8*, i8** %6
store i8* %7, i8** %5
%8 = load i8**, i8*** %4
%9 = load i8*, i8** %8
%10 = load i8**, i8*** %3
store i8* %9, i8** %10
%11 = load i8*, i8** %5
%12 = load i8**, i8*** %4
store i8* %11, i8** %12
ret void
}

LLVM IR (-O2):
define void @swap_str_ptrs(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8*, i8** %1
store i8* %4, i8** %0
store i8* %3, i8** %1
ret void
}
/* Variables and functions */
size_t ptr__ix(void const *const ptr) {
  return (size_t)((((uintptr_t)ptr) >> ((sizeof(uintptr_t) * 8ULL) / 2)) &
                  ((uintptr_t)(~((uintptr_t)((
                      uintptr_t)(((uintptr_t)((0xFULL
                                               << ((sizeof(uintptr_t) * 8ULL) -
                                                   4ULL)) |
                                              ((0x1ULL
                                                << ((sizeof(uintptr_t) * 8ULL) -
                                                    1ULL)) -
                                               1ULL)))
                                 << ((sizeof(uintptr_t) * 8ULL) / 2)))))));
}


x86 assembly (clang, -O0):
<ptr__ix>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x20,%rax
movabs $0xffffffff,%rcx
and    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ptr__ix>:
mov    %rdi,%rax
shr    $0x20,%rax
ret

LLVM IR (-O0):
define i64 @ptr__ix(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i64
%5 = lshr i64 %4, 32
%6 = and i64 %5, 4294967295
ret i64 %6
}

LLVM IR (-O2):
define i64 @ptr__ix(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = lshr i64 %2, 32
ret i64 %3
}
void io_wq_worker_sleeping(struct task_struct *tsk) {}


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

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

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

LLVM IR (-O2):
%struct.task_struct = type opaque
define void @io_wq_worker_sleeping(%struct.task_struct* nocapture %0) {
ret void
}
/* Variables and functions */
size_t rnd(int);
char death_monst() {
  static char poss[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
                        'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
                        'W', 'X', 'Y', 'Z', 'a', 'b', 'h', 'd', 's', ' '};
  return poss[rnd(sizeof poss / sizeof(char))];
}


x86 assembly (clang, -O0):
<death_monst>:
push   %rbp
mov    %rsp,%rbp
mov    $0x20,%edi
call   1030 <rnd@plt>
mov    %rax,%rcx
lea    0x2f08(%rip),%rax
movsbl (%rax,%rcx,1),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<death_monst>:
push   %rax
mov    $0x20,%edi
call   1030 <rnd@plt>
lea    0xede(%rip),%rcx
mov    (%rax,%rcx,1),%al
pop    %rcx
ret

LLVM IR (-O0):
@death_monst.poss = internal global [32 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZabhds "
define signext i8 @death_monst() {
%1 = call i64 @rnd(i32 32)
%2 = getelementptr inbounds [32 x i8], [32 x i8]* @death_monst.poss, i64 0, i64 %1
%3 = load i8, i8* %2
ret i8 %3
}

LLVM IR (-O2):
@death_monst.poss = internal unnamed_addr constant [32 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZabhds "
define signext i8 @death_monst() {
%1 = tail call i64 @rnd(i32 32)
%2 = getelementptr inbounds [32 x i8], [32 x i8]* @death_monst.poss, i64 0, i64 %1
%3 = load i8, i8* %2
ret i8 %3
}
/* Variables and functions */
char *U_WMRCORENONE_set(char *);
char *U_WMRCF_set(void) { return U_WMRCORENONE_set("U_WMRCF"); }


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

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMRCF\00"
define i8* @U_WMRCF_set() {
%1 = tail call i8* @U_WMRCORENONE_set(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}
/* Variables and functions */
void *compare_float_context(void) { return NULL; }


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

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

LLVM IR (-O0):
define i8* @compare_float_context() {
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @compare_float_context() {
ret i8* null
}
int test_imm_90uint16_mem(unsigned short *val) {
  return ((*val) & (-0x90 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_90uint16_mem>:
movzwl (%rdi),%eax
test   $0xff70,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_90uint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, -144
%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_90uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -144
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int getchar();
int /*<<< orphan*/ system(char *);
int main() {
  int c;
  system("stty raw");
  c = getchar();
  system("stty cooked");
  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 <system@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
lea    0xebd(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [9 x i8] c"stty raw\00"
@.str.1 = [12 x i8] c"stty cooked\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @system(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @getchar()
store i32 %4, i32* %2
%5 = call i32 @system(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"stty raw\00"
@.str.1 = [12 x i8] c"stty cooked\00"
define i32 @main() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @getchar()
%3 = tail call i32 @system(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Sync();
void StateRestore(int version) { Sync(); }


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

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

LLVM IR (-O0):
define void @StateRestore(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @Sync()
ret void
}

LLVM IR (-O2):
define void @StateRestore(i32 %0) {
%2 = tail call i32 (...) @Sync()
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t ffs_musl(uint32_t x) {
  static const char debruijn32[32] = {
      0,  1,  23, 2,  29, 24, 19, 3,  30, 27, 25, 11, 20, 8, 4,  13,
      31, 22, 28, 18, 26, 10, 7,  12, 21, 17, 9,  6,  16, 5, 15, 14};
  return x ? debruijn32[(x & -x) * 0x076be629 >> 27] + 1 : 0;
}


x86 assembly (clang, -O0):
<ffs_musl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     113d <ffs_musl+0x3d>
mov    -0x4(%rbp),%eax
xor    %ecx,%ecx
sub    -0x4(%rbp),%ecx
and    %ecx,%eax
imul   $0x76be629,%eax,%eax
sar    $0x1b,%eax
movslq %eax,%rcx
lea    0xed2(%rip),%rax
movsbl (%rax,%rcx,1),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1147 <ffs_musl+0x47>
xor    %eax,%eax
mov    %eax,-0x8(%rbp)
jmp    1147 <ffs_musl+0x47>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ffs_musl>:
test   %edi,%edi
je     1124 <ffs_musl+0x24>
mov    %edi,%eax
neg    %eax
and    %edi,%eax
imul   $0x76be629,%eax,%eax
sar    $0x1b,%eax
cltq
lea    0xee4(%rip),%rcx
movsbl (%rax,%rcx,1),%eax
add    $0x1,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
@ffs_musl.debruijn32 = internal constant [32 x i8] c"\00\01\17\02\1D\18\13\03\1E\1B\19\0B\14\08\04\0D\1F\16\1C\12\1A\0A\07\0C\15\11\09\06\10\05\0F\0E"
define i32 @ffs_musl(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %17
5: ; preds = %1
%6 = load i32, i32* %2
%7 = load i32, i32* %2
%8 = sub nsw i32 0, %7
%9 = and i32 %6, %8
%10 = mul nsw i32 %9, 124511785
%11 = ashr i32 %10, 27
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [32 x i8], [32 x i8]* @ffs_musl.debruijn32, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = add nsw i32 %15, 1
br label %18
17: ; preds = %1
br label %18
18: ; preds = %17, %5
%19 = phi i32 [ %16, %5 ], [ 0, %17 ]
ret i32 %19
}

LLVM IR (-O2):
@ffs_musl.debruijn32 = internal unnamed_addr constant [32 x i8] c"\00\01\17\02\1D\18\13\03\1E\1B\19\0B\14\08\04\0D\1F\16\1C\12\1A\0A\07\0C\15\11\09\06\10\05\0F\0E"
define i32 @ffs_musl(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = sub nsw i32 0, %0
%5 = and i32 %4, %0
%6 = mul nsw i32 %5, 124511785
%7 = ashr i32 %6, 27
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [32 x i8], [32 x i8]* @ffs_musl.debruijn32, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = add nsw i32 %11, 1
br label %13
13: ; preds = %1, %3
%14 = phi i32 [ %12, %3 ], [ 0, %1 ]
ret i32 %14
}
/* Variables and functions */
char *U_WMRCORENONE_set(char *);
char *U_WMRB9_set(void) { return U_WMRCORENONE_set("U_WMRB9"); }


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

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMRB9\00"
define i8* @U_WMRB9_set() {
%1 = tail call i8* @U_WMRCORENONE_set(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}
/* Variables and functions */
int sscanf(char const *, char *, float *);
int iupStrToFloat(const char *str, float *f) {
  if (!str)
    return 0;
  if (sscanf(str, "%f", f) != 1)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<iupStrToFloat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1137 <iupStrToFloat+0x27>
movl   $0x0,-0x4(%rbp)
jmp    1167 <iupStrToFloat+0x57>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xeba(%rip),%rsi
call   1030 <sscanf@plt>
cmp    $0x1,%eax
je     1160 <iupStrToFloat+0x50>
movl   $0x0,-0x4(%rbp)
jmp    1167 <iupStrToFloat+0x57>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iupStrToFloat>:
test   %rdi,%rdi
je     1134 <iupStrToFloat+0x24>
push   %rax
mov    %rsi,%rdx
lea    0xee0(%rip),%rsi
call   1030 <sscanf@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
sete   %al
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
define i32 @iupStrToFloat(i8* %0, float* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca float*
store i8* %0, i8** %4
store float* %1, float** %5
%6 = load i8*, i8** %4
%7 = icmp ne i8* %6, null
br i1 %7, label %9, label %8
8: ; preds = %2
store i32 0, i32* %3
br label %16
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = load float*, float** %5
%12 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %11)
%13 = icmp ne i32 %12, 1
br i1 %13, label %14, label %15
14: ; preds = %9
store i32 0, i32* %3
br label %16
15: ; preds = %9
store i32 1, i32* %3
br label %16
16: ; preds = %15, %14, %8
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
define i32 @iupStrToFloat(i8* %0, float* %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = tail call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%6 = icmp eq i32 %5, 1
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %2
%9 = phi i32 [ 0, %2 ], [ %7, %4 ]
ret i32 %9
}
int str_ncmp(char src1[], char src2[], int n) {
  int i;
  for (i = 0; i <= n; i++) {
    if (src1[i] != src2[i]) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<str_ncmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     1161 <str_ncmp+0x61>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
movslq -0x20(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     114e <str_ncmp+0x4e>
movl   $0x1,-0x4(%rbp)
jmp    1168 <str_ncmp+0x68>
jmp    1153 <str_ncmp+0x53>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1116 <str_ncmp+0x16>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @str_ncmp(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = icmp slt i32 %2, 0
br i1 %4, label %18, label %5
5: ; preds = %3
%6 = add nuw i32 %2, 1
%7 = zext i32 %6 to i64
br label %11
8: ; preds = %11
%9 = add nuw nsw i64 %12, 1
%10 = icmp eq i64 %9, %7
br i1 %10, label %18, label %11
11: ; preds = %5, %8
%12 = phi i64 [ 0, %5 ], [ %9, %8 ]
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = getelementptr inbounds i8, i8* %1, i64 %12
%16 = load i8, i8* %15
%17 = icmp eq i8 %14, %16
br i1 %17, label %8, label %18
18: ; preds = %11, %8, %3
%19 = phi i32 [ 0, %3 ], [ 0, %8 ], [ 1, %11 ]
ret i32 %19
}
double max(double a, double b) { return (a > b ? a : b); }


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    112d <max+0x2d>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1137 <max+0x37>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
maxsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @max(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp ogt double %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load double, double* %3
br label %12
10: ; preds = %2
%11 = load double, double* %4
br label %12
12: ; preds = %10, %8
%13 = phi double [ %9, %8 ], [ %11, %10 ]
ret double %13
}

LLVM IR (-O2):
define double @max(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
int main(void) {
  int foo = 10, bar = 15;
  __asm__ __volatile__("addl 	%%ebx,%%eax"
                       : "=eax"(foo)
                       : "eax"(foo), "ebx"(bar)
                       :);
  printf("foo+bar=%d\n", foo);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0xf,-0xc(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%eax
movd   %ecx,%xmm0
movd   %eax,%xmm1
add    %ebx,%eax
movd   %xmm0,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
add    %ebx,%eax
movd   %xmm0,%esi
lea    0xee2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"foo+bar=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
store i32 15, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* %3
%6 = call i32 asm sideeffect "addl \09%ebx,%eax", "=e{ax}x,e{ax}x,e{bx}x,~{dirflag},~{fpsr},~{flags}"(i32 %4, i32 %5)
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"foo+bar=%d\0A\00"
define i32 @main() {
%1 = tail call i32 asm sideeffect "addl \09%ebx,%eax", "=e{ax}x,e{ax}x,e{bx}x,~{dirflag},~{fpsr},~{flags}"(i32 10, i32 15)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ writeConfig();
void saveConfigCallback() { writeConfig(); }


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

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

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

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

/* Variables and functions */
bool vlanid_is_valid(uint16_t id) { return id <= 4094; }


x86 assembly (clang, -O0):
<vlanid_is_valid>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0xffe,-0x4(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vlanid_is_valid>:
xor    %eax,%eax
cmp    $0xfff,%edi
setl   %al
ret

LLVM IR (-O0):
define i32 @vlanid_is_valid(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sle i32 %3, 4094
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @vlanid_is_valid(i32 %0) {
%2 = icmp slt i32 %0, 4095
%3 = zext i1 %2 to i32
ret i32 %3
}