xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_array(int *A, int n) {
  for (int i = 1; i <= n; ++i)
    printf(" %d", A[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<print_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1159 <print_array+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print_array+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1167 <print_array+0x47>
mov    %esi,%r12d
mov    %rdi,%r14
add    $0x1,%r12d
mov    $0x1,%ebx
lea    0xebe(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r14,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1150 <print_array+0x30>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c" %d\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_array(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 1, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c" %d\00"
define void @print_array(i32* nocapture %0, i32 %1) {
%3 = icmp slt i32 %1, 1
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = add nuw i32 %1, 1
%6 = zext i32 %5 to i64
br label %9
7: ; preds = %9, %2
%8 = tail call i32 @putchar(i32 10)
ret void
9: ; preds = %4, %9
%10 = phi i64 [ 1, %4 ], [ %14, %9 ]
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = load i32, i32* %11
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = add nuw nsw i64 %10, 1
%15 = icmp eq i64 %14, %6
br i1 %15, label %7, label %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int menu() {
  printf("menu : \n");
  printf("1.liste des referentiels\n");
  printf("2.contenu d'un referentiel\n");
  printf("3.telechargement d'un referentiel\n");
  printf("4.quitter\n");
}


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

x86 assembly (clang, -O2):
<menu>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
lea    0xf00(%rip),%rdi
call   1030 <puts@plt>
lea    0xf16(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"menu : \0A\00"
@.str.1 = [26 x i8] c"1.liste des referentiels\0A\00"
@.str.2 = [28 x i8] c"2.contenu d'un referentiel\0A\00"
@.str.3 = [35 x i8] c"3.telechargement d'un referentiel\0A\00"
@.str.4 = [11 x i8] c"4.quitter\0A\00"
define i32 @menu() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
@str = [8 x i8] c"menu : \00"
@str.5 = [25 x i8] c"1.liste des referentiels\00"
@str.6 = [27 x i8] c"2.contenu d'un referentiel\00"
@str.7 = [34 x i8] c"3.telechargement d'un referentiel\00"
@str.8 = [10 x i8] c"4.quitter\00"
define i32 @menu() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.5, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.6, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.7, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.8, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printTestInfo(char *, char *);
int addAtRearWithNoNodes() {
  printTestInfo("addAtRearWithNoNodes", "(not implemented)");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [21 x i8] c"addAtRearWithNoNodes\00"
@.str.1 = [18 x i8] c"(not implemented)\00"
define i32 @addAtRearWithNoNodes() {
%1 = call i32 @printTestInfo(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"addAtRearWithNoNodes\00"
@.str.1 = [18 x i8] c"(not implemented)\00"
define i32 @addAtRearWithNoNodes() {
%1 = tail call i32 @printTestInfo(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct timespec {
  scalar_t__ tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
double diff_ts_d(struct timespec a, struct timespec b) {
  return ((double)(a.tv_sec - b.tv_sec) +
          (double)(a.tv_nsec - b.tv_nsec) / 1000000000UL);
}


x86 assembly (clang, -O0):
<diff_ts_d>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x8(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
sub    -0x18(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    -0x10(%rbp),%rax
sub    -0x20(%rbp),%rax
cvtsi2sd %rax,%xmm1
movsd  0xeca(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<diff_ts_d>:
sub    %rcx,%rsi
cvtsi2sd %rsi,%xmm1
sub    %rdx,%rdi
cvtsi2sd %rdi,%xmm0
divsd  0xee8(%rip),%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
define double @diff_ts_d(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca %struct.timespec
%6 = alloca %struct.timespec
%7 = bitcast %struct.timespec* %5 to { i64, i64 }*
%8 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %7, i32 0, i32 0
store i64 %0, i64* %8
%9 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %7, i32 0, i32 1
store i64 %1, i64* %9
%10 = bitcast %struct.timespec* %6 to { i64, i64 }*
%11 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %10, i32 0, i32 0
store i64 %2, i64* %11
%12 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %10, i32 0, i32 1
store i64 %3, i64* %12
%13 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 1
%14 = load i64, i64* %13
%15 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i32 0, i32 1
%16 = load i64, i64* %15
%17 = sub nsw i64 %14, %16
%18 = sitofp i64 %17 to double
%19 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 0
%20 = load i64, i64* %19
%21 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i32 0, i32 0
%22 = load i64, i64* %21
%23 = sub nsw i64 %20, %22
%24 = sitofp i64 %23 to double
%25 = fdiv double %24, 1.000000e+09
%26 = fadd double %18, %25
ret double %26
}

LLVM IR (-O2):
define double @diff_ts_d(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = sub nsw i64 %1, %3
%6 = sitofp i64 %5 to double
%7 = sub nsw i64 %0, %2
%8 = sitofp i64 %7 to double
%9 = fdiv double %8, 1.000000e+09
%10 = fadd double %9, %6
ret double %10
}
void signed_char_shr_signed_char_signed_int(signed char *LHS, signed int RHS) {
  (*LHS) >>= RHS;
}


x86 assembly (clang, -O0):
<signed_char_shr_signed_char_signed_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
sar    %cl,%edx
mov    %edx,%ecx
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<signed_char_shr_signed_char_signed_int>:
mov    %esi,%ecx
movsbl (%rdi),%eax
sar    %cl,%eax
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @signed_char_shr_signed_char_signed_int(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = ashr i32 %8, %5
%10 = trunc i32 %9 to i8
store i8 %10, i8* %6
ret void
}

LLVM IR (-O2):
define void @signed_char_shr_signed_char_signed_int(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = sext i8 %3 to i32
%5 = ashr i32 %4, %1
%6 = trunc i32 %5 to i8
store i8 %6, i8* %0
ret void
}
/* Variables and functions */
long long __kiqnnt(long double);
long long intr_wrap_413(long double p1) { return __kiqnnt(p1); }


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

x86 assembly (clang, -O2):
<intr_wrap_413>:
jmp    1030 <__kiqnnt@plt>

LLVM IR (-O0):
define i64 @intr_wrap_413(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = call i64 @__kiqnnt(x86_fp80 %3)
ret i64 %4
}

LLVM IR (-O2):
define i64 @intr_wrap_413(x86_fp80 %0) {
%2 = tail call i64 @__kiqnnt(x86_fp80 %0)
ret i64 %2
}
int Hash_Int2ManHash(int iData0, int iData1, int nTableSize) {
  return (4177 * (unsigned)iData0 + 7873 * (unsigned)iData1) %
         (unsigned)nTableSize;
}


x86 assembly (clang, -O0):
<Hash_Int2ManHash>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
imul   $0x1051,-0x4(%rbp),%eax
imul   $0x1ec1,-0x8(%rbp),%ecx
add    %ecx,%eax
xor    %edx,%edx
divl   -0xc(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Hash_Int2ManHash>:
mov    %edx,%ecx
imul   $0x1051,%edi,%edx
imul   $0x1ec1,%esi,%eax
add    %edx,%eax
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @Hash_Int2ManHash(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = mul i32 4177, %7
%9 = load i32, i32* %5
%10 = mul i32 7873, %9
%11 = add i32 %8, %10
%12 = load i32, i32* %6
%13 = urem i32 %11, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @Hash_Int2ManHash(i32 %0, i32 %1, i32 %2) {
%4 = mul i32 %0, 4177
%5 = mul i32 %1, 7873
%6 = add i32 %5, %4
%7 = urem i32 %6, %2
ret i32 %7
}
int readshort(char *packet, char **src, unsigned short *dst) {
  unsigned char *p;
  p = (unsigned char *)*src;
  *dst = (p[0] << 8) | p[1];
  (*src) += sizeof(unsigned short);
  return sizeof(unsigned short);
}


x86 assembly (clang, -O0):
<readshort>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movzbl (%rax),%eax
shl    $0x8,%eax
mov    -0x20(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
or     %ecx,%eax
mov    %ax,%cx
mov    -0x18(%rbp),%rax
mov    %cx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x2,%rcx
mov    %rcx,(%rax)
mov    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<readshort>:
mov    (%rsi),%rax
movzwl (%rax),%ecx
rol    $0x8,%cx
mov    %cx,(%rdx)
add    $0x2,%rax
mov    %rax,(%rsi)
mov    $0x2,%eax
ret

LLVM IR (-O0):
define i32 @readshort(i8* %0, i8** %1, i16* %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i16*
%7 = alloca i8*
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i16* %2, i16** %6
%8 = load i8**, i8*** %5
%9 = load i8*, i8** %8
store i8* %9, i8** %7
%10 = load i8*, i8** %7
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = shl i32 %13, 8
%15 = load i8*, i8** %7
%16 = getelementptr inbounds i8, i8* %15, i64 1
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = or i32 %14, %18
%20 = trunc i32 %19 to i16
%21 = load i16*, i16** %6
store i16 %20, i16* %21
%22 = load i8**, i8*** %5
%23 = load i8*, i8** %22
%24 = getelementptr inbounds i8, i8* %23, i64 2
store i8* %24, i8** %22
ret i32 2
}

LLVM IR (-O2):
define i32 @readshort(i8* nocapture readnone %0, i8** nocapture %1, i16* nocapture writeonly %2) {
%4 = load i8*, i8** %1
%5 = load i8, i8* %4
%6 = zext i8 %5 to i16
%7 = shl nuw i16 %6, 8
%8 = getelementptr inbounds i8, i8* %4, i64 1
%9 = load i8, i8* %8
%10 = zext i8 %9 to i16
%11 = or i16 %7, %10
store i16 %11, i16* %2
%12 = getelementptr inbounds i8, i8* %4, i64 2
store i8* %12, i8** %1
ret i32 2
}
/* Variables and functions */
int /*<<< orphan*/ write_ZIGBEE_short(int, int);
void MAC_reset() { write_ZIGBEE_short(0x2A, 0x01); }


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

x86 assembly (clang, -O2):
<MAC_reset>:
mov    $0x2a,%edi
mov    $0x1,%esi
jmp    1030 <write_ZIGBEE_short@plt>

LLVM IR (-O0):
define void @MAC_reset() {
%1 = call i32 @write_ZIGBEE_short(i32 42, i32 1)
ret void
}

LLVM IR (-O2):
define void @MAC_reset() {
%1 = tail call i32 @write_ZIGBEE_short(i32 42, i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcmp(char *, void *, int);
int check_magic(void *magic) {
  if (!memcmp("start", magic, 6))
    return 0;
  if (!memcmp("asar1", magic, 6))
    return 0;
  return -1;
}


x86 assembly (clang, -O0):
<check_magic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xed9(%rip),%rdi
mov    $0x6,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%eax
jne    1146 <check_magic+0x36>
movl   $0x0,-0x4(%rbp)
jmp    1177 <check_magic+0x67>
mov    -0x10(%rbp),%rsi
lea    0xeb5(%rip),%rdi
mov    $0x6,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%eax
jne    1170 <check_magic+0x60>
movl   $0x0,-0x4(%rbp)
jmp    1177 <check_magic+0x67>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_magic>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
mov    %rbx,%rsi
mov    $0x6,%edx
call   1030 <memcmp@plt>
test   %eax,%eax
je     1146 <check_magic+0x36>
lea    0xed3(%rip),%rdi
mov    %rbx,%rsi
mov    $0x6,%edx
call   1030 <memcmp@plt>
neg    %eax
sbb    %eax,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"start\00"
@.str.1 = [6 x i8] c"asar1\00"
define i32 @check_magic(i8* %0) {
%2 = tail call i32 @memcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i32 6)
%3 = icmp eq i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @memcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 6)
%6 = icmp ne i32 %5, 0
%7 = sext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %9
}
unsigned short int isletter(char symb) {
  if (symb >= 'a' && symb <= 'z')
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<isletter>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x3(%rbp)
movsbl -0x3(%rbp),%eax
cmp    $0x61,%eax
jl     112f <isletter+0x2f>
movsbl -0x3(%rbp),%eax
cmp    $0x7a,%eax
jg     112f <isletter+0x2f>
movw   $0x1,-0x2(%rbp)
jmp    1135 <isletter+0x35>
movw   $0x0,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isletter>:
add    $0x9f,%dil
xor    %eax,%eax
cmp    $0x1a,%dil
setb   %al
ret

LLVM IR (-O0):
define zeroext i16 @isletter(i8 signext %0) {
%2 = alloca i16
%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 %12
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 %12
11: ; preds = %7
store i16 1, i16* %2
br label %13
12: ; preds = %7, %1
store i16 0, i16* %2
br label %13
13: ; preds = %12, %11
%14 = load i16, i16* %2
ret i16 %14
}

LLVM IR (-O2):
define zeroext i16 @isletter(i8 signext %0) {
%2 = add i8 %0, -97
%3 = icmp ult i8 %2, 26
%4 = zext i1 %3 to i16
ret i16 %4
}
/* Type definitions */
struct node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ PrintTreeRecurse(struct node *, int /*<<< orphan*/);
void PrintTree(struct node *tree) { PrintTreeRecurse(tree, 0); }


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

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

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

LLVM IR (-O2):
%struct.node = type { i32 }
define void @PrintTree(%struct.node* %0) {
%2 = tail call i32 @PrintTreeRecurse(%struct.node* %0, i32 0)
ret void
}
int uart_get_file(unsigned char *buffer) {
  if ((*(volatile unsigned int *)(0x7F005010)) & 1) {
    *buffer = (*(volatile unsigned int *)(0x7F005024));
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<uart_get_file>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    $0x7f005010,%eax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1136 <uart_get_file+0x36>
mov    $0x7f005024,%eax
mov    (%rax),%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    113d <uart_get_file+0x3d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_get_file>:
xor    %eax,%eax
testl  $0x1,0x7f005010
je     111d <uart_get_file+0x1d>
mov    0x7f005024,%eax
mov    %al,(%rdi)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @uart_get_file(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load volatile i32, i32* inttoptr (i64 2130726928 to i32*)
%5 = and i32 %4, 1
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load volatile i32, i32* inttoptr (i64 2130726948 to i32*)
%9 = trunc i32 %8 to i8
%10 = load i8*, i8** %3
store i8 %9, i8* %10
store i32 1, i32* %2
br label %12
11: ; preds = %1
store i32 0, i32* %2
br label %12
12: ; preds = %11, %7
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @uart_get_file(i8* nocapture writeonly %0) {
%2 = load volatile i32, i32* inttoptr (i64 2130726928 to i32*)
%3 = and i32 %2, 1
%4 = icmp eq i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = load volatile i32, i32* inttoptr (i64 2130726948 to i32*)
%7 = trunc i32 %6 to i8
store i8 %7, i8* %0
br label %8
8: ; preds = %1, %5
%9 = phi i32 [ 1, %5 ], [ 0, %1 ]
ret i32 %9
}
unsigned int mim_version(void) { return ((0 << 16) | (0 << 8) | (0)); }


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

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

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

LLVM IR (-O2):
define i32 @mim_version() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ activate_help(char *);
int /*<<< orphan*/ select_fast();
void fast_handler(int x, int y, int button) {
  if (button == 3) {
    activate_help("fast.hlp");
  } else {
    select_fast();
  }
}


x86 assembly (clang, -O0):
<fast_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jne    114c <fast_handler+0x2c>
lea    0xebe(%rip),%rdi
call   1040 <activate_help@plt>
jmp    1153 <fast_handler+0x33>
mov    $0x0,%al
call   1030 <select_fast@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fast_handler>:
cmp    $0x3,%edx
jne    1131 <fast_handler+0x11>
lea    0xed4(%rip),%rdi
jmp    1040 <activate_help@plt>
xor    %eax,%eax
jmp    1030 <select_fast@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"fast.hlp\00"
define void @fast_handler(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, 3
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = call i32 @activate_help(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %13
11: ; preds = %3
%12 = call i32 (...) @select_fast()
br label %13
13: ; preds = %11, %9
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"fast.hlp\00"
define void @fast_handler(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 3
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @activate_help(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %9
7: ; preds = %3
%8 = tail call i32 (...) @select_fast()
br label %9
9: ; preds = %7, %5
ret void
}
int FloatCmp(void *vp1, void *vp2) {
  float *fp1 = (float *)vp1;
  float *fp2 = (float *)vp2;
  if (*fp1 - *fp2 > 0)
    return 1;
  if (*fp1 - *fp2 < 0)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<FloatCmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x28(%rbp),%rax
subss  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1144 <FloatCmp+0x44>
movl   $0x1,-0x4(%rbp)
jmp    1173 <FloatCmp+0x73>
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x28(%rbp),%rax
subss  (%rax),%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm1,%xmm0
jbe    116c <FloatCmp+0x6c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1173 <FloatCmp+0x73>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FloatCmp>:
movss  (%rdi),%xmm0
subss  (%rsi),%xmm0
xorps  %xmm1,%xmm1
xor    %ecx,%ecx
ucomiss %xmm0,%xmm1
seta   %cl
neg    %ecx
ucomiss %xmm1,%xmm0
mov    $0x1,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @FloatCmp(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca float*
%7 = alloca float*
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to float*
store float* %9, float** %6
%10 = load i8*, i8** %5
%11 = bitcast i8* %10 to float*
store float* %11, float** %7
%12 = load float*, float** %6
%13 = load float, float* %12
%14 = load float*, float** %7
%15 = load float, float* %14
%16 = fsub float %13, %15
%17 = fcmp ogt float %16, 0.000000e+00
br i1 %17, label %18, label %19
18: ; preds = %2
store i32 1, i32* %3
br label %28
19: ; preds = %2
%20 = load float*, float** %6
%21 = load float, float* %20
%22 = load float*, float** %7
%23 = load float, float* %22
%24 = fsub float %21, %23
%25 = fcmp olt float %24, 0.000000e+00
br i1 %25, label %26, label %27
26: ; preds = %19
store i32 -1, i32* %3
br label %28
27: ; preds = %19
store i32 0, i32* %3
br label %28
28: ; preds = %27, %26, %18
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
define i32 @FloatCmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to float*
%4 = bitcast i8* %1 to float*
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fsub float %5, %6
%8 = fcmp ogt float %7, 0.000000e+00
%9 = fcmp olt float %7, 0.000000e+00
%10 = sext i1 %9 to i32
%11 = select i1 %8, i32 1, i32 %10
ret i32 %11
}
/* Variables and functions */
void *compat_calloc(size_t, size_t);
int /*<<< orphan*/ memory_add_entry(void *, size_t, char const *, int);
void *memory_calloc(size_t nelem, size_t size, const char *srcname, int line) {
  void *ptr;
  ptr = compat_calloc(nelem, size);
  memory_add_entry(ptr, size, srcname, line);
  return ptr;
}


x86 assembly (clang, -O0):
<memory_calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <compat_calloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1040 <memory_add_entry@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memory_calloc>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %rsi,%rbp
call   1030 <compat_calloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
mov    %r14d,%ecx
call   1040 <memory_add_entry@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @memory_calloc(i64 %0, i64 %1, i8* %2, i32 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
store i64 %0, i64* %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load i64, i64* %5
%11 = load i64, i64* %6
%12 = call i8* @compat_calloc(i64 %10, i64 %11)
store i8* %12, i8** %9
%13 = load i8*, i8** %9
%14 = load i64, i64* %6
%15 = load i8*, i8** %7
%16 = load i32, i32* %8
%17 = call i32 @memory_add_entry(i8* %13, i64 %14, i8* %15, i32 %16)
%18 = load i8*, i8** %9
ret i8* %18
}

LLVM IR (-O2):
define i8* @memory_calloc(i64 %0, i64 %1, i8* %2, i32 %3) {
%5 = tail call i8* @compat_calloc(i64 %0, i64 %1)
%6 = tail call i32 @memory_add_entry(i8* %5, i64 %1, i8* %2, i32 %3)
ret i8* %5
}
/* Variables and functions */
scalar_t__ printf(char *);
void vcode_dump_tab(int col, int to_col) {
  if (col >= to_col)
    printf(" ");
  else {
    while (col < to_col)
      col += printf(" ");
  }
}


x86 assembly (clang, -O0):
<vcode_dump_tab>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     113b <vcode_dump_tab+0x2b>
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
jmp    116f <vcode_dump_tab+0x5f>
jmp    1140 <vcode_dump_tab+0x30>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    116a <vcode_dump_tab+0x5a>
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
jmp    1140 <vcode_dump_tab+0x30>
jmp    116f <vcode_dump_tab+0x5f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vcode_dump_tab>:
cmp    %esi,%edi
jge    1153 <vcode_dump_tab+0x33>
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xecd(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
call   1040 <printf@plt>
add    %eax,%ebp
cmp    %ebx,%ebp
jl     1140 <vcode_dump_tab+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    $0x20,%edi
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
define void @vcode_dump_tab(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp sge i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i64 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %22
10: ; preds = %2
br label %11
11: ; preds = %15, %10
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %21
15: ; preds = %11
%16 = call i64 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = add nsw i64 %18, %16
%20 = trunc i64 %19 to i32
store i32 %20, i32* %3
br label %11
21: ; preds = %11
br label %22
22: ; preds = %21, %8
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
define void @vcode_dump_tab(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @putchar(i32 32)
br label %12
6: ; preds = %2, %6
%7 = phi i32 [ %10, %6 ], [ %0, %2 ]
%8 = tail call i64 @printf(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = trunc i64 %8 to i32
%10 = add i32 %7, %9
%11 = icmp slt i32 %10, %1
br i1 %11, label %6, label %12
12: ; preds = %6, %4
ret void
}
/* Variables and functions */
int find_msb(unsigned int);
int gl_get_to_power_two(unsigned int val) {
  if ((val & (val - 1)) == 0) {
    return val;
  }
  return 1 << find_msb(val);
}


x86 assembly (clang, -O0):
<gl_get_to_power_two>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
jne    113a <gl_get_to_power_two+0x2a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114e <gl_get_to_power_two+0x3e>
mov    -0x8(%rbp),%edi
call   1030 <find_msb@plt>
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gl_get_to_power_two>:
lea    -0x1(%rdi),%eax
test   %eax,%edi
je     112a <gl_get_to_power_two+0x1a>
push   %rax
call   1030 <find_msb@plt>
mov    $0x1,%edi
mov    %eax,%ecx
shl    %cl,%edi
add    $0x8,%rsp
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @gl_get_to_power_two(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = load i32, i32* %3
%6 = sub i32 %5, 1
%7 = and i32 %4, %6
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i32, i32* %3
store i32 %10, i32* %2
br label %15
11: ; preds = %1
%12 = load i32, i32* %3
%13 = call i32 @find_msb(i32 %12)
%14 = shl i32 1, %13
store i32 %14, i32* %2
br label %15
15: ; preds = %11, %9
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @gl_get_to_power_two(i32 %0) {
%2 = tail call i32 @llvm.ctpop.i32(i32 %0)
%3 = icmp ult i32 %2, 2
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @find_msb(i32 %0)
%6 = shl nuw i32 1, %5
br label %7
7: ; preds = %1, %4
%8 = phi i32 [ %6, %4 ], [ %0, %1 ]
ret i32 %8
}
void pinmux_select_uart(void) {}


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

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

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

LLVM IR (-O2):
define void @pinmux_select_uart() {
ret void
}
short liq2(short pbottle) {
  return ((1 - pbottle) * 21 + (pbottle >> 1) * (21 + 22));
}


x86 assembly (clang, -O0):
<liq2>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%ecx
mov    $0x1,%eax
sub    %ecx,%eax
imul   $0x15,%eax,%eax
movswl -0x2(%rbp),%ecx
sar    $0x1,%ecx
imul   $0x2b,%ecx,%ecx
add    %ecx,%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<liq2>:
mov    $0x1,%eax
sub    %edi,%eax
lea    (%rax,%rax,4),%ecx
lea    (%rax,%rcx,4),%ecx
sar    %edi
imul   $0x2b,%edi,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define signext i16 @liq2(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = sub nsw i32 1, %4
%6 = mul nsw i32 %5, 21
%7 = load i16, i16* %2
%8 = sext i16 %7 to i32
%9 = ashr i32 %8, 1
%10 = mul nsw i32 %9, 43
%11 = add nsw i32 %6, %10
%12 = trunc i32 %11 to i16
ret i16 %12
}

LLVM IR (-O2):
define signext i16 @liq2(i16 signext %0) {
%2 = sub i16 1, %0
%3 = mul i16 %2, 21
%4 = ashr i16 %0, 1
%5 = mul i16 %4, 43
%6 = add i16 %3, %5
ret i16 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int ture_val, false_val;
  ture_val = (10 == 2);
  false_val = (10 <= 2);
  printf("ture = %d; false = %d \n", ture_val, false_val);
  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,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [24 x i8] c"ture = %d; false = %d \0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 0, i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ SIGINT;
int /*<<< orphan*/ SIGTERM;
int /*<<< orphan*/ SIG_DFL;
int /*<<< orphan*/ signal(int /*<<< orphan*/, int /*<<< orphan*/);
void sig_remove_abort(void) {
  signal(SIGINT, SIG_DFL);
  signal(SIGTERM, SIG_DFL);
}


x86 assembly (clang, -O0):
<sig_remove_abort>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
mov    0x2eac(%rip),%rax
mov    (%rax),%esi
call   1030 <signal@plt>
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
mov    0x2e95(%rip),%rax
mov    (%rax),%esi
call   1030 <signal@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_remove_abort>:
push   %rbx
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
mov    0x2eaf(%rip),%rbx
mov    (%rbx),%esi
call   1030 <signal@plt>
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%esi
pop    %rbx
jmp    1030 <signal@plt>

LLVM IR (-O0):
@SIGINT = global i32 0
@SIG_DFL = global i32 0
@SIGTERM = global i32 0
define void @sig_remove_abort() {
%1 = load i32, i32* @SIGINT
%2 = load i32, i32* @SIG_DFL
%3 = call i32 @signal(i32 %1, i32 %2)
%4 = load i32, i32* @SIGTERM
%5 = load i32, i32* @SIG_DFL
%6 = call i32 @signal(i32 %4, i32 %5)
ret void
}

LLVM IR (-O2):
@SIGINT = global i32 0
@SIG_DFL = global i32 0
@SIGTERM = global i32 0
define void @sig_remove_abort() {
%1 = load i32, i32* @SIGINT
%2 = load i32, i32* @SIG_DFL
%3 = tail call i32 @signal(i32 %1, i32 %2)
%4 = load i32, i32* @SIGTERM
%5 = load i32, i32* @SIG_DFL
%6 = tail call i32 @signal(i32 %4, i32 %5)
ret void
}
/* Variables and functions */
double _log10(double);
double d2d(double);
double log10(double x) { return d2d(_log10(d2d(x))); }


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

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

LLVM IR (-O0):
define double @log10(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @d2d(double %3)
%5 = call double @_log10(double %4)
%6 = call double @d2d(double %5)
ret double %6
}

LLVM IR (-O2):
define double @log10(double %0) {
%2 = tail call double @d2d(double %0)
%3 = tail call double @_log10(double %2)
%4 = tail call double @d2d(double %3)
ret double %4
}
void _infix_operator_mod_i8_i8(signed char lhs, signed char rhs,
                               signed char *__rval_1) {
  *__rval_1 = lhs % rhs;
}


x86 assembly (clang, -O0):
<_infix_operator_mod_i8_i8>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    %rdx,-0x10(%rbp)
movsbl -0x1(%rbp),%eax
movsbl -0x2(%rbp),%ecx
cltd
idiv   %ecx
mov    %dl,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<_infix_operator_mod_i8_i8>:
mov    %rdx,%rcx
mov    %edi,%eax
cwtd
idiv   %si
mov    %dl,(%rcx)
ret

LLVM IR (-O0):
define void @_infix_operator_mod_i8_i8(i8 signext %0, i8 signext %1, i8* %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8*
store i8 %0, i8* %4
store i8 %1, i8* %5
store i8* %2, i8** %6
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = load i8, i8* %5
%10 = sext i8 %9 to i32
%11 = srem i32 %8, %10
%12 = trunc i32 %11 to i8
%13 = load i8*, i8** %6
store i8 %12, i8* %13
ret void
}

LLVM IR (-O2):
define void @_infix_operator_mod_i8_i8(i8 signext %0, i8 signext %1, i8* nocapture writeonly %2) {
%4 = sext i8 %0 to i16
%5 = sext i8 %1 to i16
%6 = srem i16 %4, %5
%7 = trunc i16 %6 to i8
store i8 %7, i8* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int a = 12;
  int a1 = a++;
  int b = 10;
  int b1 = ++b;
  printf("a=%d, a1=%d\n", a, a1);
  printf("b=%d, b1=%d\n", b, b1);
  printf("a=%d, a1=%d\n", a, a++);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xc,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
mov    %eax,-0xc(%rbp)
movl   $0xa,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0xd,%esi
mov    $0xc,%edx
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
mov    $0xb,%esi
mov    $0xb,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xd,%esi
mov    $0xd,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"a=%d, a1=%d\0A\00"
@.str.1 = [13 x i8] c"b=%d, b1=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 12, i32* %2
%6 = load i32, i32* %2
%7 = add nsw i32 %6, 1
store i32 %7, i32* %2
store i32 %6, i32* %3
store i32 10, i32* %4
%8 = load i32, i32* %4
%9 = add nsw i32 %8, 1
store i32 %9, i32* %4
store i32 %9, i32* %5
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %11)
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %13, i32 %14)
%16 = load i32, i32* %2
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
%19 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %16, i32 %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"a=%d, a1=%d\0A\00"
@.str.1 = [13 x i8] c"b=%d, b1=%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 13, i32 12)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 11, i32 11)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 13, i32 13)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
__attribute__((destructor(200))) void fini_func200(void) {
  printf("fini_func with priority 200\n");
}


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

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

LLVM IR (-O0):
@.str = [29 x i8] c"fini_func with priority 200\0A\00"
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 200, void ()* @fini_func200, i8* null }]
define void @fini_func200() {
%1 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 200, void ()* @fini_func200, i8* null }]
@str = [28 x i8] c"fini_func with priority 200\00"
define void @fini_func200() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
ret void
}
int ft_lenint(long n) {
  int len;
  int i;
  len = 0;
  i = 0;
  if (n < 0) {
    len++;
    n = -n;
  }
  while (n || i == 0) {
    n = n / 10;
    len++;
    i++;
  }
  return (len);
}


x86 assembly (clang, -O0):
<ft_lenint>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    1134 <ft_lenint+0x34>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
sub    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1139 <ft_lenint+0x39>
mov    $0x1,%al
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
jne    1153 <ft_lenint+0x53>
cmpl   $0x0,-0x10(%rbp)
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1163 <ft_lenint+0x63>
jmp    118c <ft_lenint+0x8c>
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1139 <ft_lenint+0x39>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_lenint>:
mov    %rdi,%rcx
neg    %rcx
cmovs  %rdi,%rcx
shr    $0x3f,%rdi
movabs $0x6666666666666667,%rsi
66 66 66
nopl   0x0(%rax,%rax,1)
mov    %rcx,%rax
imul   %rsi
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x2,%rdx
add    %rax,%rdx
add    $0x1,%edi
add    $0xfffffffffffffff6,%rcx
cmp    $0xffffffffffffffed,%rcx
mov    %rdx,%rcx
jb     1120 <ft_lenint+0x20>
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_lenint(i64 %0) {
%2 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
%3 = lshr i64 %0, 63
%4 = trunc i64 %3 to i32
br label %5
5: ; preds = %1, %5
%6 = phi i32 [ %4, %1 ], [ %9, %5 ]
%7 = phi i64 [ %2, %1 ], [ %8, %5 ]
%8 = sdiv i64 %7, 10
%9 = add nuw nsw i32 %6, 1
%10 = add i64 %7, -10
%11 = icmp ult i64 %10, -19
br i1 %11, label %5, label %12
12: ; preds = %5
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ my_env(char **, char **);
int setenv_empty(char **env, char **s) {
  if (s[1] == NULL && s[2] == NULL) {
    my_env(env, s);
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<setenv_empty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpq   $0x0,0x8(%rax)
jne    1157 <setenv_empty+0x47>
mov    -0x18(%rbp),%rax
cmpq   $0x0,0x10(%rax)
jne    1157 <setenv_empty+0x47>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <my_env@plt>
movl   $0x1,-0x4(%rbp)
jmp    115e <setenv_empty+0x4e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setenv_empty>:
push   %rax
xor    %eax,%eax
cmpq   $0x0,0x8(%rsi)
je     111c <setenv_empty+0xc>
pop    %rcx
ret
cmpq   $0x0,0x10(%rsi)
jne    111a <setenv_empty+0xa>
call   1030 <my_env@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @setenv_empty(i8** %0, i8** %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %12
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = tail call i32 @my_env(i8** %0, i8** %1)
br label %12
12: ; preds = %2, %6, %10
%13 = phi i32 [ 1, %10 ], [ 0, %6 ], [ 0, %2 ]
ret i32 %13
}
/* Variables and functions */
char *strchr(char *, char);
int strlen(char *);
int unrem(char *regel) {
  char *c;
  c = strchr(regel, '#');
  if (c)
    c[0] = 0;
  return (strlen(regel));
}


x86 assembly (clang, -O0):
<unrem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x23,%esi
call   1040 <strchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1150 <unrem+0x30>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unrem>:
push   %rbx
mov    %rdi,%rbx
mov    $0x23,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1136 <unrem+0x16>
movb   $0x0,(%rax)
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <strlen@plt>

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

LLVM IR (-O2):
define i32 @unrem(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 35)
%3 = icmp eq i8* %2, null
br i1 %3, label %5, label %4
4: ; preds = %1
store i8 0, i8* %2
br label %5
5: ; preds = %4, %1
%6 = tail call i32 @strlen(i8* %0)
ret i32 %6
}