xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void switch3() {
  int x = 3;
  switch (x) {
  case 6:
    puts("x = 6");
    break;
  case 5:
    puts("x == 5");
  case 4:
    puts("x >= 4");
  case 3:
    puts("x >= 3");
    break;
  default:
    puts("x < 3 o x > 6");
    break;
  }
}


x86 assembly (clang, -O0):
<switch3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x3,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xfffffffd,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     1182 <switch3+0x72>
mov    -0x10(%rbp),%rax
lea    0xec1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
jmp    118e <switch3+0x7e>
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb1(%rip),%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rdi
call   1030 <puts@plt>
jmp    118e <switch3+0x7e>
lea    0xea2(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [6 x i8] c"x = 6\00"
@.str.1 = [7 x i8] c"x == 5\00"
@.str.2 = [7 x i8] c"x >= 4\00"
@.str.3 = [7 x i8] c"x >= 3\00"
@.str.4 = [14 x i8] c"x < 3 o x > 6\00"
define void @switch3() {
%1 = alloca i32
store i32 3, i32* %1
%2 = load i32, i32* %1
switch i32 %2, label %11 [
i32 6, label %3
i32 5, label %5
i32 4, label %7
i32 3, label %9
]
3: ; preds = %0
%4 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %13
5: ; preds = %0
%6 = call i32 @puts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %0, %5
%8 = call i32 @puts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %9
9: ; preds = %0, %7
%10 = call i32 @puts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %13
11: ; preds = %0
%12 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
br label %13
13: ; preds = %11, %9, %3
ret void
}

LLVM IR (-O2):
@.str.3 = [7 x i8] c"x >= 3\00"
define void @switch3() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
ret void
}
/* Variables and functions */
int strlen(char const *);
int /*<<< orphan*/ strncasecmp(char const *, char const *, int);
int match_string(const char *ref, const char *candidate) {
  int len = strlen(ref);
  return !strncasecmp(ref, candidate, len);
}


x86 assembly (clang, -O0):
<match_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <strncasecmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<match_string>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1040 <strncasecmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @match_string(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %5
%8 = load i8*, i8** %3
%9 = load i8*, i8** %4
%10 = load i32, i32* %5
%11 = call i32 @strncasecmp(i8* %8, i8* %9, i32 %10)
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @match_string(i8* %0, i8* nocapture %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strncasecmp(i8* %0, i8* %1, i32 %3)
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
double my_rand(double seed) {
  double t = 16807.0 * seed + 1;
  double floor();
  seed = t - (2147483647.0 * floor(t / 2147483647.0));
  return seed;
}


x86 assembly (clang, -O0):
<my_rand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xee6(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xee2(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xeb2(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <floor@plt>
movsd  -0x18(%rbp),%xmm1
movsd  0xe94(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_rand>:
push   %rax
mulsd  0xee7(%rip),%xmm0
addsd  0xee7(%rip),%xmm0
movsd  %xmm0,(%rsp)
divsd  0xee2(%rip),%xmm0
call   1030 <floor@plt>
mulsd  0xedd(%rip),%xmm0
addsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @my_rand(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = call double @llvm.fmuladd.f64(double 1.680700e+04, double %4, double 1.000000e+00)
store double %5, double* %3
%6 = load double, double* %3
%7 = load double, double* %3
%8 = fdiv double %7, 0x41DFFFFFFFC00000
%9 = call double @llvm.floor.f64(double %8)
%10 = call double @llvm.fmuladd.f64(double 0xC1DFFFFFFFC00000, double %9, double %6)
store double %10, double* %2
%11 = load double, double* %2
ret double %11
}

LLVM IR (-O2):
define double @my_rand(double %0) {
%2 = tail call double @llvm.fmuladd.f64(double %0, double 1.680700e+04, double 1.000000e+00)
%3 = fdiv double %2, 0x41DFFFFFFFC00000
%4 = tail call double @llvm.floor.f64(double %3)
%5 = tail call double @llvm.fmuladd.f64(double %4, double 0xC1DFFFFFFFC00000, double %2)
ret double %5
}
/* Variables and functions */
int inp_emulate(int);
char TOSH_READ_ONE_WIRE_PIN() { return 0x01 & (inp_emulate(0x71) >> 5); }


x86 assembly (clang, -O0):
<TOSH_READ_ONE_WIRE_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0x71,%edi
call   1030 <inp_emulate@plt>
sar    $0x5,%eax
and    $0x1,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_READ_ONE_WIRE_PIN>:
push   %rax
mov    $0x71,%edi
call   1030 <inp_emulate@plt>
shr    $0x5,%al
and    $0x1,%al
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @TOSH_READ_ONE_WIRE_PIN() {
%1 = call i32 @inp_emulate(i32 113)
%2 = ashr i32 %1, 5
%3 = and i32 1, %2
%4 = trunc i32 %3 to i8
ret i8 %4
}

LLVM IR (-O2):
define signext i8 @TOSH_READ_ONE_WIRE_PIN() {
%1 = tail call i32 @inp_emulate(i32 113)
%2 = trunc i32 %1 to i8
%3 = lshr i8 %2, 5
%4 = and i8 %3, 1
ret i8 %4
}
/* Variables and functions */
int /*<<< orphan*/ EVP_sha256();
int cryptoCalculateHash(unsigned char *, int const, unsigned char const *,
                        int const, int /*<<< orphan*/);
int cryptoCalculateSHA256(unsigned char *hash_buf, const int hash_len,
                          const unsigned char *in_buf, const int in_len) {
  return cryptoCalculateHash(hash_buf, hash_len, in_buf, in_len, EVP_sha256());
}


x86 assembly (clang, -O0):
<cryptoCalculateSHA256>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    $0x0,%al
call   1040 <EVP_sha256@plt>
mov    -0x38(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%ecx
mov    %eax,%r8d
call   1030 <cryptoCalculateHash@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cryptoCalculateSHA256>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <EVP_sha256@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r15,%rdx
mov    %r14d,%ecx
mov    %eax,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <cryptoCalculateHash@plt>

LLVM IR (-O0):
define i32 @cryptoCalculateSHA256(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = load i8*, i8** %7
%12 = load i32, i32* %8
%13 = call i32 (...) @EVP_sha256()
%14 = call i32 @cryptoCalculateHash(i8* %9, i32 %10, i8* %11, i32 %12, i32 %13)
ret i32 %14
}

LLVM IR (-O2):
define i32 @cryptoCalculateSHA256(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = tail call i32 (...) @EVP_sha256()
%6 = tail call i32 @cryptoCalculateHash(i8* %0, i32 %1, i8* %2, i32 %3, i32 %5)
ret i32 %6
}
/* Type definitions */
struct TIC_conf {
  int dummy;
};
struct TIC_Route {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ dolog(int, char *, struct TIC_conf *, char const *);
struct TIC_Route *tic_GetRoute(struct TIC_conf *tic, const char *sId) {
  dolog(3, "Not implemented - tic_GetRoute(%x, \"%s\")\n", tic, sId);
  return NULL;
}


x86 assembly (clang, -O0):
<tic_GetRoute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    $0x3,%edi
lea    0xecc(%rip),%rsi
call   1030 <dolog@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tic_GetRoute>:
push   %rax
mov    %rsi,%rcx
mov    %rdi,%rdx
lea    0xee2(%rip),%rsi
mov    $0x3,%edi
call   1030 <dolog@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.TIC_Route = type { i32 }
%struct.TIC_conf = type { i32 }
@.str = [42 x i8] c"Not implemented - tic_GetRoute(%x, \22%s\22)\0A\00"
define %struct.TIC_Route* @tic_GetRoute(%struct.TIC_conf* %0, i8* %1) {
%3 = alloca %struct.TIC_conf*
%4 = alloca i8*
store %struct.TIC_conf* %0, %struct.TIC_conf** %3
store i8* %1, i8** %4
%5 = load %struct.TIC_conf*, %struct.TIC_conf** %3
%6 = load i8*, i8** %4
%7 = call i32 @dolog(i32 3, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), %struct.TIC_conf* %5, i8* %6)
ret %struct.TIC_Route* null
}

LLVM IR (-O2):
%struct.TIC_Route = type { i32 }
%struct.TIC_conf = type { i32 }
@.str = [42 x i8] c"Not implemented - tic_GetRoute(%x, \22%s\22)\0A\00"
define noalias %struct.TIC_Route* @tic_GetRoute(%struct.TIC_conf* %0, i8* %1) {
%3 = tail call i32 @dolog(i32 3, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), %struct.TIC_conf* %0, i8* %1)
ret %struct.TIC_Route* null
}
int tk_geval(command)
char *command;
{ return 0; }


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

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

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

LLVM IR (-O2):
define i32 @tk_geval(i8* nocapture readnone %0) {
ret i32 0
}
void tcpmsg_init(char **buf) { *buf += 4; }


x86 assembly (clang, -O0):
<tcpmsg_init>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x4,%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcpmsg_init>:
addq   $0x4,(%rdi)
ret

LLVM IR (-O0):
define void @tcpmsg_init(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 4
store i8* %5, i8** %3
ret void
}

LLVM IR (-O2):
define void @tcpmsg_init(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = getelementptr inbounds i8, i8* %2, i64 4
store i8* %3, i8** %0
ret void
}
char *get_log_path() {}


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

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

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

LLVM IR (-O2):
define noalias i8* @get_log_path() {
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ ArgNum();
int /*<<< orphan*/ SetFlag(int /*<<< orphan*/, int);
void Act_Set(void) { SetFlag(ArgNum(), 255); }


x86 assembly (clang, -O0):
<Act_Set>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <ArgNum@plt>
mov    %eax,%edi
mov    $0xff,%esi
call   1030 <SetFlag@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Act_Set>:
push   %rax
xor    %eax,%eax
call   1040 <ArgNum@plt>
mov    %eax,%edi
mov    $0xff,%esi
pop    %rax
jmp    1030 <SetFlag@plt>

LLVM IR (-O0):
define void @Act_Set() {
%1 = call i32 (...) @ArgNum()
%2 = call i32 @SetFlag(i32 %1, i32 255)
ret void
}

LLVM IR (-O2):
define void @Act_Set() {
%1 = tail call i32 (...) @ArgNum()
%2 = tail call i32 @SetFlag(i32 %1, i32 255)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AssertFailure(char *, int);
int /*<<< orphan*/ UARTBaseValid(unsigned long);
void UARTRxErrorClear(unsigned long ulBase) {
  {
    if (!(UARTBaseValid(ulBase))) {
      AssertFailure(
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/AmesianX/OpenBLT/refs/heads/master/Target/"
          "Demo/ARMCM3_LM3S_EK_LM3S8962_Crossworks/Boot/lib/driverlib/"
          "uartlib.c",
          1597);
    }
  };
  (*((volatile unsigned long *)(ulBase + 0x00000004))) = 0;
}


x86 assembly (clang, -O0):
<UARTRxErrorClear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <UARTBaseValid@plt>
cmp    $0x0,%eax
jne    114f <UARTRxErrorClear+0x2f>
lea    0xebb(%rip),%rdi
mov    $0x63d,%esi
call   1030 <AssertFailure@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,0x4(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTRxErrorClear>:
push   %rbx
mov    %rdi,%rbx
call   1040 <UARTBaseValid@plt>
test   %eax,%eax
jne    113e <UARTRxErrorClear+0x1e>
lea    0xecc(%rip),%rdi
mov    $0x63d,%esi
call   1030 <AssertFailure@plt>
movq   $0x0,0x4(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
@.str = [201 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AmesianX/OpenBLT/refs/heads/master/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_Crossworks/Boot/lib/driverlib/uartlib.c\00"
define void @UARTRxErrorClear(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @UARTBaseValid(i64 %3)
%5 = icmp ne i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = call i32 @AssertFailure(i8* getelementptr inbounds ([201 x i8], [201 x i8]* @.str, i64 0, i64 0), i32 1597)
br label %8
8: ; preds = %6, %1
%9 = load i64, i64* %2
%10 = add i64 %9, 4
%11 = inttoptr i64 %10 to i64*
store volatile i64 0, i64* %11
ret void
}

LLVM IR (-O2):
@.str = [201 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AmesianX/OpenBLT/refs/heads/master/Target/Demo/ARMCM3_LM3S_EK_LM3S8962_Crossworks/Boot/lib/driverlib/uartlib.c\00"
define void @UARTRxErrorClear(i64 %0) {
%2 = tail call i32 @UARTBaseValid(i64 %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @AssertFailure(i8* getelementptr inbounds ([201 x i8], [201 x i8]* @.str, i64 0, i64 0), i32 1597)
br label %6
6: ; preds = %4, %1
%7 = add i64 %0, 4
%8 = inttoptr i64 %7 to i64*
store volatile i64 0, i64* %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ FreeMemory(void *);
void AAS_RoutingFreeMemory(void *ptr) { FreeMemory(ptr); }


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

x86 assembly (clang, -O2):
<AAS_RoutingFreeMemory>:
jmp    1030 <FreeMemory@plt>

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

LLVM IR (-O2):
define void @AAS_RoutingFreeMemory(i8* %0) {
%2 = tail call i32 @FreeMemory(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void hello() { printf("Hello!"); }


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

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"Hello!\00"
define void @hello() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fatal(char *);
void *malloc(size_t const);
void *xmalloc(const size_t size) {
  void *p;
  if ((p = malloc(size)) == NULL)
    fatal("Can't allocate memory!");
  return p;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    114f <xmalloc+0x2f>
lea    0xeb6(%rip),%rdi
call   1040 <fatal@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rbx
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <xmalloc+0x1a>
lea    0xecb(%rip),%rdi
call   1040 <fatal@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Can't allocate memory!\00"
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @fatal(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = load i8*, i8** %3
ret i8* %10
}

LLVM IR (-O2):
@.str = [23 x i8] c"Can't allocate memory!\00"
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @fatal(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
int stringSize(char *data) {
  int dataSize = 0;
  while (data[dataSize] != 0) {
    dataSize++;
  }
  return dataSize;
}


x86 assembly (clang, -O0):
<stringSize>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1132 <stringSize+0x32>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <stringSize+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringSize>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <stringSize+0x10>
ret

LLVM IR (-O0):
define i32 @stringSize(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %12, %1
%5 = load i8*, i8** %2
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %4
%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 @stringSize(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
unsigned int isXDigit(int s) {
  if (((s >= 'a') && (s <= 'f')) || ((s >= 'A') && (s <= 'F')) ||
      ((s >= '0') && (s <= '9'))) {
    return (1);
  } else {
    return (0);
  }
}


x86 assembly (clang, -O0):
<isXDigit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x61,-0x8(%rbp)
jl     111b <isXDigit+0x1b>
cmpl   $0x66,-0x8(%rbp)
jle    1143 <isXDigit+0x43>
cmpl   $0x41,-0x8(%rbp)
jl     112f <isXDigit+0x2f>
cmpl   $0x46,-0x8(%rbp)
jle    1143 <isXDigit+0x43>
cmpl   $0x30,-0x8(%rbp)
jl     114f <isXDigit+0x4f>
cmpl   $0x39,-0x8(%rbp)
jg     114f <isXDigit+0x4f>
movl   $0x1,-0x4(%rbp)
jmp    1156 <isXDigit+0x56>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isXDigit>:
mov    %edi,%eax
and    $0xffffffdf,%eax
add    $0xffffffbf,%eax
cmp    $0x6,%eax
setb   %al
add    $0xffffffd0,%edi
cmp    $0xa,%edi
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @isXDigit(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 97
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 102
br i1 %8, label %21, label %9
9: ; preds = %6, %1
%10 = load i32, i32* %3
%11 = icmp sge i32 %10, 65
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load i32, i32* %3
%14 = icmp sle i32 %13, 70
br i1 %14, label %21, label %15
15: ; preds = %12, %9
%16 = load i32, i32* %3
%17 = icmp sge i32 %16, 48
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load i32, i32* %3
%20 = icmp sle i32 %19, 57
br i1 %20, label %21, label %22
21: ; preds = %18, %12, %6
store i32 1, i32* %2
br label %23
22: ; preds = %18, %15
store i32 0, i32* %2
br label %23
23: ; preds = %22, %21
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @isXDigit(i32 %0) {
%2 = and i32 %0, -33
%3 = add i32 %2, -65
%4 = icmp ult i32 %3, 6
%5 = add i32 %0, -48
%6 = icmp ult i32 %5, 10
%7 = or i1 %6, %4
%8 = zext i1 %7 to i32
ret i32 %8
}
int cmp_entry(const void *l, const void *r) {
  return *(const double *)l - *(const double *)r;
}


x86 assembly (clang, -O0):
<cmp_entry>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_entry>:
movsd  (%rdi),%xmm0
subsd  (%rsi),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @cmp_entry(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to double*
%7 = load double, double* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to double*
%10 = load double, double* %9
%11 = fsub double %7, %10
%12 = fptosi double %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @cmp_entry(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = load double, double* %3
%5 = bitcast i8* %1 to double*
%6 = load double, double* %5
%7 = fsub double %4, %6
%8 = fptosi double %7 to i32
ret i32 %8
}
/* Variables and functions */
scalar_t__ MatchClass(char, char);
char *PolyStrchr(char *string, char clazz) {
  while (*string) {
    if (MatchClass(clazz, *string)) {
      return (string);
    }
    string++;
  }
  return ((char *)0);
}


x86 assembly (clang, -O0):
<PolyStrchr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1169 <PolyStrchr+0x59>
mov    -0x11(%rbp),%cl
mov    -0x10(%rbp),%rax
movsbl %cl,%edi
movsbl (%rax),%esi
call   1030 <MatchClass@plt>
cmp    $0x0,%rax
je     1158 <PolyStrchr+0x48>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1171 <PolyStrchr+0x61>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1122 <PolyStrchr+0x12>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PolyStrchr>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     113b <PolyStrchr+0x2b>
mov    %rdi,%rbx
movsbl %sil,%ebp
movsbl %al,%esi
mov    %ebp,%edi
call   1030 <MatchClass@plt>
test   %rax,%rax
jne    113d <PolyStrchr+0x2d>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <PolyStrchr+0x10>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @PolyStrchr(i8* %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %2, %10
%6 = phi i8 [ %12, %10 ], [ %3, %2 ]
%7 = phi i8* [ %11, %10 ], [ %0, %2 ]
%8 = tail call i64 @MatchClass(i8 signext %1, i8 signext %6)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %10, %2
%15 = phi i8* [ null, %2 ], [ null, %10 ], [ %7, %5 ]
ret i8* %15
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *mem_alloc(size_t size) {
  if (size) {
    void *new_ptr = malloc(size);
    if (new_ptr != NULL) {
      memset(new_ptr, 0, size);
      return (new_ptr);
    }
  }
  return (NULL);
}


x86 assembly (clang, -O0):
<mem_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1170 <mem_alloc+0x50>
mov    -0x10(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     116b <mem_alloc+0x4b>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1178 <mem_alloc+0x58>
jmp    1170 <mem_alloc+0x50>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_alloc>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     1148 <mem_alloc+0x28>
mov    %rdi,%rbx
call   1040 <malloc@plt>
test   %rax,%rax
je     1148 <mem_alloc+0x28>
mov    %rax,%r14
mov    %rax,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
jmp    114b <mem_alloc+0x2b>
xor    %r14d,%r14d
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @mem_alloc(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = tail call i8* @malloc(i64 %0)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @memset(i8* %4, i32 0, i64 %0)
br label %8
8: ; preds = %3, %1, %6
%9 = phi i8* [ %4, %6 ], [ null, %1 ], [ null, %3 ]
ret i8* %9
}
/* Variables and functions */
int getn(int, int /*<<< orphan*/);
int look1() { return getn(1, 0); }


x86 assembly (clang, -O0):
<look1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <getn@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<look1>:
mov    $0x1,%edi
xor    %esi,%esi
jmp    1030 <getn@plt>

LLVM IR (-O0):
define i32 @look1() {
%1 = call i32 @getn(i32 1, i32 0)
ret i32 %1
}

LLVM IR (-O2):
define i32 @look1() {
%1 = tail call i32 @getn(i32 1, i32 0)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ bsp_dma_clearBuffer();
int /*<<< orphan*/ bsp_dma_enable();
void bsp_ledsStripes_setOff() {
  bsp_dma_clearBuffer();
  bsp_dma_enable();
}


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

x86 assembly (clang, -O2):
<bsp_ledsStripes_setOff>:
push   %rax
xor    %eax,%eax
call   1040 <bsp_dma_clearBuffer@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <bsp_dma_enable@plt>

LLVM IR (-O0):
define void @bsp_ledsStripes_setOff() {
%1 = call i32 (...) @bsp_dma_clearBuffer()
%2 = call i32 (...) @bsp_dma_enable()
ret void
}

LLVM IR (-O2):
define void @bsp_ledsStripes_setOff() {
%1 = tail call i32 (...) @bsp_dma_clearBuffer()
%2 = tail call i32 (...) @bsp_dma_enable()
ret void
}
void mus_ubshort_to_char(unsigned char *j, unsigned short x) {
  unsigned char *ox;
  ox = (unsigned char *)&x;
  j[0] = ox[0];
  j[1] = ox[1];
}


x86 assembly (clang, -O0):
<mus_ubshort_to_char>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
lea    -0xa(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mus_ubshort_to_char>:
mov    %si,(%rdi)
ret

LLVM IR (-O0):
define void @mus_ubshort_to_char(i8* %0, i16 zeroext %1) {
%3 = alloca i8*
%4 = alloca i16
%5 = alloca i8*
store i8* %0, i8** %3
store i16 %1, i16* %4
%6 = bitcast i16* %4 to i8*
store i8* %6, i8** %5
%7 = load i8*, i8** %5
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 0
store i8 %9, i8* %11
%12 = load i8*, i8** %5
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = load i8, i8* %13
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8 %14, i8* %16
ret void
}

LLVM IR (-O2):
define void @mus_ubshort_to_char(i8* nocapture writeonly %0, i16 zeroext %1) {
%3 = trunc i16 %1 to i8
%4 = lshr i16 %1, 8
%5 = trunc i16 %4 to i8
store i8 %3, i8* %0
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %6
ret void
}
double ceil(double x) {
  if (x <= 0) {
    return (double)(long)x;
  } else if (x == (long)x) {
    return x;
  } else {
    return -1.0 * ceil(-1 * x) + 1.0;
  }
}


x86 assembly (clang, -O0):
<ceil>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1140 <ceil+0x30>
cvttsd2si -0x10(%rbp),%rax
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1195 <ceil+0x85>
movsd  -0x10(%rbp),%xmm0
cvttsd2si -0x10(%rbp),%rax
cvtsi2sd %rax,%xmm1
ucomisd %xmm1,%xmm0
jne    116f <ceil+0x5f>
jp     116f <ceil+0x5f>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1195 <ceil+0x85>
movsd  0xe91(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1030 <ceil@plt>
movaps %xmm0,%xmm1
movsd  0xe74(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ceil>:
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
cvttsd2si %xmm0,%rax
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
jae    1133 <ceil+0x23>
ucomisd %xmm0,%xmm1
jne    1138 <ceil+0x28>
jp     1138 <ceil+0x28>
movapd %xmm0,%xmm1
movapd %xmm1,%xmm0
ret
push   %rax
xorpd  0xebf(%rip),%xmm0
call   1030 <ceil@plt>
movsd  0xec2(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @ceil(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp ole double %4, 0.000000e+00
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load double, double* %3
%8 = fptosi double %7 to i64
%9 = sitofp i64 %8 to double
store double %9, double* %2
br label %23
10: ; preds = %1
%11 = load double, double* %3
%12 = load double, double* %3
%13 = fptosi double %12 to i64
%14 = sitofp i64 %13 to double
%15 = fcmp oeq double %11, %14
br i1 %15, label %16, label %18
16: ; preds = %10
%17 = load double, double* %3
store double %17, double* %2
br label %23
18: ; preds = %10
%19 = load double, double* %3
%20 = fmul double -1.000000e+00, %19
%21 = call double @llvm.ceil.f64(double %20)
%22 = call double @llvm.fmuladd.f64(double -1.000000e+00, double %21, double 1.000000e+00)
store double %22, double* %2
br label %23
23: ; preds = %18, %16, %6
%24 = load double, double* %2
ret double %24
}

LLVM IR (-O2):
define double @ceil(double %0) {
%2 = fcmp ugt double %0, 0.000000e+00
%3 = fptosi double %0 to i64
%4 = sitofp i64 %3 to double
br i1 %2, label %5, label %11
5: ; preds = %1
%6 = fcmp oeq double %4, %0
br i1 %6, label %11, label %7
7: ; preds = %5
%8 = fneg double %0
%9 = tail call double @llvm.ceil.f64(double %8)
%10 = tail call double @llvm.fmuladd.f64(double %9, double -1.000000e+00, double 1.000000e+00)
br label %11
11: ; preds = %1, %5, %7
%12 = phi double [ %10, %7 ], [ %0, %5 ], [ %4, %1 ]
ret double %12
}
/* Variables and functions */
scalar_t__ simple_strtoull(char const *, char **, unsigned int, size_t);
signed long long simple_strtoll(const char *cp, char **endp, unsigned int base,
                                size_t field_width) {
  if (*cp == '-')
    return -(long long)simple_strtoull(cp + 1, endp, base, field_width);
  return (long long)simple_strtoull(cp, endp, base, field_width);
}


x86 assembly (clang, -O0):
<simple_strtoll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1160 <simple_strtoll+0x50>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%rcx
call   1030 <simple_strtoull@plt>
mov    %rax,%rcx
xor    %eax,%eax
sub    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    1178 <simple_strtoll+0x68>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%rcx
call   1030 <simple_strtoull@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<simple_strtoll>:
push   %rax
cmpb   $0x2d,(%rdi)
jne    1124 <simple_strtoll+0x14>
add    $0x1,%rdi
call   1030 <simple_strtoull@plt>
neg    %rax
pop    %rcx
ret
pop    %rax
jmp    1030 <simple_strtoull@plt>

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

LLVM IR (-O2):
define i64 @simple_strtoll(i8* %0, i8** %1, i32 %2, i64 %3) {
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 45
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %0, i64 1
%9 = tail call i64 @simple_strtoull(i8* %8, i8** %1, i32 %2, i64 %3)
%10 = sub nsw i64 0, %9
br label %13
11: ; preds = %4
%12 = tail call i64 @simple_strtoull(i8* %0, i8** %1, i32 %2, i64 %3)
br label %13
13: ; preds = %11, %7
%14 = phi i64 [ %10, %7 ], [ %12, %11 ]
ret i64 %14
}
long double test_truncl(long double x) { return __builtin_truncl(x); }


x86 assembly (clang, -O0):
<test_truncl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <truncl@plt>
fld    %st(0)
fstp   %st(0)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_truncl>:
sub    $0x18,%rsp
fldt   0x20(%rsp)
fstpt  (%rsp)
call   1030 <truncl@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define x86_fp80 @test_truncl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = call x86_fp80 @llvm.trunc.f80(x86_fp80 %3)
ret x86_fp80 %4
}

LLVM IR (-O2):
define x86_fp80 @test_truncl(x86_fp80 %0) {
%2 = tail call x86_fp80 @llvm.trunc.f80(x86_fp80 %0)
ret x86_fp80 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void timestr(char str[], int len) {
  time_t time_val;
  struct tm *all_times;
  time_val = time(NULL);
  all_times = localtime((time_t *)&time_val);
  strftime(str, len, "%H:%M:%S", all_times);
}


x86 assembly (clang, -O0):
<timestr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rcx
lea    0xe96(%rip),%rdx
call   1050 <strftime@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timestr>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
lea    0xeac(%rip),%rdx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %rax,%rcx
call   1050 <strftime@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [9 x i8] c"%H:%M:%S\00"
define void @timestr(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.tm*
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = call i32 @time(i32* null)
store i32 %7, i32* %5
%8 = call %struct.tm* @localtime(i32* %5)
store %struct.tm* %8, %struct.tm** %6
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = load %struct.tm*, %struct.tm** %6
%12 = call i32 @strftime(i8* %9, i32 %10, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %struct.tm* %11)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [9 x i8] c"%H:%M:%S\00"
define void @timestr(i8* %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @time(i32* null)
store i32 %5, i32* %3
%6 = call %struct.tm* @localtime(i32* %3)
%7 = call i32 @strftime(i8* %0, i32 %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %struct.tm* %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *memalloc(int);
char *realloc(char *, int);
int main() {
  char *characters = memalloc(sizeof(char) * 10);
  for (int i = 0; i < 5; i++)
    characters[i] = i + 65;
  characters = realloc(characters, sizeof(char) * 5);
  free(characters);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xa,%edi
call   1040 <memalloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jge    117f <main+0x4f>
mov    -0x14(%rbp),%eax
add    $0x41,%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1154 <main+0x24>
mov    -0x10(%rbp),%rdi
mov    $0x5,%esi
call   1050 <realloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
call   1040 <memalloc@plt>
movl   $0x44434241,(%rax)
movb   $0x45,0x4(%rax)
mov    %rax,%rdi
mov    $0x5,%esi
call   1050 <realloc@plt>
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i8* @memalloc(i32 10)
store i8 65, i8* %1
%2 = getelementptr inbounds i8, i8* %1, i64 1
store i8 66, i8* %2
%3 = getelementptr inbounds i8, i8* %1, i64 2
store i8 67, i8* %3
%4 = getelementptr inbounds i8, i8* %1, i64 3
store i8 68, i8* %4
%5 = getelementptr inbounds i8, i8* %1, i64 4
store i8 69, i8* %5
%6 = tail call i8* @realloc(i8* %1, i32 5)
%7 = tail call i32 @free(i8* %6)
ret i32 0
}
/* Type definitions */
typedef scalar_t__ pid_t;

/* Variables and functions */
int /*<<< orphan*/ PR_SET_PDEATHSIG;
int /*<<< orphan*/ SIGTERM;
int /*<<< orphan*/ exit(int);
scalar_t__ getppid();
int /*<<< orphan*/ prctl(int /*<<< orphan*/, int /*<<< orphan*/);
void link_to_parent(pid_t parent) {
  prctl(PR_SET_PDEATHSIG, SIGTERM);
  pid_t ppid = getppid();
  if (ppid != parent)
    exit(1);
}


x86 assembly (clang, -O0):
<link_to_parent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
mov    0x2e9c(%rip),%rax
mov    (%rax),%esi
call   1030 <prctl@plt>
mov    $0x0,%al
call   1040 <getppid@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
je     1176 <link_to_parent+0x46>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<link_to_parent>:
push   %rbx
mov    %rdi,%rbx
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
mov    0x2ea4(%rip),%rax
mov    (%rax),%esi
call   1030 <prctl@plt>
xor    %eax,%eax
call   1040 <getppid@plt>
cmp    %rbx,%rax
jne    1159 <link_to_parent+0x29>
pop    %rbx
ret
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@PR_SET_PDEATHSIG = global i32 0
@SIGTERM = global i32 0
define void @link_to_parent(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i32, i32* @PR_SET_PDEATHSIG
%5 = load i32, i32* @SIGTERM
%6 = call i32 @prctl(i32 %4, i32 %5)
%7 = call i64 (...) @getppid()
store i64 %7, i64* %3
%8 = load i64, i64* %3
%9 = load i64, i64* %2
%10 = icmp ne i64 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %1
ret void
}

LLVM IR (-O2):
@PR_SET_PDEATHSIG = global i32 0
@SIGTERM = global i32 0
define void @link_to_parent(i64 %0) {
%2 = load i32, i32* @PR_SET_PDEATHSIG
%3 = load i32, i32* @SIGTERM
%4 = tail call i32 @prctl(i32 %2, i32 %3)
%5 = tail call i64 (...) @getppid()
%6 = icmp eq i64 %5, %0
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %1
ret void
}
__attribute__((always_)) void set_dev_node(struct device *dev, int node) {}


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

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

LLVM IR (-O0):
%struct.device = type opaque
define void @set_dev_node(%struct.device* %0, i32 %1) {
%3 = alloca %struct.device*
%4 = alloca i32
store %struct.device* %0, %struct.device** %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
%struct.device = type opaque
define void @set_dev_node(%struct.device* nocapture %0, i32 %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ flockfile(int /*<<< orphan*/ *);
int main(void) {
  FILE *file = NULL;
  flockfile(file);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <flockfile@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @flockfile(i32* null)
ret i32 0
}
char **cdio_get_devices_freebsd(void) { return ((void *)0); }


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

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

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

LLVM IR (-O2):
define noalias i8** @cdio_get_devices_freebsd() {
ret i8** null
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ system(char *);
int lista_beacons() {
  system("timeout 10s hcitool lescan --duplicates");
  exit(1);
}


x86 assembly (clang, -O0):
<lista_beacons>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <system@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<lista_beacons>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <system@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"timeout 10s hcitool lescan --duplicates\00"
define i32 @lista_beacons() {
%1 = call i32 @system(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [40 x i8] c"timeout 10s hcitool lescan --duplicates\00"
define i32 @lista_beacons() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ strcmp(char const *, char const *);
bool yuck_streqp(const char *s1, const char *s2) { return !strcmp(s1, s2); }


x86 assembly (clang, -O0):
<yuck_streqp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yuck_streqp>:
push   %rax
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @yuck_streqp(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}