xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isdigit(int);
void t_isdigit_0xce() {
  Assert_real((isdigit(206) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isdigit.c",
              1035, ("isdigit should be 0 for 0xce"));
}


x86 assembly (clang, -O0):
<t_isdigit_0xce>:
push   %rbp
mov    %rsp,%rbp
mov    $0xce,%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x40b,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isdigit_0xce>:
push   %rax
mov    $0xce,%edi
call   1030 <isdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x40b,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [29 x i8] c"isdigit should be 0 for 0xce\00"
define void @t_isdigit_0xce() {
%1 = call i64 @isdigit(i32 206)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1035, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [29 x i8] c"isdigit should be 0 for 0xce\00"
define void @t_isdigit_0xce() {
%1 = tail call i64 @isdigit(i32 206)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1035, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int test_imm_BBuint64_lowword_reg(unsigned long long val) {
  return ((val) & (0xBB << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_BBuint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 187
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct in_addr {
  int dummy;
};
struct in6_addr {
  int dummy;
};
typedef int socklen_t;

/* Variables and functions */
unsigned int AF_INET;
unsigned int AF_INET6;
socklen_t xtables_sa_hostlen(unsigned int afproto) {
  if (afproto == AF_INET6)
    return sizeof(struct in6_addr);
  else if (afproto == AF_INET)
    return sizeof(struct in_addr);
  return 0;
}


x86 assembly (clang, -O0):
<xtables_sa_hostlen>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2ecf(%rip),%rcx
cmp    (%rcx),%eax
jne    1125 <xtables_sa_hostlen+0x25>
movl   $0x4,-0x4(%rbp)
jmp    114f <xtables_sa_hostlen+0x4f>
mov    -0x8(%rbp),%eax
mov    0x2eb9(%rip),%rcx
cmp    (%rcx),%eax
jne    1143 <xtables_sa_hostlen+0x43>
movl   $0x4,-0x4(%rbp)
jmp    114f <xtables_sa_hostlen+0x4f>
jmp    1148 <xtables_sa_hostlen+0x48>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xtables_sa_hostlen>:
mov    0x2ed9(%rip),%rax
cmp    %edi,(%rax)
sete   %al
mov    0x2ed5(%rip),%rcx
cmp    %edi,(%rcx)
sete   %cl
or     %al,%cl
movzbl %cl,%eax
shl    $0x2,%eax
ret

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

LLVM IR (-O2):
@AF_INET6 = global i32 0
@AF_INET = global i32 0
define i32 @xtables_sa_hostlen(i32 %0) {
%2 = load i32, i32* @AF_INET6
%3 = icmp eq i32 %2, %0
%4 = load i32, i32* @AF_INET
%5 = icmp eq i32 %4, %0
%6 = select i1 %3, i1 true, i1 %5
%7 = select i1 %6, i32 4, i32 0
ret i32 %7
}
int ls_costN_nm6_work(int *sz_arg, int *sz_res, int *sz_iw, int *sz_w) {
  if (sz_arg)
    *sz_arg = 1;
  if (sz_res)
    *sz_res = 2;
  if (sz_iw)
    *sz_iw = 0;
  if (sz_w)
    *sz_w = 1;
  return 0;
}


x86 assembly (clang, -O0):
<ls_costN_nm6_work>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1129 <ls_costN_nm6_work+0x29>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
cmpq   $0x0,-0x10(%rbp)
je     113e <ls_costN_nm6_work+0x3e>
mov    -0x10(%rbp),%rax
movl   $0x2,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     1153 <ls_costN_nm6_work+0x53>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
cmpq   $0x0,-0x20(%rbp)
je     1168 <ls_costN_nm6_work+0x68>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_costN_nm6_work>:
test   %rdi,%rdi
je     110b <ls_costN_nm6_work+0xb>
movl   $0x1,(%rdi)
test   %rsi,%rsi
je     1116 <ls_costN_nm6_work+0x16>
movl   $0x2,(%rsi)
test   %rdx,%rdx
je     1121 <ls_costN_nm6_work+0x21>
movl   $0x0,(%rdx)
test   %rcx,%rcx
je     112c <ls_costN_nm6_work+0x2c>
movl   $0x1,(%rcx)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @ls_costN_nm6_work(i32* writeonly %0, i32* writeonly %1, i32* writeonly %2, i32* writeonly %3) {
%5 = icmp eq i32* %0, null
br i1 %5, label %7, label %6
6: ; preds = %4
store i32 1, i32* %0
br label %7
7: ; preds = %6, %4
%8 = icmp eq i32* %1, null
br i1 %8, label %10, label %9
9: ; preds = %7
store i32 2, i32* %1
br label %10
10: ; preds = %9, %7
%11 = icmp eq i32* %2, null
br i1 %11, label %13, label %12
12: ; preds = %10
store i32 0, i32* %2
br label %13
13: ; preds = %12, %10
%14 = icmp eq i32* %3, null
br i1 %14, label %16, label %15
15: ; preds = %13
store i32 1, i32* %3
br label %16
16: ; preds = %15, %13
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ _DIAGASSERT(int /*<<< orphan*/);
int __sputc(int, int /*<<< orphan*/ *);
int fputc(int c, FILE *fp) {
  int r;
  _DIAGASSERT(fp != NULL);
  ;
  r = __sputc(c, fp);
  ;
  return r;
}


x86 assembly (clang, -O0):
<fputc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <_DIAGASSERT@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <__sputc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fputc>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %edi,%edi
test   %rsi,%rsi
setne  %dil
call   1040 <_DIAGASSERT@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <__sputc@plt>

LLVM IR (-O0):
define i32 @fputc(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
%6 = load i32*, i32** %4
%7 = icmp ne i32* %6, null
%8 = zext i1 %7 to i32
%9 = call i32 @_DIAGASSERT(i32 %8)
%10 = load i32, i32* %3
%11 = load i32*, i32** %4
%12 = call i32 @__sputc(i32 %10, i32* %11)
store i32 %12, i32* %5
%13 = load i32, i32* %5
ret i32 %13
}

LLVM IR (-O2):
define i32 @fputc(i32 %0, i32* %1) {
%3 = icmp ne i32* %1, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @_DIAGASSERT(i32 %4)
%6 = tail call i32 @__sputc(i32 %0, i32* %1)
ret i32 %6
}
double Sleef_atan_u35(double x) { return __builtin_atan(x); }


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

x86 assembly (clang, -O2):
<Sleef_atan_u35>:
jmp    1030 <atan@plt>

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

LLVM IR (-O2):
define double @Sleef_atan_u35(double %0) {
%2 = tail call double @atan(double %0)
ret double %2
}
/* Variables and functions */
void *realloc(void *, size_t);
void *json_default_alloc_func(void *ptr, size_t osize, size_t nsize) {
  (void)osize;
  return realloc(ptr, nsize);
}


x86 assembly (clang, -O0):
<json_default_alloc_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <realloc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<json_default_alloc_func>:
mov    %rdx,%rsi
jmp    1030 <realloc@plt>

LLVM IR (-O0):
define i8* @json_default_alloc_func(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %5
%8 = load i8*, i8** %4
%9 = load i64, i64* %6
%10 = call i8* @realloc(i8* %8, i64 %9)
ret i8* %10
}

LLVM IR (-O2):
define noalias i8* @json_default_alloc_func(i8* nocapture %0, i64 %1, i64 %2) {
%4 = tail call i8* @realloc(i8* %0, i64 %2)
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
void fin_connection(FILE *stream, char *msg) {
  fclose(stream);
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<fin_connection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fin_connection>:
push   %rax
call   1030 <fclose@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
define void @fin_connection(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i32*, i32** %3
%6 = call i32 @fclose(i32* %5)
%7 = call i32 @pthread_exit(i32* null)
ret void
}

LLVM IR (-O2):
define void @fin_connection(i32* nocapture %0, i8* nocapture readnone %1) {
%3 = tail call i32 @fclose(i32* %0)
%4 = tail call i32 @pthread_exit(i32* null)
ret void
}
int tegra_bbc_thermal_init(void) { return 0; }


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ sp_werror(char *, int);
int /*<<< orphan*/ strerror_r(int, char *, int);
void create_rerror(int ecode) {
  char buf[256];
  strerror_r(ecode, buf, sizeof(buf));
  sp_werror(buf, ecode);
}


x86 assembly (clang, -O0):
<create_rerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x110(%rbp),%rsi
mov    $0x100,%edx
call   1040 <strerror_r@plt>
lea    -0x110(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1030 <sp_werror@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_rerror>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %edi,%ebx
mov    %rsp,%r14
mov    %r14,%rsi
mov    $0x100,%edx
call   1040 <strerror_r@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <sp_werror@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @create_rerror(i32 %0) {
%2 = alloca i32
%3 = alloca [256 x i8]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%6 = call i32 @strerror_r(i32 %4, i8* %5, i32 256)
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%8 = load i32, i32* %2
%9 = call i32 @sp_werror(i8* %7, i32 %8)
ret void
}

LLVM IR (-O2):
define void @create_rerror(i32 %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = call i32 @strerror_r(i32 %0, i8* %3, i32 256)
%5 = call i32 @sp_werror(i8* %3, i32 %0)
ret void
}
int test_imm_FBuint8_mem(unsigned char *val) {
  return ((*val) & (0xFB << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_FBuint8_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, 251
%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_FBuint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -5
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int w5100_read(int, int /*<<< orphan*/ *, int);
unsigned w5100_readUIPR(uint8_t *buff) { return w5100_read(0x002A, buff, 4); }


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

x86 assembly (clang, -O2):
mov    %rdi,%rsi
mov    $0x2a,%edi
mov    $0x4,%edx
jmp    1030 <w5100_read@plt>

LLVM IR (-O0):
define i32 @w5100_readUIPR(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @w5100_read(i32 42, i32* %3, i32 4)
ret i32 %4
}

LLVM IR (-O2):
define i32 @w5100_readUIPR(i32* %0) {
%2 = tail call i32 @w5100_read(i32 42, i32* %0, i32 4)
ret i32 %2
}
void rop3_207_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = ~T;
  stk1 = S | stk2;
  *D = (stk1 & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
<rop3_207_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xc(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xc(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_207_1_0>:
or     %esi,%edx
not    %dl
mov    (%rdi),%al
and    %sil,%al
or     %dl,%al
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_207_1_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8, i8* %6
%10 = zext i8 %9 to i32
%11 = xor i32 %10, -1
%12 = trunc i32 %11 to i8
store i8 %12, i8* %8
%13 = load i8, i8* %5
%14 = zext i8 %13 to i32
%15 = load i8, i8* %8
%16 = zext i8 %15 to i32
%17 = or i32 %14, %16
%18 = trunc i32 %17 to i8
store i8 %18, i8* %7
%19 = load i8, i8* %7
%20 = zext i8 %19 to i32
%21 = load i8, i8* %5
%22 = zext i8 %21 to i32
%23 = xor i32 %22, -1
%24 = and i32 %20, %23
%25 = load i8*, i8** %4
%26 = load i8, i8* %25
%27 = zext i8 %26 to i32
%28 = load i8, i8* %5
%29 = zext i8 %28 to i32
%30 = and i32 %27, %29
%31 = or i32 %24, %30
%32 = trunc i32 %31 to i8
%33 = load i8*, i8** %4
store i8 %32, i8* %33
ret void
}

LLVM IR (-O2):
define void @rop3_207_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = or i8 %2, %1
%5 = xor i8 %4, -1
%6 = load i8, i8* %0
%7 = and i8 %6, %1
%8 = or i8 %7, %5
store i8 %8, i8* %0
ret void
}
/* Variables and functions */
size_t is_palindrome_str(char *, int);
int sprintf(char *, char *, long);
size_t is_palindrome_long(long candidate) {
  char buffer[6 + 1];
  int str_length = sprintf(buffer, "%lu", candidate);
  return is_palindrome_str(buffer, str_length);
}


x86 assembly (clang, -O0):
<is_palindrome_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xf(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xec5(%rip),%rsi
call   1040 <sprintf@plt>
mov    %eax,-0x14(%rbp)
lea    -0xf(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <is_palindrome_str@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_palindrome_long>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rdx
lea    0xed1(%rip),%rsi
lea    0x9(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <is_palindrome_str@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lu\00"
define i64 @is_palindrome_long(i64 %0) {
%2 = alloca i64
%3 = alloca [7 x i8]
%4 = alloca i32
store i64 %0, i64* %2
%5 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%6 = load i64, i64* %2
%7 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %6)
store i32 %7, i32* %4
%8 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%9 = load i32, i32* %4
%10 = call i64 @is_palindrome_str(i8* %8, i32 %9)
ret i64 %10
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lu\00"
define i64 @is_palindrome_long(i64 %0) {
%2 = alloca [7 x i8]
%3 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %0)
%5 = call i64 @is_palindrome_str(i8* %3, i32 %4)
ret i64 %5
}
/* Variables and functions */
bool native_window_init(void) { return true; }


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

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

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

LLVM IR (-O2):
define i32 @native_window_init() {
ret i32 1
}
int bitcount2(unsigned int x) {
  int b;
  for (b = 0; x; b++) {
    x &= x - 1;
  }
  return b;
}


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

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

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

LLVM IR (-O2):
define i32 @bitcount2(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ 0, %1 ]
%5 = phi i32 [ %7, %3 ], [ %0, %1 ]
%6 = add i32 %5, -1
%7 = and i32 %6, %5
%8 = add nuw nsw i32 %4, 1
%9 = icmp eq i32 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %8, %3 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ b(char *);
int main() {
  char c[4] = {0, 1, 2, 0};
  b(c);
  return c[0] + c[3];
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xedb(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <b@plt>
movsbl -0x8(%rbp),%eax
movsbl -0x5(%rbp),%ecx
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x20100,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <b@plt>
movsbl 0x4(%rsp),%ecx
movsbl 0x7(%rsp),%eax
add    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.c = [4 x i8] c"\00\01\02\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8]
store i32 0, i32* %1
%3 = bitcast [4 x i8]* %2 to i8*
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%5 = call i32 @b(i8* %4)
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 3
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = add nsw i32 %8, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to [4 x i8]*
%3 = bitcast i32* %1 to i8*
store i32 131328, i32* %1
%4 = call i32 @b(i8* %3)
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 3
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = add nsw i32 %9, %6
ret i32 %10
}
/* Type definitions */
struct sigaction {
  int /*<<< orphan*/ sa_mask;
};
typedef int /*<<< orphan*/ sigset_t;
typedef int /*<<< orphan*/ sa;

/* Variables and functions */
int /*<<< orphan*/ memset(struct sigaction *, int /*<<< orphan*/, int);
int /*<<< orphan*/ sigaction(int, int /*<<< orphan*/, struct sigaction *);
int /*<<< orphan*/ sigdelset(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ sigsuspend(int /*<<< orphan*/ *);
void sig_suspend(int sig) {
  struct sigaction sa;
  sigset_t ss;
  memset(&sa, 0, sizeof(sa));
  sigaction(sig, 0, &sa);
  ss = sa.sa_mask;
  sigdelset(&ss, sig);
  sigsuspend(&ss);
}


x86 assembly (clang, -O0):
<sig_suspend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
mov    -0x4(%rbp),%edi
xor    %esi,%esi
lea    -0x8(%rbp),%rdx
call   1030 <sigaction@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%esi
lea    -0xc(%rbp),%rdi
call   1060 <sigdelset@plt>
lea    -0xc(%rbp),%rdi
call   1050 <sigsuspend@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_suspend>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
mov    %ebx,%edi
xor    %esi,%esi
mov    %r14,%rdx
call   1030 <sigaction@plt>
mov    (%rsp),%eax
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%r14
mov    %r14,%rdi
mov    %ebx,%esi
call   1060 <sigdelset@plt>
mov    %r14,%rdi
call   1050 <sigsuspend@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.sigaction = type { i32 }
define void @sig_suspend(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.sigaction
%4 = alloca i32
store i32 %0, i32* %2
%5 = call i32 @memset(%struct.sigaction* %3, i32 0, i32 4)
%6 = load i32, i32* %2
%7 = call i32 @sigaction(i32 %6, i32 0, %struct.sigaction* %3)
%8 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %3, i32 0, i32 0
%9 = load i32, i32* %8
store i32 %9, i32* %4
%10 = load i32, i32* %2
%11 = call i32 @sigdelset(i32* %4, i32 %10)
%12 = call i32 @sigsuspend(i32* %4)
ret void
}

LLVM IR (-O2):
%struct.sigaction = type { i32 }
define void @sig_suspend(i32 %0) {
%2 = alloca %struct.sigaction
%3 = alloca i32
%4 = bitcast %struct.sigaction* %2 to i8*
%5 = bitcast i32* %3 to i8*
%6 = call i32 @memset(%struct.sigaction* %2, i32 0, i32 4)
%7 = call i32 @sigaction(i32 %0, i32 0, %struct.sigaction* %2)
%8 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %2, i64 0, i32 0
%9 = load i32, i32* %8
store i32 %9, i32* %3
%10 = call i32 @sigdelset(i32* %3, i32 %0)
%11 = call i32 @sigsuspend(i32* %3)
ret void
}
/* Variables and functions */
char *strrchr(const char *s, int c) {
  char *retval = NULL;
  const char *cur;
  for (cur = s; *cur; cur++)
    if (*cur == c)
      retval = (char *)cur;
  return retval;
}


x86 assembly (clang, -O0):
<strrchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpb   $0x0,(%rax)
je     1156 <strrchr+0x56>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    -0xc(%rbp),%eax
jne    1140 <strrchr+0x40>
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1145 <strrchr+0x45>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    111b <strrchr+0x1b>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strrchr>:
mov    (%rdi),%cl
xor    %eax,%eax
test   %cl,%cl
je     1125 <strrchr+0x25>
nopl   0x0(%rax,%rax,1)
movsbl %cl,%ecx
cmp    %esi,%ecx
cmove  %rdi,%rax
movzbl 0x1(%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <strrchr+0x10>
ret

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

LLVM IR (-O2):
define i8* @strrchr(i8* %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i8* [ %12, %5 ], [ %0, %2 ]
%8 = phi i8* [ %11, %5 ], [ null, %2 ]
%9 = sext i8 %6 to i32
%10 = icmp eq i32 %9, %1
%11 = select i1 %10, i8* %7, i8* %8
%12 = getelementptr inbounds i8, i8* %7, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i8* [ null, %2 ], [ %11, %5 ]
ret i8* %16
}
/* Type definitions */
typedef int u_int32_t;

/* Variables and functions */
int __finitef(float x) {
  union {
    u_int32_t lval;
    float fval;
  } z;
  z.fval = x;
  return ((z.lval & 0x7f800000) != 0x7f800000);
}


x86 assembly (clang, -O0):
<__finitef>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x7f800000,%eax
cmp    $0x7f800000,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__finitef>:
movd   %xmm0,%ecx
not    %ecx
xor    %eax,%eax
test   $0x7f800000,%ecx
setne  %al
ret

LLVM IR (-O0):
%union.anon = type { i32 }
define i32 @__finitef(float %0) {
%2 = alloca float
%3 = alloca %union.anon
store float %0, float* %2
%4 = load float, float* %2
%5 = bitcast %union.anon* %3 to float*
store float %4, float* %5
%6 = bitcast %union.anon* %3 to i32*
%7 = load i32, i32* %6
%8 = and i32 %7, 2139095040
%9 = icmp ne i32 %8, 2139095040
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @__finitef(float %0) {
%2 = bitcast float %0 to i32
%3 = and i32 %2, 2139095040
%4 = icmp ne i32 %3, 2139095040
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
float atof(char const *);
float str_tofloat(const char *str) { return atof(str); }


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

x86 assembly (clang, -O2):
<str_tofloat>:
jmp    1030 <atof@plt>

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

LLVM IR (-O2):
define float @str_tofloat(i8* nocapture %0) {
%2 = tail call float @atof(i8* %0)
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void cs_trial(int numLines) {
  int i;
  for (i = 0; i < numLines; i++)
    puts("");
}


x86 assembly (clang, -O0):
<cs_trial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1148 <cs_trial+0x38>
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <cs_trial+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cs_trial>:
push   %rbx
test   %edi,%edi
jle    112f <cs_trial+0x1f>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <cs_trial+0x10>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define void @cs_trial(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %10, %1
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp slt i32 %5, %6
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
br label %4
13: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @cs_trial(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = tail call i32 @putchar(i32 10)
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
int f5(unsigned x, int y) {
  int a = x - y;
  return a + y;
}


x86 assembly (clang, -O0):
<f5>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @f5(i32 returned %0, i32 %1) {
ret i32 %0
}
double foo_double(_Complex double x) { return creal(x); }


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

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

LLVM IR (-O0):
define double @foo_double(double %0, double %1) {
%3 = alloca { double, double }
%4 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 0
store double %0, double* %4
%5 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 1
store double %1, double* %5
%6 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 0
%7 = load double, double* %6
%8 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 1
%9 = load double, double* %8
ret double %7
}

LLVM IR (-O2):
define double @foo_double(double returned %0, double %1) {
ret double %0
}
/* Variables and functions */
unsigned short CRC_Build_16(unsigned char const *, unsigned long const);
char CRC_Check_16(const unsigned char *cDataPointer,
                  const unsigned long iLength, const unsigned short iCRC_16) {
  unsigned short iReceiverCRC;
  iReceiverCRC = CRC_Build_16(cDataPointer, iLength);
  return ((char)(iCRC_16 == iReceiverCRC));
}


x86 assembly (clang, -O0):
<CRC_Check_16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dx,%ax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %ax,-0x12(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <CRC_Build_16@plt>
mov    %ax,-0x14(%rbp)
movzwl -0x12(%rbp),%eax
movzwl -0x14(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
movsbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CRC_Check_16>:
push   %rbx
mov    %edx,%ebx
call   1030 <CRC_Build_16@plt>
cmp    %bx,%ax
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @CRC_Check_16(i8* %0, i64 %1, i16 zeroext %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i16
%7 = alloca i16
store i8* %0, i8** %4
store i64 %1, i64* %5
store i16 %2, i16* %6
%8 = load i8*, i8** %4
%9 = load i64, i64* %5
%10 = call zeroext i16 @CRC_Build_16(i8* %8, i64 %9)
store i16 %10, i16* %7
%11 = load i16, i16* %6
%12 = zext i16 %11 to i32
%13 = load i16, i16* %7
%14 = zext i16 %13 to i32
%15 = icmp eq i32 %12, %14
%16 = zext i1 %15 to i32
%17 = trunc i32 %16 to i8
ret i8 %17
}

LLVM IR (-O2):
define signext i8 @CRC_Check_16(i8* %0, i64 %1, i16 zeroext %2) {
%4 = tail call zeroext i16 @CRC_Build_16(i8* %0, i64 %1)
%5 = icmp eq i16 %4, %2
%6 = zext i1 %5 to i8
ret i8 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void printn(char *msg) { printf("%s\n", msg); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @printn(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
void alarm_handler(int signum) { return; }


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

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

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

LLVM IR (-O2):
define void @alarm_handler(i32 %0) {
ret void
}
int test_imm_BCint16_reg(short val) {
  return ((val) & (-0xBC << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_BCint16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, -188
%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_BCint16_reg(i16 signext %0) {
%2 = and i16 %0, -188
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int _compat_time(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @_compat_time() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main(int argc, char **argv) {
  if (argc > 2)
    return 1;
  puts(argv[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    113c <main+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    1150 <main+0x40>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%eax
cmp    $0x2,%edi
jg     112a <main+0x1a>
push   %rax
mov    0x8(%rsi),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret

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 = load i32, i32* %4
%7 = icmp sgt i32 %6, 2
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 1, i32* %3
br label %14
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @puts(i8* %12)
store i32 0, i32* %3
br label %14
14: ; preds = %9, %8
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @puts(i8* dereferenceable(1) %6)
br label %8
8: ; preds = %2, %4
%9 = phi i32 [ 0, %4 ], [ 1, %2 ]
ret i32 %9
}
void tcp_drain() {}


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

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

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

LLVM IR (-O2):
define void @tcp_drain() {
ret void
}
unsigned signum_fun_uint(unsigned a) { return (a > 0); }


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

x86 assembly (clang, -O2):
<signum_fun_uint>:
xor    %eax,%eax
test   %edi,%edi
setne  %al
ret

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

LLVM IR (-O2):
define i32 @signum_fun_uint(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
unsigned char bcd2i(unsigned char);
double hms2sec(unsigned char, unsigned char, unsigned char);
double bcd_hms2sec(unsigned char pos[]) {
  unsigned char h = bcd2i(pos[2]);
  unsigned char m = bcd2i(pos[1]);
  unsigned char s = bcd2i(pos[0]);
  return hms2sec(h, m, s);
}


x86 assembly (clang, -O0):
<bcd_hms2sec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x2(%rax),%edi
call   1030 <bcd2i@plt>
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%edi
call   1030 <bcd2i@plt>
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%edi
call   1030 <bcd2i@plt>
mov    %al,-0xb(%rbp)
mov    -0x9(%rbp),%cl
mov    -0xa(%rbp),%al
movzbl %cl,%edi
movzbl %al,%esi
movzbl -0xb(%rbp),%edx
call   1040 <hms2sec@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bcd_hms2sec>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
movzbl 0x2(%rdi),%edi
call   1030 <bcd2i@plt>
mov    %eax,%ebp
movzbl 0x1(%rbx),%edi
call   1030 <bcd2i@plt>
mov    %eax,%r14d
movzbl (%rbx),%edi
call   1030 <bcd2i@plt>
movzbl %bpl,%edi
movzbl %r14b,%esi
movzbl %al,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <hms2sec@plt>

LLVM IR (-O0):
define double @bcd_hms2sec(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i64 2
%8 = load i8, i8* %7
%9 = call zeroext i8 @bcd2i(i8 zeroext %8)
store i8 %9, i8* %3
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = call zeroext i8 @bcd2i(i8 zeroext %12)
store i8 %13, i8* %4
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
%17 = call zeroext i8 @bcd2i(i8 zeroext %16)
store i8 %17, i8* %5
%18 = load i8, i8* %3
%19 = load i8, i8* %4
%20 = load i8, i8* %5
%21 = call double @hms2sec(i8 zeroext %18, i8 zeroext %19, i8 zeroext %20)
ret double %21
}

LLVM IR (-O2):
define double @bcd_hms2sec(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 2
%3 = load i8, i8* %2
%4 = tail call zeroext i8 @bcd2i(i8 zeroext %3)
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = tail call zeroext i8 @bcd2i(i8 zeroext %6)
%8 = load i8, i8* %0
%9 = tail call zeroext i8 @bcd2i(i8 zeroext %8)
%10 = tail call double @hms2sec(i8 zeroext %4, i8 zeroext %7, i8 zeroext %9)
ret double %10
}
int json_object_to_file(char *filename, struct json_object *obj) {
  const char *json_str;
  int fd, ret;
  unsigned int wpos, wsize;
  return 0;
}


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

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

LLVM IR (-O0):
%struct.json_object = type opaque
define i32 @json_object_to_file(i8* %0, %struct.json_object* %1) {
%3 = alloca i8*
%4 = alloca %struct.json_object*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %3
store %struct.json_object* %1, %struct.json_object** %4
ret i32 0
}

LLVM IR (-O2):
%struct.json_object = type opaque
define i32 @json_object_to_file(i8* nocapture readnone %0, %struct.json_object* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ VIM_SIF_I2cReadByte(int, unsigned char *);
unsigned char CheckId_OV7670(void) {
  unsigned char temp1;
  unsigned char temp2;
  VIM_SIF_I2cReadByte(0x0a, &temp1);
  VIM_SIF_I2cReadByte(0x0b, &temp2);
  if ((temp1 == 0x76) && (temp2 == 0x73))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<CheckId_OV7670>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xa,%edi
lea    -0x2(%rbp),%rsi
call   1030 <VIM_SIF_I2cReadByte@plt>
mov    $0xb,%edi
lea    -0x3(%rbp),%rsi
call   1030 <VIM_SIF_I2cReadByte@plt>
movzbl -0x2(%rbp),%eax
cmp    $0x76,%eax
jne    1157 <CheckId_OV7670+0x47>
movzbl -0x3(%rbp),%eax
cmp    $0x73,%eax
jne    1157 <CheckId_OV7670+0x47>
movb   $0x1,-0x1(%rbp)
jmp    115b <CheckId_OV7670+0x4b>
movb   $0x0,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CheckId_OV7670>:
push   %rax
lea    0x7(%rsp),%rsi
mov    $0xa,%edi
call   1030 <VIM_SIF_I2cReadByte@plt>
lea    0x6(%rsp),%rsi
mov    $0xb,%edi
call   1030 <VIM_SIF_I2cReadByte@plt>
mov    0x7(%rsp),%al
xor    $0x76,%al
mov    0x6(%rsp),%cl
xor    $0x73,%cl
or     %al,%cl
sete   %al
pop    %rcx
ret

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

LLVM IR (-O2):
define zeroext i8 @CheckId_OV7670() {
%1 = alloca i8
%2 = alloca i8
%3 = call i32 @VIM_SIF_I2cReadByte(i32 10, i8* %1)
%4 = call i32 @VIM_SIF_I2cReadByte(i32 11, i8* %2)
%5 = load i8, i8* %1
%6 = icmp eq i8 %5, 118
%7 = load i8, i8* %2
%8 = icmp eq i8 %7, 115
%9 = select i1 %6, i1 %8, i1 false
%10 = zext i1 %9 to i8
ret i8 %10
}
/* Variables and functions */
char const *strdup(char const *);
const char *multimap_strdup(const char *str) { return strdup(str); }


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

x86 assembly (clang, -O2):
<multimap_strdup>:
jmp    1030 <strdup@plt>

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

LLVM IR (-O2):
define noalias i8* @multimap_strdup(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
ret i8* %2
}
int test_imm_35uint16_mem(unsigned short *val) {
  return ((*val) & (-0x35 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_35uint16_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, -53
%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_35uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -53
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ newgame();
int main() { newgame(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @newgame()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @newgame()
ret i32 0
}