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

/* Variables and functions */
int /*<<< orphan*/ be32toh(int /*<<< orphan*/);
uint32_t unaligned_read_be32(const void *_u) {
  const struct __attribute__((packed, may_alias)) { uint32_t x; } *u = _u;
  return be32toh(u->x);
}


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

x86 assembly (clang, -O2):
<unaligned_read_be32>:
mov    (%rdi),%edi
jmp    1030 <be32toh@plt>

LLVM IR (-O0):
%struct.anon = type { i32 }
define i32 @unaligned_read_be32(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.anon*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to %struct.anon*
store %struct.anon* %5, %struct.anon** %3
%6 = load %struct.anon*, %struct.anon** %3
%7 = getelementptr inbounds %struct.anon, %struct.anon* %6, i32 0, i32 0
%8 = load i32, i32* %7
%9 = call i32 @be32toh(i32 %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @unaligned_read_be32(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @be32toh(i32 %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ assert(unsigned short *);
unsigned int arithmetic_decimal_multiply(unsigned short multiplier,
                                         unsigned short multiplicand,
                                         unsigned short *p_result) {
  assert(p_result);
  unsigned int err_code = 0;
  if (!p_result) {
    err_code = 2;
    goto end;
  }
  *p_result = (multiplier * multiplicand);
end:
  return err_code;
}


x86 assembly (clang, -O0):
<arithmetic_decimal_multiply>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <assert@plt>
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1151 <arithmetic_decimal_multiply+0x41>
movl   $0x2,-0x14(%rbp)
jmp    1166 <arithmetic_decimal_multiply+0x56>
movzwl -0x2(%rbp),%eax
movzwl -0x4(%rbp),%ecx
imul   %ecx,%eax
mov    %ax,%cx
mov    -0x10(%rbp),%rax
mov    %cx,(%rax)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arithmetic_decimal_multiply>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %edi,%r14d
mov    %rdx,%rdi
call   1030 <assert@plt>
test   %rbx,%rbx
je     1134 <arithmetic_decimal_multiply+0x24>
imul   %r14d,%ebp
mov    %bp,(%rbx)
xor    %eax,%eax
jmp    1139 <arithmetic_decimal_multiply+0x29>
mov    $0x2,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @arithmetic_decimal_multiply(i16 zeroext %0, i16 zeroext %1, i16* %2) {
%4 = alloca i16
%5 = alloca i16
%6 = alloca i16*
%7 = alloca i32
store i16 %0, i16* %4
store i16 %1, i16* %5
store i16* %2, i16** %6
%8 = load i16*, i16** %6
%9 = call i32 @assert(i16* %8)
store i32 0, i32* %7
%10 = load i16*, i16** %6
%11 = icmp ne i16* %10, null
br i1 %11, label %13, label %12
12: ; preds = %3
store i32 2, i32* %7
br label %21
13: ; preds = %3
%14 = load i16, i16* %4
%15 = zext i16 %14 to i32
%16 = load i16, i16* %5
%17 = zext i16 %16 to i32
%18 = mul nsw i32 %15, %17
%19 = trunc i32 %18 to i16
%20 = load i16*, i16** %6
store i16 %19, i16* %20
br label %21
21: ; preds = %13, %12
%22 = load i32, i32* %7
ret i32 %22
}

LLVM IR (-O2):
define i32 @arithmetic_decimal_multiply(i16 zeroext %0, i16 zeroext %1, i16* %2) {
%4 = tail call i32 @assert(i16* %2)
%5 = icmp eq i16* %2, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = mul i16 %1, %0
store i16 %7, i16* %2
br label %8
8: ; preds = %3, %6
%9 = phi i32 [ 0, %6 ], [ 2, %3 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
void *malloc(size_t);
void *MALLOC(size_t s) {
  void *const buf = malloc(s);
  assert(buf != NULL);
  return buf;
}


x86 assembly (clang, -O0):
<MALLOC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MALLOC>:
push   %rbx
call   1040 <malloc@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1030 <assert@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @MALLOC(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 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i8*, i8** %3
ret i8* %10
}

LLVM IR (-O2):
define noalias i8* @MALLOC(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp ne i8* %2, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void print_version() {
  fprintf(stderr,
          "icmprequest v."
          "0.1"
          "\nCopyright (C) September, 1999 Sergei Viznyuk <sv@phystech.com>\n");
}


x86 assembly (clang, -O0):
<print_version>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_version>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [82 x i8] c"icmprequest v.0.1\0ACopyright (C) September, 1999 Sergei Viznyuk <sv@phystech.com>\0A\00"
define void @print_version() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [82 x i8] c"icmprequest v.0.1\0ACopyright (C) September, 1999 Sergei Viznyuk <sv@phystech.com>\0A\00"
define void @print_version() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
double beta(int, int, int);
double fabs(double);
double fdistribution(double f, int n1, int n2) {
  f = fabs(f);
  return beta(n2 / 2.0, n1 / 2.0, n2 / (n2 + n1 * f));
}


x86 assembly (clang, -O0):
<fdistribution>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movaps 0xee1(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  0xebb(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xea6(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
cvtsi2sdl -0x10(%rbp),%xmm0
cvtsi2sdl -0x10(%rbp),%xmm2
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edx
call   1030 <beta@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fdistribution>:
andpd  0xee8(%rip),%xmm0
cvtsi2sd %esi,%xmm1
movsd  0xeec(%rip),%xmm2
movapd %xmm1,%xmm3
mulsd  %xmm2,%xmm3
cvttsd2si %xmm3,%eax
xorps  %xmm3,%xmm3
cvtsi2sd %edi,%xmm3
mulsd  %xmm3,%xmm2
cvttsd2si %xmm2,%esi
mulsd  %xmm3,%xmm0
addsd  %xmm1,%xmm0
divsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edx
mov    %eax,%edi
jmp    1030 <beta@plt>

LLVM IR (-O0):
define double @fdistribution(double %0, i32 %1, i32 %2) {
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
store double %0, double* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load double, double* %4
%8 = call double @llvm.fabs.f64(double %7)
store double %8, double* %4
%9 = load i32, i32* %6
%10 = sitofp i32 %9 to double
%11 = fdiv double %10, 2.000000e+00
%12 = fptosi double %11 to i32
%13 = load i32, i32* %5
%14 = sitofp i32 %13 to double
%15 = fdiv double %14, 2.000000e+00
%16 = fptosi double %15 to i32
%17 = load i32, i32* %6
%18 = sitofp i32 %17 to double
%19 = load i32, i32* %6
%20 = sitofp i32 %19 to double
%21 = load i32, i32* %5
%22 = sitofp i32 %21 to double
%23 = load double, double* %4
%24 = call double @llvm.fmuladd.f64(double %22, double %23, double %20)
%25 = fdiv double %18, %24
%26 = fptosi double %25 to i32
%27 = call double @beta(i32 %12, i32 %16, i32 %26)
ret double %27
}

LLVM IR (-O2):
define double @fdistribution(double %0, i32 %1, i32 %2) {
%4 = tail call double @llvm.fabs.f64(double %0)
%5 = sitofp i32 %2 to double
%6 = fmul double %5, 5.000000e-01
%7 = fptosi double %6 to i32
%8 = sitofp i32 %1 to double
%9 = fmul double %8, 5.000000e-01
%10 = fptosi double %9 to i32
%11 = tail call double @llvm.fmuladd.f64(double %8, double %4, double %5)
%12 = fdiv double %5, %11
%13 = fptosi double %12 to i32
%14 = tail call double @beta(i32 %7, i32 %10, i32 %13)
ret double %14
}
/* Variables and functions */
int imageFree(int /*<<< orphan*/);
int /*<<< orphan*/ imagePop();
imageDelete() { return imageFree(imagePop()); }


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

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

LLVM IR (-O0):
define i32 @imageDelete() {
%1 = call i32 (...) @imagePop()
%2 = call i32 @imageFree(i32 %1)
ret i32 %2
}

LLVM IR (-O2):
define i32 @imageDelete() {
%1 = tail call i32 (...) @imagePop()
%2 = tail call i32 @imageFree(i32 %1)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ __emit_string_literal_range(char *, int, int, int);
void test_stringized_token_2(int x) {
  do {
    __emit_string_literal_range("  before "
                                "x > 0"
                                " after \n",
                                1, 1, 6);
  } while (0);
}


x86 assembly (clang, -O0):
<test_stringized_token_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
mov    $0x1,%edx
mov    $0x6,%ecx
mov    %edx,%esi
call   1030 <__emit_string_literal_range@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_stringized_token_2>:
lea    0xee9(%rip),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    $0x6,%ecx
jmp    1030 <__emit_string_literal_range@plt>

LLVM IR (-O0):
@.str = [23 x i8] c" before x > 0 after \0A\00"
define void @test_stringized_token_2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %1
%4 = call i32 @__emit_string_literal_range(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 1, i32 1, i32 6)
br label %5
5: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c" before x > 0 after \0A\00"
define void @test_stringized_token_2(i32 %0) {
%2 = tail call i32 @__emit_string_literal_range(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 1, i32 1, i32 6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ atof(char *);
char *ext_arg(char *, char *);
double sin(int /*<<< orphan*/);
double cal_sin(char *S) {
  char *tmp = S;
  char arg[50];
  double sum = 0;
  tmp = ext_arg(tmp, arg);
  sum = sin(atof(arg));
  return sum;
}


x86 assembly (clang, -O0):
<cal_sin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1040 <ext_arg@plt>
mov    %rax,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
call   1030 <atof@plt>
mov    %eax,%edi
call   1050 <sin@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cal_sin>:
push   %rbx
sub    $0x40,%rsp
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <ext_arg@plt>
mov    %rbx,%rdi
call   1030 <atof@plt>
mov    %eax,%edi
call   1050 <sin@plt>
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @cal_sin(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca [50 x i8]
%5 = alloca double
store i8* %0, i8** %2
%6 = load i8*, i8** %2
store i8* %6, i8** %3
store double 0.000000e+00, double* %5
%7 = load i8*, i8** %3
%8 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%9 = call i8* @ext_arg(i8* %7, i8* %8)
store i8* %9, i8** %3
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%11 = call i32 @atof(i8* %10)
%12 = call double @sin(i32 %11)
store double %12, double* %5
%13 = load double, double* %5
ret double %13
}

LLVM IR (-O2):
define double @cal_sin(i8* %0) {
%2 = alloca [50 x i8]
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%4 = call i8* @ext_arg(i8* %0, i8* %3)
%5 = call i32 @atof(i8* %3)
%6 = call double @sin(i32 %5)
ret double %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint32_t;
typedef int /*<<< orphan*/ tmp;

/* Variables and functions */
int /*<<< orphan*/ ivory_serialize_pack_prim_1_le(int /*<<< orphan*/ *,
                                                  int /*<<< orphan*/ *);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ **, int /*<<< orphan*/ const *,
                          int);
void ivory_serialize_pack_uint8_le(uint8_t *dst, uint32_t offs,
                                   const uint8_t *src) {
  uint8_t tmp[1] = {0};
  memcpy(&tmp, src, sizeof(tmp));
  ivory_serialize_pack_prim_1_le(dst + offs, tmp);
}


x86 assembly (clang, -O0):
<ivory_serialize_pack_uint8_le>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x1c(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
lea    -0x1c(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x4,%edx
call   1050 <memcpy@plt>
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <ivory_serialize_pack_prim_1_le@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ivory_serialize_pack_uint8_le>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebx
mov    %rdi,%r14
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%r15
mov    %r15,%rdi
mov    %rdx,%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
movslq %ebx,%rax
lea    (%r14,%rax,4),%rdi
mov    %r15,%rsi
call   1030 <ivory_serialize_pack_prim_1_le@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @ivory_serialize_pack_uint8_le(i32* %0, i32 %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca [1 x i32]
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%8 = bitcast [1 x i32]* %7 to i8*
%9 = bitcast [1 x i32]* %7 to i32**
%10 = load i32*, i32** %6
%11 = call i32 @memcpy(i32** %9, i32* %10, i32 4)
%12 = load i32*, i32** %4
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = getelementptr inbounds [1 x i32], [1 x i32]* %7, i64 0, i64 0
%17 = call i32 @ivory_serialize_pack_prim_1_le(i32* %15, i32* %16)
ret void
}

LLVM IR (-O2):
define void @ivory_serialize_pack_uint8_le(i32* %0, i32 %1, i32* %2) {
%4 = alloca [1 x i32]
%5 = bitcast [1 x i32]* %4 to i8*
%6 = getelementptr inbounds [1 x i32], [1 x i32]* %4, i64 0, i64 0
store i32 0, i32* %6
%7 = bitcast [1 x i32]* %4 to i32**
%8 = call i32 @memcpy(i32** %7, i32* %2, i32 4)
%9 = sext i32 %1 to i64
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = call i32 @ivory_serialize_pack_prim_1_le(i32* %10, i32* %6)
ret void
}
int fun285() { return 285; }


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

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

LLVM IR (-O0):
define i32 @fun285() {
ret i32 285
}

LLVM IR (-O2):
define i32 @fun285() {
ret i32 285
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sig_expiration_time4(char *);
extern void signature_expiration_time(int len) {
  printf("\t");
  sig_expiration_time4("Time");
}


x86 assembly (clang, -O0):
<signature_expiration_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1040 <printf@plt>
lea    0xec4(%rip),%rdi
call   1030 <sig_expiration_time4@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signature_expiration_time>:
push   %rax
mov    $0x9,%edi
call   1030 <putchar@plt>
lea    0xece(%rip),%rdi
pop    %rax
jmp    1040 <sig_expiration_time4@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\09\00"
@.str.1 = [5 x i8] c"Time\00"
define void @signature_expiration_time(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @sig_expiration_time4(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"Time\00"
define void @signature_expiration_time(i32 %0) {
%2 = tail call i32 @putchar(i32 9)
%3 = tail call i32 @sig_expiration_time4(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int memcmp(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
int __attribute__((unused)) cmp_le32(uint32_t *ledata, uint32_t *cpudata) {
  uint32_t tmp = (*ledata);
  return memcmp(&tmp, cpudata, sizeof(*cpudata));
}


x86 assembly (clang, -O0):
<cmp_le32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdi
mov    $0x4,%edx
call   1030 <memcmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_le32>:
push   %rax
mov    (%rdi),%eax
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
mov    $0x4,%edx
call   1030 <memcmp@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @cmp_le32(i32* nocapture %0, i32* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = load i32, i32* %0
store i32 %5, i32* %3
%6 = call i32 @memcmp(i32* %3, i32* %1, i32 4)
ret i32 %6
}
int test_imm_EAint8_mem(signed char *val) {
  return ((*val) & (-0xEA << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_EAint8_mem>:
movsbl (%rdi),%eax
test   $0xffffff16,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_EAint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = and i32 %3, -234
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 -40, i32 -20
ret i32 %6
}
int test_imm_D3int8_mem(signed char *val) {
  return ((*val) & (-0xD3 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_D3int8_mem>:
movsbl (%rdi),%eax
test   $0xffffff2d,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_D3int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = and i32 %3, -211
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 -40, i32 -20
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
FILE *openFileToRead(const char *name) {
  FILE *file = fopen(name, "r");
  if (!file)
    fprintf(stderr, "Problem with file '%s' during opening to read.\n", name);
  return file;
}


x86 assembly (clang, -O0):
<openFileToRead>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1164 <openFileToRead+0x44>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xea3(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<openFileToRead>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xed2(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1153 <openFileToRead+0x33>
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
lea    0xeb7(%rip),%rsi
mov    %r14,%rdx
call   1030 <fprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [48 x i8] c"Problem with file '%s' during opening to read.\0A\00"
define i32* @openFileToRead(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = icmp ne i32* %6, null
br i1 %7, label %12, label %8
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %2
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %8, %1
%13 = load i32*, i32** %3
ret i32* %13
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [48 x i8] c"Problem with file '%s' during opening to read.\0A\00"
define noalias i32* @openFileToRead(i8* %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %7
7: ; preds = %4, %1
ret i32* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void stddefs(FILE *f) {
  fprintf(f, "#ifndef EXIT_SUCCESS\n");
  fprintf(f, "#define EXIT_SUCCESS 0\n");
  fprintf(f, "#define EXIT_FAILURE 1\n");
  fprintf(f, "#endif\n\n");
}


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

x86 assembly (clang, -O2):
<stddefs>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
mov    $0x15,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xee2(%rip),%rdi
mov    $0x17,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xee1(%rip),%rdi
mov    $0x17,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xee0(%rip),%rdi
mov    $0x8,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
pop    %rbx
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"#ifndef EXIT_SUCCESS\0A\00"
@.str.1 = [24 x i8] c"#define EXIT_SUCCESS 0\0A\00"
@.str.2 = [24 x i8] c"#define EXIT_FAILURE 1\0A\00"
@.str.3 = [9 x i8] c"#endif\0A\0A\00"
define void @stddefs(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%5 = load i32*, i32** %2
%6 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32*, i32** %2
%8 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%9 = load i32*, i32** %2
%10 = call i32 @fprintf(i32* %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"#ifndef EXIT_SUCCESS\0A\00"
@.str.1 = [24 x i8] c"#define EXIT_SUCCESS 0\0A\00"
@.str.2 = [24 x i8] c"#define EXIT_FAILURE 1\0A\00"
@.str.3 = [9 x i8] c"#endif\0A\0A\00"
define void @stddefs(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i64 21, i64 1, i32* %0)
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i64 23, i64 1, i32* %0)
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i64 23, i64 1, i32* %0)
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i64 8, i64 1, i32* %0)
ret void
}
void _irq_timer(void) {
  extern void tty_blink(int ms);
  tty_blink(1000 / 18);
  extern void kjvm_fd_handle_t();
  kjvm_fd_handle_t();
}


x86 assembly (clang, -O0):
<_irq_timer>:
push   %rbp
mov    %rsp,%rbp
mov    $0x37,%edi
call   1040 <tty_blink@plt>
mov    $0x0,%al
call   1030 <kjvm_fd_handle_t@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<_irq_timer>:
push   %rax
mov    $0x37,%edi
call   1040 <tty_blink@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <kjvm_fd_handle_t@plt>

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

LLVM IR (-O2):
define void @_irq_timer() {
tail call void @tty_blink(i32 55)
tail call void (...) @kjvm_fd_handle_t()
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int /*<<< orphan*/ strreverse(char *, char *);
void modp_ultoa10(uint64_t value, char *str) {
  char *wstr = str;
  do
    *wstr++ = 48 + (value % 10);
  while (value /= 10);
  *wstr = '\0';
  strreverse(str, wstr - 1);
}


x86 assembly (clang, -O0):
<modp_ultoa10>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
jne    1127 <modp_ultoa10+0x17>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0xffffffffffffffff,%rsi
call   1030 <strreverse@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modp_ultoa10>:
mov    %rsi,%r8
add    $0xffffffffffffffff,%rsi
nopw   0x0(%rax,%rax,1)
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
lea    (%rdi,%rdi,1),%edx
lea    (%rdx,%rdx,4),%edx
mov    %ecx,%eax
sub    %edx,%eax
add    $0x30,%al
mov    %al,0x1(%rsi)
add    $0x1,%rsi
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1120 <modp_ultoa10+0x10>
movb   $0x0,0x1(%rsi)
mov    %r8,%rdi
jmp    1030 <strreverse@plt>

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

LLVM IR (-O2):
define void @modp_ultoa10(i32 %0, i8* %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ %0, %2 ], [ %10, %3 ]
%5 = phi i8* [ %1, %2 ], [ %9, %3 ]
%6 = srem i32 %4, 10
%7 = trunc i32 %6 to i8
%8 = add nsw i8 %7, 48
%9 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %8, i8* %5
%10 = sdiv i32 %4, 10
%11 = add i32 %4, 9
%12 = icmp ult i32 %11, 19
br i1 %12, label %13, label %3
13: ; preds = %3
store i8 0, i8* %9
%14 = tail call i32 @strreverse(i8* %1, i8* %5)
ret void
}
int MediaInitHAL() { return 0; }


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

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

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

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

/* Variables and functions */
void EPIConfigGPModeSet(uint32_t ui32Base, uint32_t ui32Config,
                        uint32_t ui32FrameCount, uint32_t ui32MaxWait) {
  ;
  ;
  ;
  ui32Config &= ~0x03C00000;
  ui32Config |= ui32FrameCount << 22;
  ui32Config &= ~0x0000FF00;
  ui32Config |= ui32MaxWait << 8;
  (*((volatile uint32_t *)(ui32Base + 0x00000010))) = ui32Config;
}


x86 assembly (clang, -O0):
<EPIConfigGPModeSet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
and    $0xfc3fffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x16,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xffff00ff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
shl    $0x8,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x10,%eax
cltq
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<EPIConfigGPModeSet>:
and    $0xfc3f00ff,%esi
shl    $0x16,%edx
or     %esi,%edx
shl    $0x8,%ecx
or     %edx,%ecx
movslq %edi,%rax
mov    %ecx,0x10(%rax)
ret

LLVM IR (-O0):
define void @EPIConfigGPModeSet(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %6
%10 = and i32 %9, -62914561
store i32 %10, i32* %6
%11 = load i32, i32* %7
%12 = shl i32 %11, 22
%13 = load i32, i32* %6
%14 = or i32 %13, %12
store i32 %14, i32* %6
%15 = load i32, i32* %6
%16 = and i32 %15, -65281
store i32 %16, i32* %6
%17 = load i32, i32* %8
%18 = shl i32 %17, 8
%19 = load i32, i32* %6
%20 = or i32 %19, %18
store i32 %20, i32* %6
%21 = load i32, i32* %6
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 16
%24 = sext i32 %23 to i64
%25 = inttoptr i64 %24 to i32*
store volatile i32 %21, i32* %25
ret void
}

LLVM IR (-O2):
define void @EPIConfigGPModeSet(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = and i32 %1, -62979841
%6 = shl i32 %2, 22
%7 = or i32 %6, %5
%8 = shl i32 %3, 8
%9 = or i32 %7, %8
%10 = add nsw i32 %0, 16
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i32*
store volatile i32 %9, i32* %12
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ key_t;

/* Variables and functions */
int IPC_CREAT;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ ftok(char *, char);
int msgget(int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int sim_init_queue(int qid) {
  key_t key;
  int msgqueue_id;
  key = ftok(".", 'm');
  if ((msgqueue_id = msgget(key, IPC_CREAT | 0660)) == -1) {
    perror("msgget");
    exit(1);
  }
  return msgqueue_id;
}


x86 assembly (clang, -O0):
<sim_init_queue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xeae(%rip),%rdi
mov    $0x6d,%esi
call   1060 <ftok@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2e77(%rip),%rax
mov    (%rax),%esi
or     $0x1b0,%esi
call   1030 <msgget@plt>
mov    %eax,-0xc(%rbp)
cmp    $0xffffffff,%eax
jne    1198 <sim_init_queue+0x58>
lea    0xe79(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sim_init_queue>:
push   %rax
lea    0xeb8(%rip),%rdi
mov    $0x6d,%esi
call   1060 <ftok@plt>
mov    0x2e87(%rip),%rcx
mov    $0x1b0,%esi
or     (%rcx),%esi
mov    %eax,%edi
call   1030 <msgget@plt>
cmp    $0xffffffff,%eax
je     116e <sim_init_queue+0x2e>
pop    %rcx
ret
lea    0xe8d(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c".\00"
@IPC_CREAT = global i32 0
@.str.1 = [7 x i8] c"msgget\00"
define i32 @sim_init_queue(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = call i32 @ftok(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8 signext 109)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = load i32, i32* @IPC_CREAT
%8 = or i32 %7, 432
%9 = call i32 @msgget(i32 %6, i32 %8)
store i32 %9, i32* %4
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %14
11: ; preds = %1
%12 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %1
%15 = load i32, i32* %4
ret i32 %15
}

LLVM IR (-O2):
@.str = [2 x i8] c".\00"
@IPC_CREAT = global i32 0
@.str.1 = [7 x i8] c"msgget\00"
define i32 @sim_init_queue(i32 %0) {
%2 = tail call i32 @ftok(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8 signext 109)
%3 = load i32, i32* @IPC_CREAT
%4 = or i32 %3, 432
%5 = tail call i32 @msgget(i32 %2, i32 %4)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ solve(int, int);
int main(void) {
  solve(3, 7);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3,%edi
mov    $0x7,%esi
call   1030 <solve@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @solve(i32 3, i32 7)
ret i32 0
}
int test_imm_9Eint8_reg(signed char val) {
  return ((val) & (0x9E << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_9Eint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0x9e,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_9Eint8_reg(i8 signext %0) {
%2 = and i8 %0, -98
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int sumFooStatic(int a, int b) { return a + b; }


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

x86 assembly (clang, -O2):
<sumFooStatic>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @sumFooStatic(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 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @sumFooStatic(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ do_unlink_files();
void unlink_files(void *aux __attribute__((__unused__))) { do_unlink_files(); }


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

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

LLVM IR (-O0):
define void @unlink_files(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @do_unlink_files()
ret void
}

LLVM IR (-O2):
define void @unlink_files(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @do_unlink_files()
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint8_t labelset_is_simple_goal(uint16_t labelsetid) {
  if (labelsetid >= 10) {
    return 0;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<labelset_is_simple_goal>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jl     111d <labelset_is_simple_goal+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1124 <labelset_is_simple_goal+0x24>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<labelset_is_simple_goal>:
xor    %eax,%eax
cmp    $0xa,%edi
setl   %al
ret

LLVM IR (-O0):
define i32 @labelset_is_simple_goal(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 10
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %8
7: ; preds = %1
store i32 1, i32* %2
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @labelset_is_simple_goal(i32 %0) {
%2 = icmp slt i32 %0, 10
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_sig2str() {
  printf("NOT IMPLEMENTED:"
         "pa_sig2str"
         "\n");
}


x86 assembly (clang, -O0):
<pa_sig2str>:
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_sig2str>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@str = [27 x i8] c"NOT IMPLEMENTED:pa_sig2str\00"
define i32 @pa_sig2str() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int mkdir(char *, int);
int /*<<< orphan*/ *opendir(char *);
int /*<<< orphan*/ printf(char *, char *);
void my_mkdir(char *path) {
  if (NULL == opendir(path)) {
    if (-1 == mkdir(path, 0777)) {
      printf("mkdir %s fail", path);
      exit(-1);
    }
  }
}


x86 assembly (clang, -O0):
<my_mkdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <opendir@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    119f <my_mkdir+0x5f>
mov    -0x8(%rbp),%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    119a <my_mkdir+0x5a>
mov    -0x8(%rbp),%rsi
lea    0xe75(%rip),%rdi
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
jmp    119f <my_mkdir+0x5f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_mkdir>:
push   %rbx
mov    %rdi,%rbx
call   1040 <opendir@plt>
test   %rax,%rax
jne    1160 <my_mkdir+0x20>
mov    %rbx,%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
cmp    $0xffffffff,%eax
je     1162 <my_mkdir+0x22>
pop    %rbx
ret
lea    0xe97(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"mkdir %s fail\00"
define void @my_mkdir(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32* @opendir(i8* %3)
%5 = icmp eq i32* null, %4
br i1 %5, label %6, label %15
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @mkdir(i8* %7, i32 511)
%9 = icmp eq i32 -1, %8
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = load i8*, i8** %2
%12 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = call i32 @exit(i32 -1)
unreachable
14: ; preds = %6
br label %15
15: ; preds = %14, %1
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"mkdir %s fail\00"
define void @my_mkdir(i8* %0) {
%2 = tail call i32* @opendir(i8* %0)
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %10
4: ; preds = %1
%5 = tail call i32 @mkdir(i8* %0, i32 511)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %0)
%9 = tail call i32 @exit(i32 -1)
unreachable
10: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ w83697xx_memw_enable(int);
int w83697xx_memw_enable_2e(void) {
  w83697xx_memw_enable(0x2E);
  return 0;
}


x86 assembly (clang, -O0):
<w83697xx_memw_enable_2e>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2e,%edi
call   1030 <w83697xx_memw_enable@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<w83697xx_memw_enable_2e>:
push   %rax
mov    $0x2e,%edi
call   1030 <w83697xx_memw_enable@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @w83697xx_memw_enable_2e() {
%1 = call i32 @w83697xx_memw_enable(i32 46)
ret i32 0
}

LLVM IR (-O2):
define i32 @w83697xx_memw_enable_2e() {
%1 = tail call i32 @w83697xx_memw_enable(i32 46)
ret i32 0
}
/* Variables and functions */
int tcsendbreak(int, int /*<<< orphan*/);
int SendBreak(int mfd) { return (tcsendbreak(mfd, 0)); }


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

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

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

LLVM IR (-O2):
define i32 @SendBreak(i32 %0) {
%2 = tail call i32 @tcsendbreak(i32 %0, i32 0)
ret i32 %2
}
void end_asig_section() {}


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

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

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

LLVM IR (-O2):
define void @end_asig_section() {
ret void
}
/* Variables and functions */
int enBuyuk(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a[10] = {100, -250, 400, 125, 550, 900, 689, 450, 347, 700};
  int eb;
  eb = enBuyuk(a, 10);
  printf("En buyuk eleman = %d\n", eb);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1040 <enBuyuk@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%esi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0xef5(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebd(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xa,%esi
call   1040 <enBuyuk@plt>
lea    0xecd(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [10 x i32] [i32 100, i32 -250, i32 400, i32 125, i32 550, i32 900, i32 689, i32 450, i32 347, i32 700]
@.str = [22 x i8] c"En buyuk eleman = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [10 x i32]* %2 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%6 = call i32 @enBuyuk(i32* %5, i32 10)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [10 x i32] [i32 100, i32 -250, i32 400, i32 125, i32 550, i32 900, i32 689, i32 450, i32 347, i32 700]
@.str = [22 x i8] c"En buyuk eleman = %d\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @enBuyuk(i32* %3, i32 10)
%5 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
int func(int in) { return in + 5; }


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

x86 assembly (clang, -O2):
<func>:
lea    0x5(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @func(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 5
ret i32 %4
}

LLVM IR (-O2):
define i32 @func(i32 %0) {
%2 = add nsw i32 %0, 5
ret i32 %2
}
/* Variables and functions */
int O_DIRECTORY;
int O_RDONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fsync(int);
int open(char *, int);
void dir_sync(char *path) {
  int dir_fd;
  dir_fd = open(path, O_RDONLY | O_DIRECTORY);
  if (dir_fd >= 0) {
    fsync(dir_fd);
    close(dir_fd);
  }
}


x86 assembly (clang, -O0):
<dir_sync>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
mov    0x2e88(%rip),%rax
or     (%rax),%esi
call   1050 <open@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1174 <dir_sync+0x44>
mov    -0xc(%rbp),%edi
call   1040 <fsync@plt>
mov    -0xc(%rbp),%edi
call   1030 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dir_sync>:
push   %rbx
mov    0x2eb0(%rip),%rax
mov    0x2e99(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
call   1050 <open@plt>
test   %eax,%eax
js     115d <dir_sync+0x2d>
mov    %eax,%ebx
mov    %eax,%edi
call   1040 <fsync@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <close@plt>
pop    %rbx
ret

LLVM IR (-O0):
@O_RDONLY = global i32 0
@O_DIRECTORY = global i32 0
define void @dir_sync(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i32, i32* @O_RDONLY
%6 = load i32, i32* @O_DIRECTORY
%7 = or i32 %5, %6
%8 = call i32 @open(i8* %4, i32 %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = icmp sge i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %1
%12 = load i32, i32* %3
%13 = call i32 @fsync(i32 %12)
%14 = load i32, i32* %3
%15 = call i32 @close(i32 %14)
br label %16
16: ; preds = %11, %1
ret void
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
@O_DIRECTORY = global i32 0
define void @dir_sync(i8* nocapture %0) {
%2 = load i32, i32* @O_RDONLY
%3 = load i32, i32* @O_DIRECTORY
%4 = or i32 %3, %2
%5 = tail call i32 @open(i8* %0, i32 %4)
%6 = icmp sgt i32 %5, -1
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = tail call i32 @fsync(i32 %5)
%9 = tail call i32 @close(i32 %5)
br label %10
10: ; preds = %7, %1
ret void
}