xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ LittleEndianReadU32(int /*<<< orphan*/ const *);
int32_t LittleEndianReadS32(const uint8_t *bytes) {
  union {
    int32_t s32;
    uint32_t u32;
  } u;
  u.u32 = LittleEndianReadU32(bytes);
  return u.s32;
}


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

x86 assembly (clang, -O2):
<LittleEndianReadS32>:
jmp    1030 <LittleEndianReadU32@plt>

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

LLVM IR (-O2):
define i32 @LittleEndianReadS32(i32* %0) {
%2 = tail call i32 @LittleEndianReadU32(i32* %0)
ret i32 %2
}
/* Variables and functions */
float __p_asin_pos(float const);
float _p_asin(const float x) {
  if (x >= 0.f)
    return __p_asin_pos(x);
  else
    return -1.f * __p_asin_pos(-x);
}


x86 assembly (clang, -O0):
<_p_asin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1142 <_p_asin+0x32>
movss  -0x8(%rbp),%xmm0
call   1030 <__p_asin_pos@plt>
movss  %xmm0,-0x4(%rbp)
jmp    116d <_p_asin+0x5d>
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1030 <__p_asin_pos@plt>
movaps %xmm0,%xmm1
movss  0xe9c(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_p_asin>:
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jae    112e <_p_asin+0x1e>
push   %rax
xorps  0xee0(%rip),%xmm0
call   1030 <__p_asin_pos@plt>
xorps  0xed4(%rip),%xmm0
pop    %rax
ret
jmp    1030 <__p_asin_pos@plt>

LLVM IR (-O0):
define float @_p_asin(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = fcmp oge float %4, 0.000000e+00
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load float, float* %3
%8 = call float @__p_asin_pos(float %7)
store float %8, float* %2
br label %14
9: ; preds = %1
%10 = load float, float* %3
%11 = fneg float %10
%12 = call float @__p_asin_pos(float %11)
%13 = fmul float -1.000000e+00, %12
store float %13, float* %2
br label %14
14: ; preds = %9, %6
%15 = load float, float* %2
ret float %15
}

LLVM IR (-O2):
define float @_p_asin(float %0) {
%2 = fcmp ult float %0, 0.000000e+00
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call float @__p_asin_pos(float %0)
br label %9
5: ; preds = %1
%6 = fneg float %0
%7 = tail call float @__p_asin_pos(float %6)
%8 = fneg float %7
br label %9
9: ; preds = %5, %3
%10 = phi float [ %4, %3 ], [ %8, %5 ]
ret float %10
}
/* Variables and functions */
int /*<<< orphan*/ ioctl_reap_cq(int, int, int, int, int);
void set_reap_cq(int file_desc, int cq_id, int elements, int size, int disp) {
  ioctl_reap_cq(file_desc, cq_id, elements, size, disp);
}


x86 assembly (clang, -O0):
<set_reap_cq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
call   1030 <ioctl_reap_cq@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_reap_cq>:
jmp    1030 <ioctl_reap_cq@plt>

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

LLVM IR (-O2):
define void @set_reap_cq(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @ioctl_reap_cq(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ VIM_SIF_I2cWriteByte(unsigned char, unsigned char);
void SensorSetReg_PO3030K(unsigned char uAddr, unsigned short uVal) {
  VIM_SIF_I2cWriteByte((unsigned char)uAddr, (unsigned char)uVal);
}


x86 assembly (clang, -O0):
<SensorSetReg_PO3030K>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x1(%rbp),%cl
mov    -0x4(%rbp),%ax
movzbl %cl,%edi
movzbl %al,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SensorSetReg_PO3030K>:
movzbl %sil,%esi
jmp    1030 <VIM_SIF_I2cWriteByte@plt>

LLVM IR (-O0):
define void @SensorSetReg_PO3030K(i8 zeroext %0, i16 zeroext %1) {
%3 = alloca i8
%4 = alloca i16
store i8 %0, i8* %3
store i16 %1, i16* %4
%5 = load i8, i8* %3
%6 = load i16, i16* %4
%7 = trunc i16 %6 to i8
%8 = call i32 @VIM_SIF_I2cWriteByte(i8 zeroext %5, i8 zeroext %7)
ret void
}

LLVM IR (-O2):
define void @SensorSetReg_PO3030K(i8 zeroext %0, i16 zeroext %1) {
%3 = trunc i16 %1 to i8
%4 = tail call i32 @VIM_SIF_I2cWriteByte(i8 zeroext %0, i8 zeroext %3)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int8_t;

/* Variables and functions */
int /*<<< orphan*/ strncpy(char *, char *, size_t);
int8_t(cli_clear)(char *response, size_t respLen, int argc, char *argv[],
                  void *opts) {
  strncpy(response, "\x1b[2J\x1b[H", respLen);
  return 0;
}


x86 assembly (clang, -O0):
<cli_clear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xec6(%rip),%rsi
call   1030 <strncpy@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cli_clear>:
push   %rax
mov    %rsi,%rdx
lea    0xee5(%rip),%rsi
call   1030 <strncpy@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"\1B[2J\1B[H\00"
define i32 @cli_clear(i8* %0, i64 %1, i32 %2, i8** %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i8**
%10 = alloca i8*
store i8* %0, i8** %6
store i64 %1, i64* %7
store i32 %2, i32* %8
store i8** %3, i8*** %9
store i8* %4, i8** %10
%11 = load i8*, i8** %6
%12 = load i64, i64* %7
%13 = call i32 @strncpy(i8* %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64 %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"\1B[2J\1B[H\00"
define i32 @cli_clear(i8* %0, i64 %1, i32 %2, i8** nocapture readnone %3, i8* nocapture readnone %4) {
%6 = tail call i32 @strncpy(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64 %1)
ret i32 0
}
/* Type definitions */
struct json {
  int dummy;
};

/* Variables and functions */
char *print_value(struct json *, int /*<<< orphan*/, int);
char *json_sprint(struct json *item) { return print_value(item, 0, 1); }


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

x86 assembly (clang, -O2):
<json_sprint>:
xor    %esi,%esi
mov    $0x1,%edx
jmp    1030 <print_value@plt>

LLVM IR (-O0):
%struct.json = type { i32 }
define i8* @json_sprint(%struct.json* %0) {
%2 = alloca %struct.json*
store %struct.json* %0, %struct.json** %2
%3 = load %struct.json*, %struct.json** %2
%4 = call i8* @print_value(%struct.json* %3, i32 0, i32 1)
ret i8* %4
}

LLVM IR (-O2):
%struct.json = type { i32 }
define i8* @json_sprint(%struct.json* %0) {
%2 = tail call i8* @print_value(%struct.json* %0, i32 0, i32 1)
ret i8* %2
}
__attribute__((always_)) void proc_sched_set_task(struct task_struct *p) {}


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

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

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

LLVM IR (-O2):
%struct.task_struct = type opaque
define void @proc_sched_set_task(%struct.task_struct* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *malloc(size_t);
void *memset(void *, int /*<<< orphan*/, size_t);
int /*<<< orphan*/ stderr;
void *malloc0(size_t size) {
  void *mem;
  if ((mem = malloc(size)) == NULL) {
    fprintf(stderr, "malloc0: malloc failed\n");
    exit(1);
  }
  return memset(mem, 0, size);
}


x86 assembly (clang, -O0):
<malloc0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1182 <malloc0+0x42>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
lea    0xe8d(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rdi
mov    %rdi,-0x18(%rbp)
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"malloc0: malloc failed\0A\00"
define i8* @malloc0(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 %11
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %1
%12 = load i8*, i8** %3
%13 = load i64, i64* %2
ret i8* %12
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"malloc0: malloc failed\0A\00"
define noalias i8* @malloc0(i64 %0) {
%2 = call i8* @calloc(i64 1, i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ Aux_Testing_Instances();
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  Aux_Testing_Instances();
  printf("\n");
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <Aux_Testing_Instances@plt>
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <Aux_Testing_Instances@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @Aux_Testing_Instances()
%7 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @Aux_Testing_Instances()
%4 = tail call i32 @putchar(i32 10)
%5 = tail call i32 (...) @getchar()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ getpid();
int qksort(void *, int, int, int /*<<< orphan*/, int,
           int (*)(void const *, void const *));
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int qsrt(void *data, int size, int esize,
         int (*compare)(const void *key1, const void *key2)) {
  srand(getpid());
  return qksort(data, size, esize, 0, size - 1, compare);
}


x86 assembly (clang, -O0):
<qsrt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%r8d
sub    $0x1,%r8d
mov    -0x18(%rbp),%r9
xor    %ecx,%ecx
call   1050 <qksort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qsrt>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %edx,%r15d
mov    %esi,%ebx
mov    %rdi,%rbp
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    -0x1(%rbx),%r8d
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %r15d,%edx
xor    %ecx,%ecx
mov    %r14,%r9
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <qksort@plt>

LLVM IR (-O0):
define i32 @qsrt(i8* %0, i32 %1, i32 %2, i32 (i8*, i8*)* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32 (i8*, i8*)*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 (i8*, i8*)* %3, i32 (i8*, i8*)** %8
%9 = call i32 (...) @getpid()
%10 = call i32 @srand(i32 %9)
%11 = load i8*, i8** %5
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = load i32, i32* %6
%15 = sub nsw i32 %14, 1
%16 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %8
%17 = call i32 @qksort(i8* %11, i32 %12, i32 %13, i32 0, i32 %15, i32 (i8*, i8*)* %16)
ret i32 %17
}

LLVM IR (-O2):
define i32 @qsrt(i8* %0, i32 %1, i32 %2, i32 (i8*, i8*)* %3) {
%5 = tail call i32 (...) @getpid()
%6 = tail call i32 @srand(i32 %5)
%7 = add nsw i32 %1, -1
%8 = tail call i32 @qksort(i8* %0, i32 %1, i32 %2, i32 0, i32 %7, i32 (i8*, i8*)* %3)
ret i32 %8
}
double _mul(double a1, double a2) { return a1 * a2; }


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

x86 assembly (clang, -O2):
<_mul>:
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @_mul(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fmul double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @_mul(double %0, double %1) {
%3 = fmul double %0, %1
ret double %3
}
char *skip_prefix(const char *prefix, char *input) {
  while (*prefix != '\0') {
    if (*prefix++ != *input++)
      return 0;
  }
  return input;
}


x86 assembly (clang, -O0):
<skip_prefix>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     115a <skip_prefix+0x5a>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1155 <skip_prefix+0x55>
movq   $0x0,-0x8(%rbp)
jmp    1162 <skip_prefix+0x62>
jmp    110c <skip_prefix+0xc>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_prefix>:
mov    %rsi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rdi),%ecx
test   %cl,%cl
je     1128 <skip_prefix+0x28>
add    $0x1,%rdi
lea    0x1(%rax),%rdx
cmp    (%rax),%cl
mov    %rdx,%rax
je     1110 <skip_prefix+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @skip_prefix(i8* nocapture %0, i8* %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i8* [ %0, %2 ], [ %9, %8 ]
%5 = phi i8* [ %1, %2 ], [ %10, %8 ]
%6 = load i8, i8* %4
%7 = icmp eq i8 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %3
%9 = getelementptr inbounds i8, i8* %4, i64 1
%10 = getelementptr inbounds i8, i8* %5, i64 1
%11 = load i8, i8* %5
%12 = icmp eq i8 %6, %11
br i1 %12, label %3, label %13
13: ; preds = %3, %8
%14 = phi i8* [ null, %8 ], [ %5, %3 ]
ret i8* %14
}
/* Variables and functions */
int /*<<< orphan*/ Prt(char *, int, int);
void display_commands() {
  Prt(("You may:"), (21) - 1, (1) - 1);
  Prt((" p/P) Purchase an item.          <space> browse store's inventory."),
      (22) - 1, (1) - 1);
  Prt((" s/S) Sell an item.              i) Inventory and Equipment Lists."),
      (23) - 1, (1) - 1);
  Prt((" ^R) Redraw the screen.        Esc) Exit from building."), (24) - 1,
      (1) - 1);
}


x86 assembly (clang, -O0):
<display_commands>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x14,%esi
xor    %edx,%edx
call   1030 <Prt@plt>
lea    0xedb(%rip),%rdi
mov    $0x15,%esi
xor    %edx,%edx
call   1030 <Prt@plt>
lea    0xf0b(%rip),%rdi
mov    $0x16,%esi
xor    %edx,%edx
call   1030 <Prt@plt>
lea    0xf3b(%rip),%rdi
mov    $0x17,%esi
xor    %edx,%edx
call   1030 <Prt@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_commands>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x14,%esi
xor    %edx,%edx
call   1030 <Prt@plt>
lea    0xede(%rip),%rdi
mov    $0x15,%esi
xor    %edx,%edx
call   1030 <Prt@plt>
lea    0xf0e(%rip),%rdi
mov    $0x16,%esi
xor    %edx,%edx
call   1030 <Prt@plt>
lea    0xf3e(%rip),%rdi
mov    $0x17,%esi
xor    %edx,%edx
pop    %rax
jmp    1030 <Prt@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"You may:\00"
@.str.1 = [67 x i8] c" p/P) Purchase an item. <space> browse store's inventory.\00"
@.str.2 = [67 x i8] c" s/S) Sell an item. i) Inventory and Equipment Lists.\00"
@.str.3 = [56 x i8] c" ^R) Redraw the screen. Esc) Exit from building.\00"
define void @display_commands() {
%1 = call i32 @Prt(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 20, i32 0)
%2 = call i32 @Prt(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.1, i64 0, i64 0), i32 21, i32 0)
%3 = call i32 @Prt(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.2, i64 0, i64 0), i32 22, i32 0)
%4 = call i32 @Prt(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0), i32 23, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"You may:\00"
@.str.1 = [67 x i8] c" p/P) Purchase an item. <space> browse store's inventory.\00"
@.str.2 = [67 x i8] c" s/S) Sell an item. i) Inventory and Equipment Lists.\00"
@.str.3 = [56 x i8] c" ^R) Redraw the screen. Esc) Exit from building.\00"
define void @display_commands() {
%1 = tail call i32 @Prt(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 20, i32 0)
%2 = tail call i32 @Prt(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.1, i64 0, i64 0), i32 21, i32 0)
%3 = tail call i32 @Prt(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.2, i64 0, i64 0), i32 22, i32 0)
%4 = tail call i32 @Prt(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0), i32 23, i32 0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ i;

/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, int *, int);
void foo(char *dst, int i) { memcpy(dst, &i, sizeof(i)); }


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

x86 assembly (clang, -O2):
<foo>:
push   %rax
mov    %esi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @foo(i8* %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = call i32 @memcpy(i8* %0, i32* %3, i32 4)
ret void
}
int do_322() { return 322; }


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

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

LLVM IR (-O0):
define i32 @do_322() {
ret i32 322
}

LLVM IR (-O2):
define i32 @do_322() {
ret i32 322
}
/* Type definitions */
struct server_list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ DelServer(struct server_list *);
struct server_list *GetServer(char *);
int /*<<< orphan*/ debug_log(char *, char *);
void DelServerByName(char *name) {
  struct server_list *server_curr = NULL;
  server_curr = GetServer(name);
  if (server_curr == NULL) {
    debug_log("Attempted to remove non existant server: %s\n", name);
    return;
  }
  DelServer(server_curr);
}


x86 assembly (clang, -O0):
<DelServerByName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <GetServer@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1171 <DelServerByName+0x41>
mov    -0x8(%rbp),%rsi
lea    0xe99(%rip),%rdi
call   1050 <debug_log@plt>
jmp    117a <DelServerByName+0x4a>
mov    -0x10(%rbp),%rdi
call   1030 <DelServer@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DelServerByName>:
push   %rbx
mov    %rdi,%rbx
call   1040 <GetServer@plt>
test   %rax,%rax
je     1147 <DelServerByName+0x17>
mov    %rax,%rdi
pop    %rbx
jmp    1030 <DelServer@plt>
lea    0xeb2(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1050 <debug_log@plt>

LLVM IR (-O0):
%struct.server_list = type { i32 }
@.str = [45 x i8] c"Attempted to remove non existant server: %s\0A\00"
define void @DelServerByName(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.server_list*
store i8* %0, i8** %2
store %struct.server_list* null, %struct.server_list** %3
%4 = load i8*, i8** %2
%5 = call %struct.server_list* @GetServer(i8* %4)
store %struct.server_list* %5, %struct.server_list** %3
%6 = load %struct.server_list*, %struct.server_list** %3
%7 = icmp eq %struct.server_list* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i32 @debug_log(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %14
11: ; preds = %1
%12 = load %struct.server_list*, %struct.server_list** %3
%13 = call i32 @DelServer(%struct.server_list* %12)
br label %14
14: ; preds = %11, %8
ret void
}

LLVM IR (-O2):
%struct.server_list = type { i32 }
@.str = [45 x i8] c"Attempted to remove non existant server: %s\0A\00"
define void @DelServerByName(i8* %0) {
%2 = tail call %struct.server_list* @GetServer(i8* %0)
%3 = icmp eq %struct.server_list* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @debug_log(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %8
6: ; preds = %1
%7 = tail call i32 @DelServer(%struct.server_list* %2)
br label %8
8: ; preds = %6, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("H"
         "e"
         "l"
         "l"
         "o"
         " "

         "W"
         "o"
         "r"

         "l"

         "d"

         "\n"

  );
}


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

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

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

LLVM IR (-O2):
@str = [12 x i8] c"Hello World\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
scalar_t__ UINT32_MAX;
bool audit_session_is_valid(uint32_t id) { return id > 0 && id != UINT32_MAX; }


x86 assembly (clang, -O0):
<audit_session_is_valid>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jle    112c <audit_session_is_valid+0x2c>
mov    -0x8(%rbp),%rax
mov    0x2ed5(%rip),%rcx
cmp    (%rcx),%rax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<audit_session_is_valid>:
test   %rdi,%rdi
setg   %al
mov    0x2eeb(%rip),%rcx
cmp    %rdi,(%rcx)
setne  %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
@UINT32_MAX = global i64 0
define i32 @audit_session_is_valid(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp sgt i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i64, i64* %2
%7 = load i64, i64* @UINT32_MAX
%8 = icmp ne i64 %6, %7
br label %9
9: ; preds = %5, %1
%10 = phi i1 [ false, %1 ], [ %8, %5 ]
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
@UINT32_MAX = global i64 0
define i32 @audit_session_is_valid(i64 %0) {
%2 = icmp sgt i64 %0, 0
%3 = load i64, i64* @UINT32_MAX
%4 = icmp ne i64 %3, %0
%5 = select i1 %2, i1 %4, i1 false
%6 = zext i1 %5 to i32
ret i32 %6
}
int ecm_nss_ipv6_init(struct dentry *dentry) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.dentry = type opaque
define i32 @ecm_nss_ipv6_init(%struct.dentry* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ hexstrings(unsigned int);
int /*<<< orphan*/ uart_send(int);
void hexstring(unsigned int d) {
  hexstrings(d);
  uart_send(0x0D);
  uart_send(0x0A);
}


x86 assembly (clang, -O0):
<hexstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <hexstrings@plt>
mov    $0xd,%edi
call   1030 <uart_send@plt>
mov    $0xa,%edi
call   1030 <uart_send@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexstring>:
push   %rax
call   1040 <hexstrings@plt>
mov    $0xd,%edi
call   1030 <uart_send@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <uart_send@plt>

LLVM IR (-O0):
define void @hexstring(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @hexstrings(i32 %3)
%5 = call i32 @uart_send(i32 13)
%6 = call i32 @uart_send(i32 10)
ret void
}

LLVM IR (-O2):
define void @hexstring(i32 %0) {
%2 = tail call i32 @hexstrings(i32 %0)
%3 = tail call i32 @uart_send(i32 13)
%4 = tail call i32 @uart_send(i32 10)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t bit_mask(uint32_t value) {
  uint32_t bm_unit_size = 1 << 5;
  return (1 << (value % bm_unit_size));
}


x86 assembly (clang, -O0):
<bit_mask>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x20,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,%ecx
mov    $0x1,%eax
shl    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_mask>:
mov    %edi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
ret

LLVM IR (-O0):
define i32 @bit_mask(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 32, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* %3
%6 = srem i32 %4, %5
%7 = shl i32 1, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @bit_mask(i32 %0) {
%2 = and i32 %0, 31
%3 = shl nuw i32 1, %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ ft_putnbr_fd(int, int);
void ft_putnbr(int n) { ft_putnbr_fd(n, 1); }


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

x86 assembly (clang, -O2):
<ft_putnbr>:
mov    $0x1,%esi
jmp    1030 <ft_putnbr_fd@plt>

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

LLVM IR (-O2):
define void @ft_putnbr(i32 %0) {
%2 = tail call i32 @ft_putnbr_fd(i32 %0, i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ hal_rtc_cancel_alarm();
void __attribute__((deprecated("use hal_rtc_cancel_alarm() instead"), always_))
HAL_RTC_Cancel_UnixAlarm(void) {
  hal_rtc_cancel_alarm();
}


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

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

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

LLVM IR (-O2):
define void @HAL_RTC_Cancel_UnixAlarm() {
%1 = tail call i32 (...) @hal_rtc_cancel_alarm()
ret void
}
char funcIf(int a) {
  char result = '\0';
  if (a == 0) {
    result = 'a';
  } else if (a == 1 || a == 2) {
    result = 'b';
  } else {
    result = 'c';
  }
  return result;
}


x86 assembly (clang, -O0):
<funcIf>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    111e <funcIf+0x1e>
movb   $0x61,-0x5(%rbp)
jmp    1144 <funcIf+0x44>
cmpl   $0x1,-0x4(%rbp)
je     1132 <funcIf+0x32>
cmpl   $0x2,-0x4(%rbp)
jne    113b <funcIf+0x3b>
movb   $0x62,-0x5(%rbp)
jmp    113f <funcIf+0x3f>
movb   $0x63,-0x5(%rbp)
jmp    1144 <funcIf+0x44>
movsbl -0x5(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<funcIf>:
lea    -0x1(%rdi),%eax
cmp    $0x2,%eax
mov    $0x63,%al
sbb    $0x0,%al
cmp    $0x1,%edi
movzbl %al,%ecx
mov    $0x61,%eax
cmovae %ecx,%eax
ret

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

LLVM IR (-O2):
define signext i8 @funcIf(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = add i32 %0, -1
%4 = icmp ult i32 %3, 2
%5 = select i1 %4, i8 98, i8 99
%6 = select i1 %2, i8 97, i8 %5
ret i8 %6
}
/* Type definitions */
struct lifo {
  int dummy;
};

/* Variables and functions */
double lgamma(double);
double pop(struct lifo *);
double opr_lgamma(struct lifo *stack) {
  double op = pop(stack);
  return lgamma(op);
}


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

x86 assembly (clang, -O2):
<opr_lgamma>:
push   %rax
call   1030 <pop@plt>
pop    %rax
jmp    1040 <lgamma@plt>

LLVM IR (-O0):
%struct.lifo = type { i32 }
define double @opr_lgamma(%struct.lifo* %0) {
%2 = alloca %struct.lifo*
%3 = alloca double
store %struct.lifo* %0, %struct.lifo** %2
%4 = load %struct.lifo*, %struct.lifo** %2
%5 = call double @pop(%struct.lifo* %4)
store double %5, double* %3
%6 = load double, double* %3
%7 = call double @lgamma(double %6)
ret double %7
}

LLVM IR (-O2):
%struct.lifo = type { i32 }
define double @opr_lgamma(%struct.lifo* %0) {
%2 = tail call double @pop(%struct.lifo* %0)
%3 = tail call double @lgamma(double %2)
ret double %3
}
/* Variables and functions */
void *OICMalloc(size_t);
void *realloc(void *, size_t);
void *OICRealloc(void *ptr, size_t size) {
  if (ptr == NULL) {
    return OICMalloc(size);
  }
  return realloc(ptr, size);
}


x86 assembly (clang, -O0):
<OICRealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114d <OICRealloc+0x2d>
mov    -0x18(%rbp),%rdi
call   1030 <OICMalloc@plt>
mov    %rax,-0x8(%rbp)
jmp    115e <OICRealloc+0x3e>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OICRealloc>:
test   %rdi,%rdi
je     112a <OICRealloc+0xa>
jmp    1040 <realloc@plt>
mov    %rsi,%rdi
jmp    1030 <OICMalloc@plt>

LLVM IR (-O0):
define i8* @OICRealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
%6 = load i8*, i8** %4
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i64, i64* %5
%10 = call i8* @OICMalloc(i64 %9)
store i8* %10, i8** %3
br label %15
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = load i64, i64* %5
%14 = call i8* @realloc(i8* %12, i64 %13)
store i8* %14, i8** %3
br label %15
15: ; preds = %11, %8
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
define i8* @OICRealloc(i8* %0, i64 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i8* @OICMalloc(i64 %1)
br label %8
6: ; preds = %2
%7 = tail call i8* @realloc(i8* %0, i64 %1)
br label %8
8: ; preds = %6, %4
%9 = phi i8* [ %5, %4 ], [ %7, %6 ]
ret i8* %9
}
/* Type definitions */
struct timeval {
  double tv_sec;
  double tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ neubot_timeval_now(struct timeval *);
double neubot_time_now(void) {
  struct timeval tv;
  double result;
  neubot_timeval_now(&tv);
  result = tv.tv_sec + tv.tv_usec / (double)1000000.0;
  return (result);
}


x86 assembly (clang, -O0):
<neubot_time_now>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
call   1030 <neubot_timeval_now@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xecd(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<neubot_time_now>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
call   1030 <neubot_timeval_now@plt>
movsd  0x10(%rsp),%xmm0
divsd  0xed4(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { double, double }
define double @neubot_time_now() {
%1 = alloca %struct.timeval
%2 = alloca double
%3 = call i32 @neubot_timeval_now(%struct.timeval* %1)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%5 = load double, double* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%7 = load double, double* %6
%8 = fdiv double %7, 1.000000e+06
%9 = fadd double %5, %8
store double %9, double* %2
%10 = load double, double* %2
ret double %10
}

LLVM IR (-O2):
%struct.timeval = type { double, double }
define double @neubot_time_now() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @neubot_timeval_now(%struct.timeval* %1)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load double, double* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load double, double* %6
%8 = fdiv double %7, 1.000000e+06
%9 = fadd double %5, %8
ret double %9
}
/* Variables and functions */
int /*<<< orphan*/ gpio_output_pin(int);
int /*<<< orphan*/ gpio_set(int);
int /*<<< orphan*/ reg_setup();
void LCD_setup() {
  reg_setup();
  gpio_output_pin(14);
  gpio_output_pin(15);
  gpio_output_pin(18);
  gpio_output_pin(23);
  gpio_set(1 << 23);
}


x86 assembly (clang, -O0):
<LCD_setup>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <reg_setup@plt>
mov    $0xe,%edi
call   1030 <gpio_output_pin@plt>
mov    $0xf,%edi
call   1030 <gpio_output_pin@plt>
mov    $0x12,%edi
call   1030 <gpio_output_pin@plt>
mov    $0x17,%edi
call   1030 <gpio_output_pin@plt>
mov    $0x800000,%edi
call   1050 <gpio_set@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCD_setup>:
push   %rax
xor    %eax,%eax
call   1040 <reg_setup@plt>
mov    $0xe,%edi
call   1030 <gpio_output_pin@plt>
mov    $0xf,%edi
call   1030 <gpio_output_pin@plt>
mov    $0x12,%edi
call   1030 <gpio_output_pin@plt>
mov    $0x17,%edi
call   1030 <gpio_output_pin@plt>
mov    $0x800000,%edi
pop    %rax
jmp    1050 <gpio_set@plt>

LLVM IR (-O0):
define void @LCD_setup() {
%1 = call i32 (...) @reg_setup()
%2 = call i32 @gpio_output_pin(i32 14)
%3 = call i32 @gpio_output_pin(i32 15)
%4 = call i32 @gpio_output_pin(i32 18)
%5 = call i32 @gpio_output_pin(i32 23)
%6 = call i32 @gpio_set(i32 8388608)
ret void
}

LLVM IR (-O2):
define void @LCD_setup() {
%1 = tail call i32 (...) @reg_setup()
%2 = tail call i32 @gpio_output_pin(i32 14)
%3 = tail call i32 @gpio_output_pin(i32 15)
%4 = tail call i32 @gpio_output_pin(i32 18)
%5 = tail call i32 @gpio_output_pin(i32 23)
%6 = tail call i32 @gpio_set(i32 8388608)
ret void
}
const char *SDL_LookupString(const char *key) { return key; }


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

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

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

LLVM IR (-O2):
define i8* @SDL_LookupString(i8* readnone returned %0) {
ret i8* %0
}
/* Variables and functions */
int syscall(int, char *, int /*<<< orphan*/);
int ps(char *y) { return syscall(44, y, 0); }


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

x86 assembly (clang, -O2):
<ps>:
mov    %rdi,%rsi
mov    $0x2c,%edi
xor    %edx,%edx
jmp    1030 <syscall@plt>

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

LLVM IR (-O2):
define i32 @ps(i8* %0) {
%2 = tail call i32 @syscall(i32 44, i8* %0, i32 0)
ret i32 %2
}
void debug_printhex_ptr(void *v) {}


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

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

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

LLVM IR (-O2):
define void @debug_printhex_ptr(i8* nocapture %0) {
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
__attribute__((always_)) uint32_t BME_LAS1_W(volatile uint32_t *addr,
                                             uint8_t bit) {
  return *(volatile uint32_t *)((uint32_t)addr | (3 << 26) | (bit << 21));
}


x86 assembly (clang, -O0):
<BME_LAS1_W>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
or     $0xc000000,%eax
mov    -0xc(%rbp),%ecx
shl    $0x15,%ecx
or     %ecx,%eax
cltq
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BME_LAS1_W>:
shl    $0x15,%esi
or     %edi,%esi
movslq %esi,%rax
or     $0xc000000,%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
define i32 @BME_LAS1_W(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 = ptrtoint i32* %5 to i32
%7 = or i32 %6, 201326592
%8 = load i32, i32* %4
%9 = shl i32 %8, 21
%10 = or i32 %7, %9
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i32*
%13 = load volatile i32, i32* %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @BME_LAS1_W(i32* %0, i32 %1) {
%3 = ptrtoint i32* %0 to i64
%4 = trunc i64 %3 to i32
%5 = shl i32 %1, 21
%6 = or i32 %5, %4
%7 = or i32 %6, 201326592
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
%10 = load volatile i32, i32* %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ relemdata(int, double);
int /*<<< orphan*/ relemhead(char const *, int, double);
void relem(const char *name, int fp, double val) {
  if (name)
    relemhead(name, fp, val);
  else
    relemdata(fp, val);
}


x86 assembly (clang, -O0):
<relem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1155 <relem+0x35>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
movsd  -0x18(%rbp),%xmm0
call   1040 <relemhead@plt>
jmp    1162 <relem+0x42>
mov    -0xc(%rbp),%edi
movsd  -0x18(%rbp),%xmm0
call   1030 <relemdata@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<relem>:
test   %rdi,%rdi
je     112a <relem+0xa>
jmp    1040 <relemhead@plt>
mov    %esi,%edi
jmp    1030 <relemdata@plt>

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

LLVM IR (-O2):
define void @relem(i8* %0, i32 %1, double %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @relemhead(i8* %0, i32 %1, double %2)
br label %9
7: ; preds = %3
%8 = tail call i32 @relemdata(i32 %1, double %2)
br label %9
9: ; preds = %7, %5
ret void
}
void WC_Cleanup() {}


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

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

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

LLVM IR (-O2):
define void @WC_Cleanup() {
ret void
}
int transformX(int x, int y, int transformationNo) {
  if (transformationNo == 1) {
    return -x;
  } else if (transformationNo == 2) {
    return x;
  } else if (transformationNo == 3) {
    return y;
  }
}


x86 assembly (clang, -O0):
<transformX>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    1124 <transformX+0x24>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <transformX+0x58>
cmpl   $0x2,-0x10(%rbp)
jne    1139 <transformX+0x39>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <transformX+0x58>
cmpl   $0x3,-0x10(%rbp)
jne    114e <transformX+0x4e>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <transformX+0x58>
jmp    1153 <transformX+0x53>
jmp    1158 <transformX+0x58>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<transformX>:
cmp    $0x3,%edx
je     110f <transformX+0xf>
cmp    $0x1,%edx
jne    1112 <transformX+0x12>
neg    %edi
mov    %edi,%eax
ret
mov    %esi,%eax
ret
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @transformX(i32 %0, i32 %1, i32 %2) {
switch i32 %2, label %7 [
i32 1, label %4
i32 3, label %6
]
4: ; preds = %3
%5 = sub nsw i32 0, %0
br label %7
6: ; preds = %3
br label %7
7: ; preds = %3, %4, %6
%8 = phi i32 [ %5, %4 ], [ %1, %6 ], [ %0, %3 ]
ret i32 %8
}
void genslti() {}


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

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

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

LLVM IR (-O2):
define void @genslti() {
ret void
}
void g_DUMMY_enable_nextcommand(int win_id) { win_id = win_id; }


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

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

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

LLVM IR (-O2):
define void @g_DUMMY_enable_nextcommand(i32 %0) {
ret void
}
/* Variables and functions */
int mibb();
int /*<<< orphan*/ printf(char *, int);
int main(int argc, const char *argv[]) {
  int v = 0;
  if (argc > 1)
    v = mibb();
  printf("Second: V is %d\n", v);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1151 <main+0x31>
mov    $0x0,%al
call   1040 <mibb@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %esi,%esi
cmp    $0x2,%edi
jl     1131 <main+0x11>
xor    %eax,%eax
call   1040 <mibb@plt>
mov    %eax,%esi
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Second: V is %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (...) @mibb()
store i32 %10, i32* %6
br label %11
11: ; preds = %9, %2
%12 = load i32, i32* %6
%13 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
@.str = [17 x i8] c"Second: V is %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @mibb()
br label %6
6: ; preds = %4, %2
%7 = phi i32 [ %5, %4 ], [ 0, %2 ]
%8 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}