xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint32_t;
struct timespec {
  int dummy;
};

/* Variables and functions */
int igt_nsec_elapsed(struct timespec *);
uint32_t igt_seconds_elapsed(struct timespec *start) {
  return igt_nsec_elapsed(start) >> 30;
}


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

x86 assembly (clang, -O2):
<igt_seconds_elapsed>:
push   %rax
call   1030 <igt_nsec_elapsed@plt>
sar    $0x1e,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
define i32 @igt_seconds_elapsed(%struct.timespec* %0) {
%2 = alloca %struct.timespec*
store %struct.timespec* %0, %struct.timespec** %2
%3 = load %struct.timespec*, %struct.timespec** %2
%4 = call i32 @igt_nsec_elapsed(%struct.timespec* %3)
%5 = ashr i32 %4, 30
ret i32 %5
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
define i32 @igt_seconds_elapsed(%struct.timespec* %0) {
%2 = tail call i32 @igt_nsec_elapsed(%struct.timespec* %0)
%3 = ashr i32 %2, 30
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ SPI_Send(int);
void MC33927_DeadtimeCalibration(void) { SPI_Send(0x81); }


x86 assembly (clang, -O0):
<MC33927_DeadtimeCalibration>:
push   %rbp
mov    %rsp,%rbp
mov    $0x81,%edi
call   1030 <SPI_Send@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<MC33927_DeadtimeCalibration>:
mov    $0x81,%edi
jmp    1030 <SPI_Send@plt>

LLVM IR (-O0):
define void @MC33927_DeadtimeCalibration() {
%1 = call i32 @SPI_Send(i32 129)
ret void
}

LLVM IR (-O2):
define void @MC33927_DeadtimeCalibration() {
%1 = tail call i32 @SPI_Send(i32 129)
ret void
}
/* Type definitions */
typedef scalar_t__ uint64_t;
struct timespec {
  unsigned long long tv_sec;
  scalar_t__ tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
uint64_t nanos_monotonic() {
  struct timespec t;
  clock_gettime(CLOCK_MONOTONIC, &t);
  return t.tv_sec * 1000000000ULL + t.tv_nsec;
}


x86 assembly (clang, -O0):
<nanos_monotonic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
imul   $0x3b9aca00,-0x10(%rbp),%rax
3b
add    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nanos_monotonic>:
sub    $0x18,%rsp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <clock_gettime@plt>
imul   $0x3b9aca00,0x8(%rsp),%rax
9a 3b
add    0x10(%rsp),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
@CLOCK_MONOTONIC = global i32 0
define i64 @nanos_monotonic() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_MONOTONIC
%3 = call i32 @clock_gettime(i32 %2, %struct.timespec* %1)
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%5 = load i64, i64* %4
%6 = mul i64 %5, 1000000000
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%8 = load i64, i64* %7
%9 = add i64 %6, %8
ret i64 %9
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
@CLOCK_MONOTONIC = global i32 0
define i64 @nanos_monotonic() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%6 = load i64, i64* %5
%7 = mul i64 %6, 1000000000
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%9 = load i64, i64* %8
%10 = add i64 %7, %9
ret i64 %10
}
int fitsBits(int x, int n) {
  int m = 32 + ~n + 1;
  int z = (x << m) >> m;
  x = !(x ^ z);
  return x;
}


x86 assembly (clang, -O0):
<fitsBits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
xor    $0xffffffff,%eax
add    $0x20,%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    %cl,%eax
mov    -0xc(%rbp),%ecx
sar    %cl,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x10(%rbp),%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fitsBits>:
mov    %esi,%ecx
neg    %cl
mov    %edi,%edx
shl    %cl,%edx
sar    %cl,%edx
xor    %eax,%eax
cmp    %edi,%edx
sete   %al
ret

LLVM IR (-O0):
define i32 @fitsBits(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = xor i32 %7, -1
%9 = add nsw i32 32, %8
%10 = add nsw i32 %9, 1
store i32 %10, i32* %5
%11 = load i32, i32* %3
%12 = load i32, i32* %5
%13 = shl i32 %11, %12
%14 = load i32, i32* %5
%15 = ashr i32 %13, %14
store i32 %15, i32* %6
%16 = load i32, i32* %3
%17 = load i32, i32* %6
%18 = xor i32 %16, %17
%19 = icmp ne i32 %18, 0
%20 = xor i1 %19, true
%21 = zext i1 %20 to i32
store i32 %21, i32* %3
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @fitsBits(i32 %0, i32 %1) {
%3 = sub i32 32, %1
%4 = shl i32 %0, %3
%5 = ashr i32 %4, %3
%6 = icmp eq i32 %5, %0
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ data2hex(int, int, char *);
int /*<<< orphan*/ sendMesg(char *);
void write_int(int in) {
  char xx[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  data2hex(8, in, xx);
  sendMesg(xx);
}


x86 assembly (clang, -O0):
<write_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x13,%edx
call   1040 <memset@plt>
mov    -0x4(%rbp),%esi
lea    -0x20(%rbp),%rdx
mov    $0x8,%edi
call   1030 <data2hex@plt>
lea    -0x20(%rbp),%rdi
call   1050 <sendMesg@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_int>:
push   %rbx
sub    $0x20,%rsp
mov    %edi,%esi
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0xf(%rsp)
mov    %rsp,%rbx
mov    $0x8,%edi
mov    %rbx,%rdx
call   1030 <data2hex@plt>
mov    %rbx,%rdi
call   1040 <sendMesg@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @write_int(i32 %0) {
%2 = alloca i32
%3 = alloca [19 x i8]
store i32 %0, i32* %2
%4 = bitcast [19 x i8]* %3 to i8*
%5 = load i32, i32* %2
%6 = getelementptr inbounds [19 x i8], [19 x i8]* %3, i64 0, i64 0
%7 = call i32 @data2hex(i32 8, i32 %5, i8* %6)
%8 = getelementptr inbounds [19 x i8], [19 x i8]* %3, i64 0, i64 0
%9 = call i32 @sendMesg(i8* %8)
ret void
}

LLVM IR (-O2):
define void @write_int(i32 %0) {
%2 = alloca [19 x i8]
%3 = getelementptr inbounds [19 x i8], [19 x i8]* %2, i64 0, i64 0
%4 = call i32 @data2hex(i32 8, i32 %0, i8* %3)
%5 = call i32 @sendMesg(i8* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _hmt_count_cover(char *, int);
float cosf(float);
float HMM_CosF(float Radians) {
  { _hmt_count_cover("HMM_CosF", 432); };
  float Result = cosf(Radians);
  return (Result);
}


x86 assembly (clang, -O0):
<HMM_CosF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
lea    0xecc(%rip),%rdi
mov    $0x1b0,%esi
call   1030 <_hmt_count_cover@plt>
movss  -0x4(%rbp),%xmm0
call   1040 <cosf@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HMM_CosF>:
push   %rax
movss  %xmm0,0x4(%rsp)
lea    0xed2(%rip),%rdi
mov    $0x1b0,%esi
call   1030 <_hmt_count_cover@plt>
movss  0x4(%rsp),%xmm0
pop    %rax
jmp    1040 <cosf@plt>

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

LLVM IR (-O2):
@.str = [9 x i8] c"HMM_CosF\00"
define float @HMM_CosF(float %0) {
%2 = tail call i32 @_hmt_count_cover(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 432)
%3 = tail call float @cosf(float %0)
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_context_set_sink_input_mute() {
  printf("NOT IMPLEMENTED:"
         "pa_context_set_sink_input_mute"
         "\n");
}


x86 assembly (clang, -O0):
<pa_context_set_sink_input_mute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [48 x i8] c"NOT IMPLEMENTED:pa_context_set_sink_input_mute\0A\00"
define i32 @pa_context_set_sink_input_mute() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [47 x i8] c"NOT IMPLEMENTED:pa_context_set_sink_input_mute\00"
define i32 @pa_context_set_sink_input_mute() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
__attribute__((no)) signed char foo3(int x) { return x; }


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

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

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

LLVM IR (-O2):
define signext i8 @foo3(i32 %0) {
%2 = trunc i32 %0 to i8
ret i8 %2
}
long core___core__Int____60d_60d(long self, long p0) {
  long var;
  long var1;
  var1 = self << p0;
  var = var1;
  goto RET_LABEL;
RET_LABEL:;
  return var;
}


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

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

LLVM IR (-O0):
define i64 @core___core__Int____60d_60d(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%7 = load i64, i64* %3
%8 = load i64, i64* %4
%9 = shl i64 %7, %8
store i64 %9, i64* %6
%10 = load i64, i64* %6
store i64 %10, i64* %5
br label %11
11: ; preds = %2
%12 = load i64, i64* %5
ret i64 %12
}

LLVM IR (-O2):
define i64 @core___core__Int____60d_60d(i64 %0, i64 %1) {
%3 = shl i64 %0, %1
ret i64 %3
}
void entry(void *param) {}


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

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

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

LLVM IR (-O2):
define void @entry(i8* nocapture %0) {
ret void
}
int esFuncion(char c) {
  if ((c >= 'a' && c <= 'z' && c != 'i') || c == '!')
    return (1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<esFuncion>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     1131 <esFuncion+0x31>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jg     1131 <esFuncion+0x31>
movsbl -0x5(%rbp),%eax
cmp    $0x69,%eax
jne    113e <esFuncion+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0x21,%eax
jne    114a <esFuncion+0x4a>
movl   $0x1,-0x4(%rbp)
jmp    1151 <esFuncion+0x51>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<esFuncion>:
lea    -0x61(%rdi),%eax
cmp    $0x1a,%al
setb   %al
cmp    $0x69,%dil
setne  %cl
and    %al,%cl
cmp    $0x21,%dil
sete   %al
or     %cl,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @esFuncion(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 97
br i1 %6, label %7, label %15
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 122
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 105
br i1 %14, label %19, label %15
15: ; preds = %11, %7, %1
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 33
br i1 %18, label %19, label %20
19: ; preds = %15, %11
store i32 1, i32* %2
br label %21
20: ; preds = %15
store i32 0, i32* %2
br label %21
21: ; preds = %20, %19
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
define i32 @esFuncion(i8 signext %0) {
%2 = add i8 %0, -97
%3 = icmp ult i8 %2, 26
%4 = icmp ne i8 %0, 105
%5 = and i1 %4, %3
%6 = icmp eq i8 %0, 33
%7 = or i1 %6, %5
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
void cast_float_to_int_Good_FP() {
  char arr[10];
  float x = 15.0;
  int32_t y = (int32_t)x;
  if (y < 10) {
    arr[y] = 0;
  }
}


x86 assembly (clang, -O0):
<cast_float_to_int_Good_FP>:
push   %rbp
mov    %rsp,%rbp
movss  0xef4(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
cvttss2si -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    112c <cast_float_to_int_Good_FP+0x2c>
movslq -0x14(%rbp),%rax
movb   $0x0,-0xa(%rbp,%rax,1)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @cast_float_to_int_Good_FP() {
%1 = alloca [10 x i8]
%2 = alloca float
%3 = alloca i32
store float 1.500000e+01, float* %2
%4 = load float, float* %2
%5 = fptosi float %4 to i32
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 %10
store i8 0, i8* %11
br label %12
12: ; preds = %8, %0
ret void
}

LLVM IR (-O2):
define void @cast_float_to_int_Good_FP() {
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  short rbearing;
};
typedef TYPE_1__ XCharStruct;

/* Variables and functions */
void set_XCharStruct_rbearing(void *_p, short _v) {
  ((XCharStruct *)_p)->rbearing = (short)_v;
}


x86 assembly (clang, -O0):
<set_XCharStruct_rbearing>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    -0xa(%rbp),%cx
mov    -0x8(%rbp),%rax
mov    %cx,(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i16 }
define void @set_XCharStruct_rbearing(i8* %0, i16 signext %1) {
%3 = alloca i8*
%4 = alloca i16
store i8* %0, i8** %3
store i16 %1, i16* %4
%5 = load i16, i16* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i16 %5, i16* %8
ret void
}

LLVM IR (-O2):
define void @set_XCharStruct_rbearing(i8* nocapture writeonly %0, i16 signext %1) {
%3 = bitcast i8* %0 to i16*
store i16 %1, i16* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ glmAbs3f(float *, float *);
void glmAbs3f_(float x[3]) { glmAbs3f(x, x); }


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

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

LLVM IR (-O0):
define void @glmAbs3f_(float* %0) {
%2 = alloca float*
store float* %0, float** %2
%3 = load float*, float** %2
%4 = load float*, float** %2
%5 = call i32 @glmAbs3f(float* %3, float* %4)
ret void
}

LLVM IR (-O2):
define void @glmAbs3f_(float* %0) {
%2 = tail call i32 @glmAbs3f(float* %0, float* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ u_int8_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fread(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/ *);
void read_byte(u_int8_t *b, FILE *f) { fread(b, 1, 1, f); }


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

x86 assembly (clang, -O2):
<read_byte>:
mov    %rsi,%rcx
mov    $0x1,%esi
mov    $0x1,%edx
jmp    1030 <fread@plt>

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

LLVM IR (-O2):
define void @read_byte(i32* nocapture %0, i32* nocapture %1) {
%3 = tail call i32 @fread(i32* %0, i32 1, i32 1, i32* %1)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t rol32(uint32_t word, int shift) {
  return (word << shift) | (word >> (32 - shift));
}


x86 assembly (clang, -O0):
<rol32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    %cl,%eax
mov    -0x4(%rbp),%edx
mov    $0x20,%ecx
sub    -0x8(%rbp),%ecx
sar    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rol32>:
mov    %esi,%ecx
mov    %edi,%eax
shl    %cl,%eax
neg    %cl
sar    %cl,%edi
or     %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @rol32(i32 %0, i32 %1) {
%3 = shl i32 %0, %1
%4 = sub nsw i32 32, %1
%5 = ashr i32 %0, %4
%6 = or i32 %5, %3
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void ehelp(char *name) {
  fprintf(stderr, "Use: %s [password_number]\n", name);
  exit(1);
}


x86 assembly (clang, -O0):
<ehelp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<ehelp>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [27 x i8] c"Use: %s [password_number]\0A\00"
define void @ehelp(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"Use: %s [password_number]\0A\00"
define void @ehelp(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
char *bstrdup_n(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
char *bstrdup(const char *str) {
  if (!str)
    return NULL;
  return bstrdup_n(str, strlen(str));
}


x86 assembly (clang, -O0):
<bstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1144 <bstrdup+0x24>
movq   $0x0,-0x8(%rbp)
jmp    1164 <bstrdup+0x44>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1040 <bstrdup_n@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bstrdup>:
test   %rdi,%rdi
je     1139 <bstrdup+0x19>
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <bstrdup_n@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @bstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %7, label %6
6: ; preds = %1
store i8* null, i8** %2
br label %12
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = load i8*, i8** %3
%10 = call i32 @strlen(i8* %9)
%11 = call i8* @bstrdup_n(i8* %8, i32 %10)
store i8* %11, i8** %2
br label %12
12: ; preds = %7, %6
%13 = load i8*, i8** %2
ret i8* %13
}

LLVM IR (-O2):
define i8* @bstrdup(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = tail call i8* @bstrdup_n(i8* %0, i32 %4)
br label %6
6: ; preds = %1, %3
%7 = phi i8* [ %5, %3 ], [ null, %1 ]
ret i8* %7
}
void mem_write(char *mem, int *idx, void *bytes, int cnt) {
  int end = *idx + cnt;
  for (; *idx != end; (*idx)++, bytes++) {
    mem[*idx] = *((unsigned char *)bytes);
  }
}


x86 assembly (clang, -O0):
<mem_write>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
cmp    -0x20(%rbp),%eax
je     115e <mem_write+0x5e>
mov    -0x18(%rbp),%rax
mov    (%rax),%dl
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    111f <mem_write+0x1f>
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_write>:
test   %ecx,%ecx
je     1129 <mem_write+0x29>
mov    (%rsi),%eax
add    %eax,%ecx
nopl   0x0(%rax,%rax,1)
movzbl (%rdx),%r8d
cltq
mov    %r8b,(%rdi,%rax,1)
mov    (%rsi),%eax
add    $0x1,%eax
mov    %eax,(%rsi)
add    $0x1,%rdx
cmp    %ecx,%eax
jne    1110 <mem_write+0x10>
ret

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

LLVM IR (-O2):
define void @mem_write(i8* nocapture writeonly %0, i32* nocapture %1, i8* nocapture %2, i32 %3) {
%5 = load i32, i32* %1
%6 = add nsw i32 %5, %3
%7 = icmp eq i32 %3, 0
br i1 %7, label %18, label %8
8: ; preds = %4, %8
%9 = phi i32 [ %15, %8 ], [ %5, %4 ]
%10 = phi i8* [ %16, %8 ], [ %2, %4 ]
%11 = load i8, i8* %10
%12 = sext i32 %9 to i64
%13 = getelementptr inbounds i8, i8* %0, i64 %12
store i8 %11, i8* %13
%14 = load i32, i32* %1
%15 = add nsw i32 %14, 1
store i32 %15, i32* %1
%16 = getelementptr inbounds i8, i8* %10, i64 1
%17 = icmp eq i32 %15, %6
br i1 %17, label %18, label %8
18: ; preds = %8, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int igt(int x, int y, int ok) {
  if ((x > y) && (x != y)) {
    if (!ok)
      abort();
  } else if (ok)
    abort();
}


x86 assembly (clang, -O0):
<igt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    114f <igt+0x3f>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     114f <igt+0x3f>
cmpl   $0x0,-0x10(%rbp)
jne    114a <igt+0x3a>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1165 <igt+0x55>
cmpl   $0x0,-0x10(%rbp)
je     1160 <igt+0x50>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1165 <igt+0x55>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<igt>:
push   %rax
cmp    %esi,%edi
jle    1120 <igt+0x10>
test   %edx,%edx
jne    1124 <igt+0x14>
xor    %eax,%eax
call   1030 <abort@plt>
test   %edx,%edx
jne    1119 <igt+0x9>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @igt(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* %5
%9 = load i32, i32* %6
%10 = icmp sgt i32 %8, %9
br i1 %10, label %11, label %21
11: ; preds = %3
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = icmp ne i32 %12, %13
br i1 %14, label %15, label %21
15: ; preds = %11
%16 = load i32, i32* %7
%17 = icmp ne i32 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = call i32 (...) @abort()
unreachable
20: ; preds = %15
br label %27
21: ; preds = %11, %3
%22 = load i32, i32* %7
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 (...) @abort()
unreachable
26: ; preds = %21
br label %27
27: ; preds = %26, %20
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
define i32 @igt(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, %1
%5 = icmp eq i32 %2, 0
br i1 %4, label %6, label %9
6: ; preds = %3
br i1 %5, label %7, label %12
7: ; preds = %6
%8 = tail call i32 (...) @abort()
unreachable
9: ; preds = %3
br i1 %5, label %12, label %10
10: ; preds = %9
%11 = tail call i32 (...) @abort()
unreachable
12: ; preds = %9, %6
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ SubjectModel_listSubjects();
void Controller_listSubjects() {
  SubjectModel_listSubjects();
  return;
}


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

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

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

LLVM IR (-O2):
define void @Controller_listSubjects() {
%1 = tail call i32 (...) @SubjectModel_listSubjects()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ tests();
int main() { tests(); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @tests()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ regPrintVal(double, char *);
void regPrintAngle(double x, char *buf) { regPrintVal(x, buf); }


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

x86 assembly (clang, -O2):
<regPrintAngle>:
jmp    1030 <regPrintVal@plt>

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

LLVM IR (-O2):
define void @regPrintAngle(double %0, i8* %1) {
%3 = tail call i32 @regPrintVal(double %0, i8* %1)
ret void
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
char *uni_num_to_utf8_str(int, size_t *);
char *uni_surrogate_pair_to_utf8_str(uint16_t uni1, uint16_t uni2,
                                     size_t *numBytes) {
  return uni_num_to_utf8_str(((uni1 & 0x3FF) << 10) + (uni2 & 0x3FF) + 0x10000,
                             numBytes);
}


x86 assembly (clang, -O0):
<uni_surrogate_pair_to_utf8_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
and    $0x3ff,%edi
shl    $0xa,%edi
mov    -0x8(%rbp),%eax
and    $0x3ff,%eax
add    %eax,%edi
add    $0x10000,%edi
mov    -0x10(%rbp),%rsi
call   1030 <uni_num_to_utf8_str@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uni_surrogate_pair_to_utf8_str>:
shl    $0xa,%edi
and    $0xffc00,%edi
and    $0x3ff,%esi
add    %esi,%edi
add    $0x10000,%edi
mov    %rdx,%rsi
jmp    1030 <uni_num_to_utf8_str@plt>

LLVM IR (-O0):
define i8* @uni_surrogate_pair_to_utf8_str(i32 %0, i32 %1, i64* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i64* %2, i64** %6
%7 = load i32, i32* %4
%8 = and i32 %7, 1023
%9 = shl i32 %8, 10
%10 = load i32, i32* %5
%11 = and i32 %10, 1023
%12 = add nsw i32 %9, %11
%13 = add nsw i32 %12, 65536
%14 = load i64*, i64** %6
%15 = call i8* @uni_num_to_utf8_str(i32 %13, i64* %14)
ret i8* %15
}

LLVM IR (-O2):
define i8* @uni_surrogate_pair_to_utf8_str(i32 %0, i32 %1, i64* %2) {
%4 = shl i32 %0, 10
%5 = and i32 %4, 1047552
%6 = and i32 %1, 1023
%7 = or i32 %6, 65536
%8 = add nuw nsw i32 %7, %5
%9 = tail call i8* @uni_num_to_utf8_str(i32 %8, i64* %2)
ret i8* %9
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
void errorPrintAndExit(char *msg) {
  perror(msg);
  exit(EXIT_FAILURE);
}


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

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

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

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define void @errorPrintAndExit(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Variables and functions */
char *checked_malloc(scalar_t__);
int /*<<< orphan*/ sprintf(char *, char *, char *);
scalar_t__ strlen(char *);
char *get_string_in_brackets(char *string) {
  char *string_in_brackets = checked_malloc(strlen(string) + 3);
  sprintf(string_in_brackets, "[%s]", string);
  return string_in_brackets;
}


x86 assembly (clang, -O0):
<get_string_in_brackets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rdi
add    $0x3,%rdi
call   1040 <checked_malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe9c(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_string_in_brackets>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
lea    0x3(%rax),%rdi
call   1040 <checked_malloc@plt>
mov    %rax,%rbx
lea    0xeb1(%rip),%rsi
mov    %rax,%rdi
mov    %r14,%rdx
call   1050 <sprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"[%s]\00"
define i8* @get_string_in_brackets(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 3
%4 = tail call i8* @checked_malloc(i64 %3)
%5 = tail call i32 @sprintf(i8* dereferenceable(1) %4, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ CLI_EnterChar(int /*<<< orphan*/);
int /*<<< orphan*/ COM_GetChar();
void IRQ_UartRxHandler() { CLI_EnterChar(COM_GetChar()); }


x86 assembly (clang, -O0):
<IRQ_UartRxHandler>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <COM_GetChar@plt>
mov    %eax,%edi
call   1040 <CLI_EnterChar@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<IRQ_UartRxHandler>:
push   %rax
xor    %eax,%eax
call   1030 <COM_GetChar@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <CLI_EnterChar@plt>

LLVM IR (-O0):
define void @IRQ_UartRxHandler() {
%1 = call i32 (...) @COM_GetChar()
%2 = call i32 @CLI_EnterChar(i32 %1)
ret void
}

LLVM IR (-O2):
define void @IRQ_UartRxHandler() {
%1 = tail call i32 (...) @COM_GetChar()
%2 = tail call i32 @CLI_EnterChar(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printChar(char headerMessage[], char value) {
  printf("%s", headerMessage);
  printf("%c\n", value);
}


x86 assembly (clang, -O0):
<printChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x9(%rbp),%esi
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printChar>:
push   %rbx
mov    %esi,%ebx
mov    %rdi,%rsi
lea    0xee3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%c\0A\00"
define void @printChar(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8*, i8** %3
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%c\0A\00"
define void @printChar(i8* %0, i8 signext %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = sext i8 %1 to i32
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char);
int main() {
  int i = 0;
  char y;
  for (i = 0; i < 256; i++) {
    printf("%d = %c\n", i, y);
    y++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jge    1163 <main+0x53>
mov    -0x8(%rbp),%esi
lea    0xebc(%rip),%rdi
movsbl -0x9(%rbp),%edx
call   1030 <printf@plt>
mov    -0x9(%rbp),%al
add    $0x1,%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
@.str = [9 x i8] c"%d = %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %2
br label %4
4: ; preds = %13, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 256
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = load i32, i32* %2
%9 = load i8, i8* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %8, i8 signext %9)
%11 = load i8, i8* %3
%12 = add i8 %11, 1
store i8 %12, i8* %3
br label %13
13: ; preds = %7
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %4
16: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
/* Type definitions */
typedef int /*<<< orphan*/ __u32;

/* Variables and functions */
int /*<<< orphan*/ __put_unaligned_be32(int /*<<< orphan*/, void *);
void put_unaligned_be32(__u32 val, void *p) { __put_unaligned_be32(val, p); }


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

x86 assembly (clang, -O2):
<put_unaligned_be32>:
jmp    1030 <__put_unaligned_be32@plt>

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

LLVM IR (-O2):
define void @put_unaligned_be32(i32 %0, i8* %1) {
%3 = tail call i32 @__put_unaligned_be32(i32 %0, i8* %1)
ret void
}
/* Variables and functions */
int sv_get_module_xy(int, int);
int vox_get_module_xy(int slot, int mod_num) {
  return sv_get_module_xy(slot, mod_num);
}


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

x86 assembly (clang, -O2):
<vox_get_module_xy>:
jmp    1030 <sv_get_module_xy@plt>

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

LLVM IR (-O2):
define i32 @vox_get_module_xy(i32 %0, i32 %1) {
%3 = tail call i32 @sv_get_module_xy(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int dup(int);
int rpl_dup(int fd) {
  int result = dup(fd);
  return result;
}


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

x86 assembly (clang, -O2):
<rpl_dup>:
jmp    1030 <dup@plt>

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

LLVM IR (-O2):
define i32 @rpl_dup(i32 %0) {
%2 = tail call i32 @dup(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ SYS_write;
int /*<<< orphan*/ syscall3(int /*<<< orphan*/, int, uintptr_t, size_t);
void debug_data(const void *data, size_t size) {
  syscall3(SYS_write, 2, (uintptr_t)data, size);
}


x86 assembly (clang, -O0):
<debug_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    $0x2,%esi
call   1030 <syscall3@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<debug_data>:
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    0x2ecb(%rip),%rax
mov    (%rax),%edi
mov    $0x2,%esi
jmp    1030 <syscall3@plt>

LLVM IR (-O0):
@SYS_write = global i32 0
define void @debug_data(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i32, i32* @SYS_write
%6 = load i8*, i8** %3
%7 = ptrtoint i8* %6 to i64
%8 = load i64, i64* %4
%9 = call i32 @syscall3(i32 %5, i32 2, i64 %7, i64 %8)
ret void
}

LLVM IR (-O2):
@SYS_write = global i32 0
define void @debug_data(i8* %0, i64 %1) {
%3 = load i32, i32* @SYS_write
%4 = ptrtoint i8* %0 to i64
%5 = tail call i32 @syscall3(i32 %3, i32 2, i64 %4, i64 %1)
ret void
}
unsigned int convert(unsigned int ucX) {
  return (ucX == 0) ?: (1 << (ucX - 3));
}


x86 assembly (clang, -O0):
<convert>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
sete   %al
mov    %al,%cl
and    $0x1,%cl
movzbl %cl,%ecx
mov    %ecx,-0x8(%rbp)
test   $0x1,%al
jne    1126 <convert+0x26>
jmp    1131 <convert+0x31>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1141 <convert+0x41>
mov    -0x4(%rbp),%ecx
sub    $0x3,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert>:
lea    -0x3(%rdi),%ecx
mov    $0x1,%edx
shl    %cl,%edx
xor    %eax,%eax
test   %edi,%edi
sete   %al
cmovne %edx,%eax
ret

LLVM IR (-O0):
define i32 @convert(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
br i1 %4, label %6, label %7
6: ; preds = %1
br label %11
7: ; preds = %1
%8 = load i32, i32* %2
%9 = sub i32 %8, 3
%10 = shl i32 1, %9
br label %11
11: ; preds = %7, %6
%12 = phi i32 [ %5, %6 ], [ %10, %7 ]
ret i32 %12
}

LLVM IR (-O2):
define i32 @convert(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = zext i1 %2 to i32
%4 = add i32 %0, -3
%5 = shl nuw i32 1, %4
%6 = select i1 %2, i32 %3, i32 %5
ret i32 %6
}
/* Variables and functions */
double log10(double);
int doubleToPhred(double p) {
  double res = -10.0 * log10(p);
  if (res > 93)
    res = 93;
  else if (res < 0)
    res = 0;
  return ((int)(res + 0.5));
}


x86 assembly (clang, -O0):
<doubleToPhred>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <log10@plt>
movaps %xmm0,%xmm1
movsd  0xed6(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xeb8(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1164 <doubleToPhred+0x54>
movsd  0xea6(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    117f <doubleToPhred+0x6f>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    117a <doubleToPhred+0x6a>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    117f <doubleToPhred+0x6f>
movsd  0xe89(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doubleToPhred>:
push   %rax
call   1030 <log10@plt>
mulsd  0xee2(%rip),%xmm0
movsd  0xee2(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     113e <doubleToPhred+0x2e>
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
movapd %xmm0,%xmm1
jbe    113e <doubleToPhred+0x2e>
xorpd  %xmm1,%xmm1
addsd  0xeca(%rip),%xmm1
cvttsd2si %xmm1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @doubleToPhred(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = call double @log10(double %4)
%6 = fmul double -1.000000e+01, %5
store double %6, double* %3
%7 = load double, double* %3
%8 = fcmp ogt double %7, 9.300000e+01
br i1 %8, label %9, label %10
9: ; preds = %1
store double 9.300000e+01, double* %3
br label %15
10: ; preds = %1
%11 = load double, double* %3
%12 = fcmp olt double %11, 0.000000e+00
br i1 %12, label %13, label %14
13: ; preds = %10
store double 0.000000e+00, double* %3
br label %14
14: ; preds = %13, %10
br label %15
15: ; preds = %14, %9
%16 = load double, double* %3
%17 = fadd double %16, 5.000000e-01
%18 = fptosi double %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @doubleToPhred(double %0) {
%2 = tail call double @log10(double %0)
%3 = fmul double %2, -1.000000e+01
%4 = fcmp ogt double %3, 9.300000e+01
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = fcmp olt double %3, 0.000000e+00
br i1 %6, label %7, label %8
7: ; preds = %5
br label %8
8: ; preds = %1, %5, %7
%9 = phi double [ 0.000000e+00, %7 ], [ %3, %5 ], [ 9.300000e+01, %1 ]
%10 = fadd double %9, 5.000000e-01
%11 = fptosi double %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
scalar_t__ system(char *);
int cat(char *a, char *b) {
  char shellCommand[32];
  sprintf(shellCommand, "cat %s >> %s", b, a);
  if (0 != system(shellCommand)) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<cat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xebd(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x40(%rbp),%rdi
call   1030 <system@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     116b <cat+0x4b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1172 <cat+0x52>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cat>:
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rdx
mov    %rdi,%rcx
lea    0xece(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
neg    %rax
sbb    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"cat %s >> %s\00"
define i32 @cat(i8* %0, i8* %1) {
%3 = alloca [32 x i8]
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %0)
%6 = call i64 @system(i8* %4)
%7 = icmp ne i64 %6, 0
%8 = sext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, void *);
int /*<<< orphan*/ stderr;
void rtpp_module_if_do_acct_rtcp_fin(void *pub) {
  fprintf(stderr,
          "Method rtpp_module_if@%p::do_acct_rtcp "
          "(rtpp_module_if_do_acct_rtcp) is invoked after destruction\x0a",
          pub);
  abort();
}


x86 assembly (clang, -O0):
<rtpp_module_if_do_acct_rtcp_fin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<rtpp_module_if_do_acct_rtcp_fin>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [99 x i8] c"Method rtpp_module_if@%p::do_acct_rtcp (rtpp_module_if_do_acct_rtcp) is invoked after destruction\0A\00"
define void @rtpp_module_if_do_acct_rtcp_fin(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [99 x i8] c"Method rtpp_module_if@%p::do_acct_rtcp (rtpp_module_if_do_acct_rtcp) is invoked after destruction\0A\00"
define void @rtpp_module_if_do_acct_rtcp_fin(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 (...) @abort()
unreachable
}