xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
__attribute__((always_)) const double longBitsToDouble(int64_t i) {
  union {
    double f;
    int64_t i;
  } tmp;
  tmp.i = i;
  return tmp.f;
}


x86 assembly (clang, -O0):
<longBitsToDouble>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<longBitsToDouble>:
mov    %edi,%eax
movq   %rax,%xmm0
ret

LLVM IR (-O0):
%union.anon = type { double }
define double @longBitsToDouble(i32 %0) {
%2 = alloca i32
%3 = alloca %union.anon
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = bitcast %union.anon* %3 to i32*
store i32 %4, i32* %5
%6 = bitcast %union.anon* %3 to double*
%7 = load double, double* %6
ret double %7
}

LLVM IR (-O2):
define double @longBitsToDouble(i32 %0) {
%2 = zext i32 %0 to i64
%3 = bitcast i64 %2 to double
ret double %3
}
int Bematech_FI_DadosUltimaReducao(Var, Retorno) {
  return Formata("\x1b|62|55|\x1b", Var, Retorno);
}


x86 assembly (clang, -O0):
<Bematech_FI_DadosUltimaReducao>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <Formata@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Bematech_FI_DadosUltimaReducao>:
mov    %esi,%edx
mov    %edi,%esi
lea    0xee5(%rip),%rdi
xor    %eax,%eax
jmp    1030 <Formata@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"\1B|62|55|\1B\00"
define i32 @Bematech_FI_DadosUltimaReducao(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @Formata to i32 (i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
@.str = [10 x i8] c"\1B|62|55|\1B\00"
define i32 @Bematech_FI_DadosUltimaReducao(i32 %0, i32 %1) {
%3 = tail call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @Formata to i32 (i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
ret i32 %3
}
double mean(const double sum, const int n) {
  if (n) {
    return (sum / n);
  } else {
    return (0);
  }
}


x86 assembly (clang, -O0):
<mean>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     112e <mean+0x2e>
movsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1136 <mean+0x36>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<mean>:
test   %edi,%edi
je     110d <mean+0xd>
cvtsi2sd %edi,%xmm1
divsd  %xmm1,%xmm0
ret
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @mean(double %0, i32 %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i32
store double %0, double* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load double, double* %4
%10 = load i32, i32* %5
%11 = sitofp i32 %10 to double
%12 = fdiv double %9, %11
store double %12, double* %3
br label %14
13: ; preds = %2
store double 0.000000e+00, double* %3
br label %14
14: ; preds = %13, %8
%15 = load double, double* %3
ret double %15
}

LLVM IR (-O2):
define double @mean(double %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = sitofp i32 %1 to double
%6 = fdiv double %0, %5
br label %7
7: ; preds = %2, %4
%8 = phi double [ %6, %4 ], [ 0.000000e+00, %2 ]
ret double %8
}
void exitLoadAvg(void) {}


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

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

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

LLVM IR (-O2):
define void @exitLoadAvg() {
ret void
}
/* Type definitions */
struct constructHeader {
  int dummy;
};

/* Variables and functions */
char const *GetConstructModuleName(struct constructHeader *);
const char *EnvDeftemplateModule(void *theEnv, void *theDeftemplate) {
  return GetConstructModuleName((struct constructHeader *)theDeftemplate);
}


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

x86 assembly (clang, -O2):
<EnvDeftemplateModule>:
mov    %rsi,%rdi
jmp    1030 <GetConstructModuleName@plt>

LLVM IR (-O0):
%struct.constructHeader = type { i32 }
define i8* @EnvDeftemplateModule(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to %struct.constructHeader*
%7 = call i8* @GetConstructModuleName(%struct.constructHeader* %6)
ret i8* %7
}

LLVM IR (-O2):
%struct.constructHeader = type { i32 }
define i8* @EnvDeftemplateModule(i8* nocapture readnone %0, i8* %1) {
%3 = bitcast i8* %1 to %struct.constructHeader*
%4 = tail call i8* @GetConstructModuleName(%struct.constructHeader* %3)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
main() {
  char *p = "Segfault generation";
  p[0] = 'a';
  p[1] = 'b';
  printf("%s", p);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x61,(%rax)
mov    -0x8(%rbp),%rax
movb   $0x62,0x1(%rax)
mov    -0x8(%rbp),%rsi
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [20 x i8] c"Segfault generation\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i8*
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
%3 = getelementptr inbounds i8, i8* %2, i64 0
store i8 97, i8* %3
%4 = load i8*, i8** %1
%5 = getelementptr inbounds i8, i8* %4, i64 1
store i8 98, i8* %5
%6 = load i8*, i8** %1
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Segfault generation\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int sindex(char ch, char *string) {
  char *cp;
  for (cp = string; *cp; ++cp)
    if (ch == *cp)
      return (int)(cp - string);
  return -1;
}


x86 assembly (clang, -O0):
<sindex>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     115f <sindex+0x5f>
movsbl -0x5(%rbp),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1149 <sindex+0x49>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x4(%rbp)
jmp    1166 <sindex+0x66>
jmp    114e <sindex+0x4e>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1116 <sindex+0x16>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @sindex(i8 signext %0, i8* %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %18, label %5
5: ; preds = %2, %14
%6 = phi i8 [ %16, %14 ], [ %3, %2 ]
%7 = phi i8* [ %15, %14 ], [ %1, %2 ]
%8 = icmp eq i8 %6, %0
br i1 %8, label %9, label %14
9: ; preds = %5
%10 = ptrtoint i8* %7 to i64
%11 = ptrtoint i8* %1 to i64
%12 = sub i64 %10, %11
%13 = trunc i64 %12 to i32
br label %18
14: ; preds = %5
%15 = getelementptr inbounds i8, i8* %7, i64 1
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %5
18: ; preds = %14, %2, %9
%19 = phi i32 [ %13, %9 ], [ -1, %2 ], [ -1, %14 ]
ret i32 %19
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *);
int /*<<< orphan*/ stderr;
void duparg2(const char *key, const char *arg) {
  fprintf(stderr,
          "Error: either \"%s\" is duplicate, or \"%s\" is a garbage.\n", key,
          arg);
  exit(-1);
}


x86 assembly (clang, -O0):
<duparg2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xeb8(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<duparg2>:
push   %rax
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
lea    0xec9(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [56 x i8] c"Error: either \22%s\22 is duplicate, or \22%s\22 is a garbage.\0A\00"
define void @duparg2(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7)
%9 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [56 x i8] c"Error: either \22%s\22 is duplicate, or \22%s\22 is a garbage.\0A\00"
define void @duparg2(i8* %0, i8* %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%5 = tail call i32 @exit(i32 -1)
unreachable
}
int set_mode(const char *pathname, unsigned int mode) { return 0; }


x86 assembly (clang, -O0):
<set_mode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @set_mode(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
ret i32 0
}

LLVM IR (-O2):
define i32 @set_mode(i8* nocapture readnone %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
bool nrf52_errata_246(void) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @nrf52_errata_246() {
ret i32 0
}
_Bool __atomic_compare_exchange_8(volatile void *atom, void *ref,
                                  unsigned long long xchg, _Bool weak,
                                  int success_memorder, int failure_memorder) {
  unsigned long long rv;
  unsigned long long cmp = *(unsigned long long *)ref;
  asm volatile("lock cmpxchg"
               "q"
               " %2,%1\n"
               : "=a"(rv), "+m"(*(unsigned long long *)atom)
               : "q"(xchg), "0"(cmp)
               : "memory");
  *(unsigned long long *)ref = rv;
  return (rv == cmp);
}


x86 assembly (clang, -O0):
<__atomic_compare_exchange_8>:
push   %rbp
mov    %rsp,%rbp
mov    %cl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
and    $0x1,%al
mov    %al,-0x19(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%rdx
mov    -0x38(%rbp),%rax
lock cmpxchg %rdx,(%rcx)
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x30(%rbp),%rax
cmp    -0x38(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__atomic_compare_exchange_8>:
mov    (%rsi),%rcx
mov    %rcx,%rax
lock cmpxchg %rdx,(%rdi)
mov    %rax,(%rsi)
cmp    %rcx,%rax
sete   %al
ret

LLVM IR (-O0):
define zeroext i1 @__atomic_compare_exchange_8(i8* %0, i8* %1, i64 %2, i1 zeroext %3, i32 %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i8
%11 = alloca i32
%12 = alloca i32
%13 = alloca i64
%14 = alloca i64
store i8* %0, i8** %7
store i8* %1, i8** %8
store i64 %2, i64* %9
%15 = zext i1 %3 to i8
store i8 %15, i8* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%16 = load i8*, i8** %8
%17 = bitcast i8* %16 to i64*
%18 = load i64, i64* %17
store i64 %18, i64* %14
%19 = load i8*, i8** %7
%20 = bitcast i8* %19 to i64*
%21 = load i64, i64* %9
%22 = load i64, i64* %14
%23 = call i64 asm sideeffect "lock cmpxchgq $2,$1\0A", "={ax},=*m,q,0,*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %20, i64 %21, i64 %22, i64* elementtype(i64) %20)
store i64 %23, i64* %13
%24 = load i64, i64* %13
%25 = load i8*, i8** %8
%26 = bitcast i8* %25 to i64*
store i64 %24, i64* %26
%27 = load i64, i64* %13
%28 = load i64, i64* %14
%29 = icmp eq i64 %27, %28
ret i1 %29
}

LLVM IR (-O2):
define zeroext i1 @__atomic_compare_exchange_8(i8* %0, i8* nocapture %1, i64 %2, i1 zeroext %3, i32 %4, i32 %5) {
%7 = bitcast i8* %1 to i64*
%8 = load i64, i64* %7
%9 = bitcast i8* %0 to i64*
%10 = tail call i64 asm sideeffect "lock cmpxchgq $2,$1\0A", "={ax},=*m,q,0,*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %9, i64 %2, i64 %8, i64* elementtype(i64) %9)
store i64 %10, i64* %7
%11 = icmp eq i64 %10, %8
ret i1 %11
}
unsigned long nr_onhold(void) { return 0; }


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

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

LLVM IR (-O0):
define i64 @nr_onhold() {
ret i64 0
}

LLVM IR (-O2):
define i64 @nr_onhold() {
ret i64 0
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *malloc(scalar_t__);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
void printError(char *fname) {
  char *s = malloc(5 + strlen(fname) + 1);
  strcpy(s, "cat: ");
  strcat(s, fname);
  perror(s);
  free(s);
}


x86 assembly (clang, -O0):
<printError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rdi
add    $0x5,%rdi
add    $0x1,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe6c(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x10(%rbp),%rdi
call   1070 <perror@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printError>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <strlen@plt>
lea    0x6(%rax),%rdi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0xe81(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <strcat@plt>
mov    %rbx,%rdi
call   1070 <perror@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"cat: \00"
define void @printError(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 5, %5
%7 = add nsw i64 %6, 1
%8 = call i8* @malloc(i64 %7)
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%11 = load i8*, i8** %3
%12 = load i8*, i8** %2
%13 = call i32 @strcat(i8* %11, i8* %12)
%14 = load i8*, i8** %3
%15 = call i32 @perror(i8* %14)
%16 = load i8*, i8** %3
%17 = call i32 @free(i8* %16)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"cat: \00"
define void @printError(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 6
%4 = tail call i8* @malloc(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @strcat(i8* %4, i8* %0)
%7 = tail call i32 @perror(i8* %4)
%8 = tail call i32 @free(i8* %4)
ret void
}
/* Variables and functions */
bool SHAREMIND_MAP_KEY_LESS_unsigned(unsigned const k1, unsigned const k2) {
  return k1 < k2;
}


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

x86 assembly (clang, -O2):
<SHAREMIND_MAP_KEY_LESS_unsigned>:
xor    %eax,%eax
cmp    %esi,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @SHAREMIND_MAP_KEY_LESS_unsigned(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp ult i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @SHAREMIND_MAP_KEY_LESS_unsigned(i32 %0, i32 %1) {
%3 = icmp ult i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
void segment_not_present() {
  __asm__ __volatile__("cli");
  SetTextColor(0x04 | 0x08, 0x00);
  kprintf("\nERROR: segment_not_present\n");
  do {
    __asm__ __volatile__("cli  \n\t"
                         "hlt");
  } while (1 == 1);
}


x86 assembly (clang, -O0):
<segment_not_present>:
push   %rbp
mov    %rsp,%rbp
cli
mov    $0xc,%edi
xor    %esi,%esi
mov    $0x0,%al
call   1030 <SetTextColor@plt>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1040 <kprintf@plt>
cli
hlt
mov    $0x1,%al
test   $0x1,%al
jne    1141 <segment_not_present+0x21>
jmp    1152 <segment_not_present+0x32>
pop    %rbp
ret

x86 assembly (clang, -O2):
<segment_not_present>:
push   %rax
cli
mov    $0xc,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <SetTextColor@plt>
lea    0xec9(%rip),%rdi
xor    %eax,%eax
call   1040 <kprintf@plt>
xchg   %ax,%ax
cli
hlt
jmp    1140 <segment_not_present+0x20>

LLVM IR (-O0):
@.str = [29 x i8] c"\0AERROR: segment_not_present\0A\00"
define void @segment_not_present() {
%1 = call i32 (i32, i32, ...) bitcast (i32 (...)* @SetTextColor to i32 (i32, i32, ...)*)(i32 12, i32 0)
%2 = call i32 (i8*, ...) bitcast (i32 (...)* @kprintf to i32 (i8*, ...)*)(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %4, %0
br label %4
4: ; preds = %3
br i1 true, label %3, label %5
5: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"\0AERROR: segment_not_present\0A\00"
define void @segment_not_present() {
tail call void asm sideeffect "cli", "~{dirflag},~{fpsr},~{flags}"()
%1 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @SetTextColor to i32 (i32, i32, ...)*)(i32 12, i32 0)
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprintf to i32 (i8*, ...)*)(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %3, %0
tail call void asm sideeffect "cli \0A\09hlt", "~{dirflag},~{fpsr},~{flags}"()
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void stack_overflow() {
  printf("stack overflow\n");
  return;
}


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"stack overflow\0A\00"
define void @stack_overflow() {
%1 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [15 x i8] c"stack overflow\00"
define void @stack_overflow() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
unsigned char eb_calc_crc_byte(unsigned char const, unsigned char);
unsigned char eb_calc_crc(const unsigned char *buf, int buflen) {
  int i;
  unsigned char crc = 0;
  for (i = 0; i < buflen; i++, buf++)
    crc = eb_calc_crc_byte(*buf, crc);
  return crc;
}


x86 assembly (clang, -O0):
<eb_calc_crc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movb   $0x0,-0x11(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1165 <eb_calc_crc+0x55>
mov    -0x8(%rbp),%rax
mov    (%rax),%al
movzbl %al,%edi
movzbl -0x11(%rbp),%esi
call   1030 <eb_calc_crc_byte@plt>
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    112a <eb_calc_crc+0x1a>
movzbl -0x11(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eb_calc_crc>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1148 <eb_calc_crc+0x38>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%r14,%rbx,1),%edi
movzbl %al,%esi
call   1030 <eb_calc_crc_byte@plt>
add    $0x1,%rbx
cmp    %ebx,%r15d
jne    1130 <eb_calc_crc+0x20>
jmp    114a <eb_calc_crc+0x3a>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define zeroext i8 @eb_calc_crc(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2, %4
%5 = phi i8 [ %9, %4 ], [ 0, %2 ]
%6 = phi i32 [ %10, %4 ], [ 0, %2 ]
%7 = phi i8* [ %11, %4 ], [ %0, %2 ]
%8 = load i8, i8* %7
%9 = tail call zeroext i8 @eb_calc_crc_byte(i8 zeroext %8, i8 zeroext %5)
%10 = add nuw nsw i32 %6, 1
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = icmp eq i32 %10, %1
br i1 %12, label %13, label %4
13: ; preds = %4, %2
%14 = phi i8 [ 0, %2 ], [ %9, %4 ]
ret i8 %14
}
int decay_response(int k) {
  if (k < 1)
    return (int)(1.2 * 30000.0);
  if (k > 800)
    return 0;
  return (int)(1.2 * 30000.0 * (800 - k) / (1.0 * 800));
}


x86 assembly (clang, -O0):
<decay_response>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    111d <decay_response+0x1d>
movl   $0x8ca0,-0x4(%rbp)
jmp    1161 <decay_response+0x61>
cmpl   $0x320,-0x8(%rbp)
jle    1136 <decay_response+0x36>
movl   $0x0,-0x4(%rbp)
jmp    1161 <decay_response+0x61>
mov    $0x320,%eax
sub    -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm1
movsd  0xebe(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xeaa(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decay_response>:
test   %edi,%edi
jle    112e <decay_response+0x2e>
xor    %eax,%eax
cmp    $0x320,%edi
ja     112d <decay_response+0x2d>
mov    $0x320,%eax
sub    %edi,%eax
cvtsi2sd %eax,%xmm0
mulsd  0xedf(%rip),%xmm0
divsd  0xedf(%rip),%xmm0
cvttsd2si %xmm0,%eax
ret
mov    $0x8ca0,%eax
ret

LLVM IR (-O0):
define i32 @decay_response(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 1
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 36000, i32* %2
br label %18
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 800
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 0, i32* %2
br label %18
11: ; preds = %7
%12 = load i32, i32* %3
%13 = sub nsw i32 800, %12
%14 = sitofp i32 %13 to double
%15 = fmul double 3.600000e+04, %14
%16 = fdiv double %15, 8.000000e+02
%17 = fptosi double %16 to i32
store i32 %17, i32* %2
br label %18
18: ; preds = %11, %10, %6
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @decay_response(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = icmp ugt i32 %0, 800
br i1 %4, label %11, label %5
5: ; preds = %3
%6 = sub nuw nsw i32 800, %0
%7 = sitofp i32 %6 to double
%8 = fmul double %7, 3.600000e+04
%9 = fdiv double %8, 8.000000e+02
%10 = fptosi double %9 to i32
br label %11
11: ; preds = %3, %1, %5
%12 = phi i32 [ %10, %5 ], [ 36000, %1 ], [ 0, %3 ]
ret i32 %12
}
__attribute__((noipa)) int foo(int x) {
  x &= 63;
  x -= 50;
  x |= 1;
  if (x < 0)
    return 1;
  int y = x >> 2;
  if (x >= y)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x3f,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x32,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1138 <foo+0x38>
movl   $0x1,-0x4(%rbp)
jmp    1160 <foo+0x60>
mov    -0x8(%rbp),%eax
sar    $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1159 <foo+0x59>
movl   $0x1,-0x4(%rbp)
jmp    1160 <foo+0x60>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
and    $0x3f,%edi
add    $0xffffffce,%edi
mov    %edi,%eax
or     $0x1,%eax
sets   %cl
sar    $0x2,%edi
cmp    %edi,%eax
setge  %al
or     %cl,%al
movzbl %al,%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = and i32 %0, 63
%3 = add nsw i32 %2, -50
%4 = or i32 %3, 1
%5 = icmp slt i32 %4, 0
%6 = ashr i32 %3, 2
%7 = icmp sge i32 %4, %6
%8 = or i1 %5, %7
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int BIT(int);
int wpa_key_mgmt_ft_psk(int akm) { return !!(akm & BIT(6)); }


x86 assembly (clang, -O0):
<wpa_key_mgmt_ft_psk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x6,%edi
call   1030 <BIT@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wpa_key_mgmt_ft_psk>:
push   %rbx
mov    %edi,%ebx
mov    $0x6,%edi
call   1030 <BIT@plt>
xor    %ecx,%ecx
test   %ebx,%eax
setne  %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @wpa_key_mgmt_ft_psk(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @BIT(i32 6)
%5 = and i32 %3, %4
%6 = icmp ne i32 %5, 0
%7 = xor i1 %6, true
%8 = xor i1 %7, true
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @wpa_key_mgmt_ft_psk(i32 %0) {
%2 = tail call i32 @BIT(i32 6)
%3 = and i32 %2, %0
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ sscanf(char *, char *, float *);
float iatof(char *str) {
  float va;
  sscanf(str, "%f", &va);
  return va;
}


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

x86 assembly (clang, -O2):
<iatof>:
push   %rax
lea    0xee8(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1030 <sscanf@plt>
movss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
define float @iatof(i8* %0) {
%2 = alloca i8*
%3 = alloca float
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %3)
%6 = load float, float* %3
ret float %6
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
define float @iatof(i8* nocapture %0) {
%2 = alloca float
%3 = bitcast float* %2 to i8*
%4 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %2)
%5 = load float, float* %2
ret float %5
}
/* Variables and functions */
long SEND(void *, int, int);
long NETsendData(void *pData, int Size, int Mode) {
  return SEND(pData, Size, Mode);
}


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

x86 assembly (clang, -O2):
<NETsendData>:
jmp    1030 <SEND@plt>

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

LLVM IR (-O2):
define i64 @NETsendData(i8* %0, i32 %1, i32 %2) {
%4 = tail call i64 @SEND(i8* %0, i32 %1, i32 %2)
ret i64 %4
}
__attribute__((no, noclone)) int f8(void *a, int b, long long c, long long d,
                                    long long e, char *f, const char **g,
                                    int *h, int *i) {
  asm volatile("" : : "r"(a), "r"(b), "r"(c), "r"(d) : "memory");
  asm volatile("" : : "r"(e), "r"(f), "r"(g), "r"(h) : "memory");
  asm volatile("" : : "r"(i) : "memory");
  return 0;
}


x86 assembly (clang, -O0):
<f8>:
push   %rbp
mov    %rsp,%rbp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    0x10(%rbp),%rdx
mov    0x18(%rbp),%rsi
mov    0x20(%rbp),%rax
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f8>:
mov    0x18(%rsp),%r10
mov    0x8(%rsp),%r11
mov    0x10(%rsp),%rax
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @f8(i8* %0, i32 %1, i64 %2, i64 %3, i64 %4, i8* %5, i8** %6, i32* %7, i32* %8) {
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i8*
%16 = alloca i8**
%17 = alloca i32*
%18 = alloca i32*
store i8* %0, i8** %10
store i32 %1, i32* %11
store i64 %2, i64* %12
store i64 %3, i64* %13
store i64 %4, i64* %14
store i8* %5, i8** %15
store i8** %6, i8*** %16
store i32* %7, i32** %17
store i32* %8, i32** %18
%19 = load i8*, i8** %10
%20 = load i32, i32* %11
%21 = load i64, i64* %12
%22 = load i64, i64* %13
%23 = load i64, i64* %14
%24 = load i8*, i8** %15
%25 = load i8**, i8*** %16
%26 = load i32*, i32** %17
%27 = load i32*, i32** %18
ret i32 0
}

LLVM IR (-O2):
define i32 @f8(i8* %0, i32 %1, i64 %2, i64 %3, i64 %4, i8* %5, i8** %6, i32* %7, i32* %8) {
tail call void asm sideeffect "", "r,r,r,r,~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %0, i32 %1, i64 %2, i64 %3)
tail call void asm sideeffect "", "r,r,r,r,~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %4, i8* %5, i8** %6, i32* %7)
tail call void asm sideeffect "", "r,~{memory},~{dirflag},~{fpsr},~{flags}"(i32* %8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ SIGKILL;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ kill(int, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int wait(int *);
void monitor_and_kill(int child1, int child2) {
  int child;
  int status;
  child = wait(&status);
  if (child == -1)
    perror("wait");
  kill(child1, SIGKILL);
  kill(child2, SIGKILL);
  exit(0);
}


x86 assembly (clang, -O0):
<monitor_and_kill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
call   1060 <wait@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1170 <monitor_and_kill+0x30>
lea    0xe95(%rip),%rdi
call   1040 <perror@plt>
mov    -0x4(%rbp),%edi
mov    0x2e66(%rip),%rax
mov    (%rax),%esi
call   1030 <kill@plt>
mov    -0x8(%rbp),%edi
mov    0x2e55(%rip),%rax
mov    (%rax),%esi
call   1030 <kill@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<monitor_and_kill>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%r14d
mov    %edi,%ebp
lea    0xc(%rsp),%rdi
call   1060 <wait@plt>
cmp    $0xffffffff,%eax
jne    1168 <monitor_and_kill+0x28>
lea    0xe9d(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e71(%rip),%rbx
mov    (%rbx),%esi
mov    %ebp,%edi
call   1030 <kill@plt>
mov    (%rbx),%esi
mov    %r14d,%edi
call   1030 <kill@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"wait\00"
@SIGKILL = global i32 0
define void @monitor_and_kill(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = call i32 @wait(i32* %6)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %2
%13 = load i32, i32* %3
%14 = load i32, i32* @SIGKILL
%15 = call i32 @kill(i32 %13, i32 %14)
%16 = load i32, i32* %4
%17 = load i32, i32* @SIGKILL
%18 = call i32 @kill(i32 %16, i32 %17)
%19 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [5 x i8] c"wait\00"
@SIGKILL = global i32 0
define void @monitor_and_kill(i32 %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @wait(i32* %3)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %2
%10 = load i32, i32* @SIGKILL
%11 = call i32 @kill(i32 %0, i32 %10)
%12 = load i32, i32* @SIGKILL
%13 = call i32 @kill(i32 %1, i32 %12)
%14 = call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ islower(int);
void t_islower_0xaf() {
  Assert_real((islower(175) == 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_islower.c",
              880, ("islower should be 0 for 0xaf"));
}


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

x86 assembly (clang, -O2):
<t_islower_0xaf>:
push   %rax
mov    $0xaf,%edi
call   1030 <islower@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x370,%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_islower.c\00"
@.str.1 = [29 x i8] c"islower should be 0 for 0xaf\00"
define void @t_islower_0xaf() {
%1 = call i64 @islower(i32 175)
%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 880, 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_islower.c\00"
@.str.1 = [29 x i8] c"islower should be 0 for 0xaf\00"
define void @t_islower_0xaf() {
%1 = tail call i64 @islower(i32 175)
%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 880, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
struct sock_fprog {
  int dummy;
};

/* Variables and functions */
int __bpf_l4v6_hash(struct sock_fprog *, int);
int bpf_novlan_l4v6_hash(struct sock_fprog *fprog) {
  return __bpf_l4v6_hash(fprog, false);
}


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

x86 assembly (clang, -O2):
<bpf_novlan_l4v6_hash>:
xor    %esi,%esi
jmp    1030 <__bpf_l4v6_hash@plt>

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

LLVM IR (-O2):
%struct.sock_fprog = type { i32 }
define i32 @bpf_novlan_l4v6_hash(%struct.sock_fprog* %0) {
%2 = tail call i32 @__bpf_l4v6_hash(%struct.sock_fprog* %0, i32 0)
ret i32 %2
}
int sysTime() {}


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

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

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

LLVM IR (-O2):
define i32 @sysTime() {
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_add_epi32(int /*<<< orphan*/, int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm_set1_epi32(int);
int /*<<< orphan*/ _mm_srli_epi32(int /*<<< orphan*/ const, int);
__m128i xx_roundn_epu32(__m128i v_val_d, int bits) {
  const __m128i v_bias_d = _mm_set1_epi32((1 << bits) >> 1);
  const __m128i v_tmp_d = _mm_add_epi32(v_val_d, v_bias_d);
  return _mm_srli_epi32(v_tmp_d, bits);
}


x86 assembly (clang, -O0):
<xx_roundn_epu32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%edi
shl    %cl,%edi
sar    $0x1,%edi
call   1040 <_mm_set1_epi32@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <_mm_srli_epi32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xx_roundn_epu32>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x1,%edi
mov    %ebx,%ecx
shl    %cl,%edi
sar    %edi
call   1040 <_mm_set1_epi32@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <_mm_add_epi32@plt>
mov    %eax,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <_mm_srli_epi32@plt>

LLVM IR (-O0):
define i32 @xx_roundn_epu32(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = shl i32 1, %7
%9 = ashr i32 %8, 1
%10 = call i32 @_mm_set1_epi32(i32 %9)
store i32 %10, i32* %5
%11 = load i32, i32* %3
%12 = load i32, i32* %5
%13 = call i32 @_mm_add_epi32(i32 %11, i32 %12)
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = load i32, i32* %4
%16 = call i32 @_mm_srli_epi32(i32 %14, i32 %15)
ret i32 %16
}

LLVM IR (-O2):
define i32 @xx_roundn_epu32(i32 %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = ashr i32 %3, 1
%5 = tail call i32 @_mm_set1_epi32(i32 %4)
%6 = tail call i32 @_mm_add_epi32(i32 %0, i32 %5)
%7 = tail call i32 @_mm_srli_epi32(i32 %6, i32 %1)
ret i32 %7
}
int foo(_Bool a, _Bool b) {
  if (a && b)
    return doo();
  return 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
and    $0x1,%cl
mov    %cl,-0x5(%rbp)
and    $0x1,%al
mov    %al,-0x6(%rbp)
testb  $0x1,-0x5(%rbp)
je     114c <foo+0x3c>
testb  $0x1,-0x6(%rbp)
je     114c <foo+0x3c>
mov    $0x0,%al
call   1030 <doo@plt>
mov    %eax,-0x4(%rbp)
jmp    1153 <foo+0x43>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
test   %edi,%edi
je     1120 <foo+0x10>
test   %sil,%sil
je     1120 <foo+0x10>
xor    %eax,%eax
jmp    1030 <doo@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i1 zeroext %0, i1 zeroext %1) {
%3 = and i1 %0, %1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @doo()
br label %6
6: ; preds = %2, %4
%7 = phi i32 [ %5, %4 ], [ 0, %2 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void zng_free(void *ptr) { free(ptr); }


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

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

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

LLVM IR (-O2):
define void @zng_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
__attribute__((always_)) void hp2(void) { printf("hello, world!\n"); }


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"hello, world!\0A\00"
define void @hp2() {
%1 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [14 x i8] c"hello, world!\00"
define void @hp2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef scalar_t__ uint32_t;
typedef size_t ssize_t;

/* Variables and functions */
uint8_t uint32_less_p(void *a, ssize_t b, ssize_t c) {
  return ((((uint32_t *)(a))[b] < ((uint32_t *)(a))[c]));
}


x86 assembly (clang, -O0):
<uint32_less_p>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%rdx
cmp    (%rcx,%rdx,8),%rax
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uint32_less_p>:
mov    (%rdi,%rsi,8),%rcx
xor    %eax,%eax
cmp    (%rdi,%rdx,8),%rcx
setl   %al
ret

LLVM IR (-O0):
define i32 @uint32_less_p(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 i8*, i8** %4
%8 = bitcast i8* %7 to i64*
%9 = load i64, i64* %5
%10 = getelementptr inbounds i64, i64* %8, i64 %9
%11 = load i64, i64* %10
%12 = load i8*, i8** %4
%13 = bitcast i8* %12 to i64*
%14 = load i64, i64* %6
%15 = getelementptr inbounds i64, i64* %13, i64 %14
%16 = load i64, i64* %15
%17 = icmp slt i64 %11, %16
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @uint32_less_p(i8* nocapture %0, i64 %1, i64 %2) {
%4 = bitcast i8* %0 to i64*
%5 = getelementptr inbounds i64, i64* %4, i64 %1
%6 = load i64, i64* %5
%7 = getelementptr inbounds i64, i64* %4, i64 %2
%8 = load i64, i64* %7
%9 = icmp slt i64 %6, %8
%10 = zext i1 %9 to i32
ret i32 %10
}
int test_imm_B0int32_reg(int val) { return ((val) & (0xB0 << 0)) ? -20 : -40; }


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

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

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

LLVM IR (-O2):
define i32 @test_imm_B0int32_reg(i32 %0) {
%2 = and i32 %0, 176
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int k_unlog(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @k_unlog() {
ret i32 0
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
void led_on(void) { *(volatile uint16_t *)0x40020c14 |= 0x2000; }


x86 assembly (clang, -O0):
<led_on>:
push   %rbp
mov    %rsp,%rbp
mov    $0x40020c14,%eax
mov    (%rax),%ecx
or     $0x2000,%ecx
mov    $0x40020c14,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<led_on>:
orl    $0x2000,0x40020c14
ret

LLVM IR (-O0):
define void @led_on() {
%1 = load volatile i32, i32* inttoptr (i64 1073875988 to i32*)
%2 = or i32 %1, 8192
store volatile i32 %2, i32* inttoptr (i64 1073875988 to i32*)
ret void
}

LLVM IR (-O2):
define void @led_on() {
%1 = load volatile i32, i32* inttoptr (i64 1073875988 to i32*)
%2 = or i32 %1, 8192
store volatile i32 %2, i32* inttoptr (i64 1073875988 to i32*)
ret void
}
/* Variables and functions */
int f(int);
int g(int i) { return f(i); }


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

x86 assembly (clang, -O2):
<g>:
jmp    1030 <f@plt>

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

LLVM IR (-O2):
define i32 @g(i32 %0) {
%2 = tail call i32 @f(i32 %0)
ret i32 %2
}