xunge/DecIR huggingface dataset:
int test_imm_8Auint8_reg(unsigned char val) {
  return ((val) & (0x8A << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_8Auint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 138
%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_8Auint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -118
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
char *d_s(char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char *dynstr;
  dynstr = d_s(dynstr);
  printf("[%s]\n", dynstr);
  free(dynstr);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
call   1050 <d_s@plt>
mov    %rax,%rbx
lea    0xec0(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"[%s]\0A\00"
define i32 @main() {
%1 = tail call i8* @d_s(i8* undef)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = tail call i32 @free(i8* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ isalnum(char);
int /*<<< orphan*/ isspace(char);
int check_string(char s) {
  if (s != '\0' && !isspace(s) && !isalnum(s))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<check_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x0,%eax
je     116b <check_string+0x4b>
movsbl -0x5(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%eax
jne    116b <check_string+0x4b>
movsbl -0x5(%rbp),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%eax
jne    116b <check_string+0x4b>
movl   $0x1,-0x4(%rbp)
jmp    1172 <check_string+0x52>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_string>:
push   %rbx
test   %dil,%dil
je     1140 <check_string+0x20>
movsbl %dil,%ebx
mov    %ebx,%edi
call   1040 <isspace@plt>
test   %eax,%eax
jne    1140 <check_string+0x20>
mov    %ebx,%edi
call   1030 <isalnum@plt>
test   %eax,%eax
je     1144 <check_string+0x24>
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @check_string(i8 signext %0) {
%2 = icmp eq i8 %0, 0
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = tail call i32 @isspace(i8 signext %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 @isalnum(i8 signext %0)
%8 = icmp eq i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %6, %3, %1
br label %10
10: ; preds = %6, %9
%11 = phi i32 [ 0, %9 ], [ 1, %6 ]
ret i32 %11
}
long LinkPad(long offset, long adjust, int preffix, int datalen) {
  if (datalen <= preffix || ((offset + adjust + preffix) % datalen) == 0)
    return (adjust);
  return (adjust + (datalen - ((offset + adjust + preffix) % datalen)));
}


x86 assembly (clang, -O0):
<LinkPad>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    1140 <LinkPad+0x40>
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
cqto
idiv   %rcx
cmp    $0x0,%rdx
jne    114d <LinkPad+0x4d>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    117f <LinkPad+0x7f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
movslq -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rdx
add    %rdx,%rax
movslq -0x20(%rbp),%rsi
cqto
idiv   %rsi
mov    -0x28(%rbp),%rax
sub    %rdx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<LinkPad>:
cmp    %edx,%ecx
jle    112f <LinkPad+0x2f>
add    %rsi,%rdi
movslq %edx,%rax
add    %rdi,%rax
movslq %ecx,%rdi
mov    %rax,%rdx
or     %rdi,%rdx
shr    $0x20,%rdx
je     1133 <LinkPad+0x33>
cqto
idiv   %rdi
test   %rdx,%rdx
je     112f <LinkPad+0x2f>
add    %rsi,%rdi
sub    %rdx,%rdi
mov    %rdi,%rsi
mov    %rsi,%rax
ret
xor    %edx,%edx
div    %ecx
test   %rdx,%rdx
jne    1126 <LinkPad+0x26>
jmp    112f <LinkPad+0x2f>

LLVM IR (-O0):
define i64 @LinkPad(i64 %0, i64 %1, i32 %2, i32 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
store i64 %0, i64* %6
store i64 %1, i64* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%10 = load i32, i32* %9
%11 = load i32, i32* %8
%12 = icmp sle i32 %10, %11
br i1 %12, label %24, label %13
13: ; preds = %4
%14 = load i64, i64* %6
%15 = load i64, i64* %7
%16 = add nsw i64 %14, %15
%17 = load i32, i32* %8
%18 = sext i32 %17 to i64
%19 = add nsw i64 %16, %18
%20 = load i32, i32* %9
%21 = sext i32 %20 to i64
%22 = srem i64 %19, %21
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %13, %4
%25 = load i64, i64* %7
store i64 %25, i64* %5
br label %41
26: ; preds = %13
%27 = load i64, i64* %7
%28 = load i32, i32* %9
%29 = sext i32 %28 to i64
%30 = load i64, i64* %6
%31 = load i64, i64* %7
%32 = add nsw i64 %30, %31
%33 = load i32, i32* %8
%34 = sext i32 %33 to i64
%35 = add nsw i64 %32, %34
%36 = load i32, i32* %9
%37 = sext i32 %36 to i64
%38 = srem i64 %35, %37
%39 = sub nsw i64 %29, %38
%40 = add nsw i64 %27, %39
store i64 %40, i64* %5
br label %41
41: ; preds = %26, %24
%42 = load i64, i64* %5
ret i64 %42
}

LLVM IR (-O2):
define i64 @LinkPad(i64 %0, i64 %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %3, %2
br i1 %5, label %6, label %16
6: ; preds = %4
%7 = add nsw i64 %1, %0
%8 = sext i32 %2 to i64
%9 = add nsw i64 %7, %8
%10 = sext i32 %3 to i64
%11 = srem i64 %9, %10
%12 = icmp eq i64 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %6
%14 = add i64 %10, %1
%15 = sub i64 %14, %11
br label %16
16: ; preds = %4, %6, %13
%17 = phi i64 [ %15, %13 ], [ %1, %6 ], [ %1, %4 ]
ret i64 %17
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ state;
};
typedef TYPE_1__ XVisibilityEvent;

/* Variables and functions */
int get_XVisibilityEvent_state(void *_p) {
  return (int)((XVisibilityEvent *)_p)->state;
}


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

x86 assembly (clang, -O2):
<get_XVisibilityEvent_state>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i32 @get_XVisibilityEvent_state(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @get_XVisibilityEvent_state(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Variables and functions */
int memcmp(void const *, void const *, int);
int compar(const void *_x, const void *_y) { return (memcmp(_x, _y, 80)); }


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

x86 assembly (clang, -O2):
<compar>:
mov    $0x50,%edx
jmp    1030 <memcmp@plt>

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

LLVM IR (-O2):
define i32 @compar(i8* %0, i8* %1) {
%3 = tail call i32 @memcmp(i8* %0, i8* %1, i32 80)
ret i32 %3
}
/* Variables and functions */
size_t strlen_(char *s) {
  char *t = s;
  while (*s) {
    s++;
  }
  return s - t;
}


x86 assembly (clang, -O0):
<strlen_>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     112e <strlen_+0x2e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <strlen_+0x10>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen_>:
mov    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen_+0x10>
ret

LLVM IR (-O0):
define i64 @strlen_(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %9, %1
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %2
br label %5
12: ; preds = %5
%13 = load i8*, i8** %2
%14 = load i8*, i8** %3
%15 = ptrtoint i8* %13 to i64
%16 = ptrtoint i8* %14 to i64
%17 = sub i64 %15, %16
ret i64 %17
}

LLVM IR (-O2):
define i64 @strlen_(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
ret i64 %10
}
stime(tp) long *tp;
{
  struct {
    long l1, l2;
  } x;
  x.l1 = *tp;
  x.l2 = 0;
  return settimeofday(&x, (char *)0);
}


x86 assembly (clang, -O0):
<stime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x0,%al
call   1030 <settimeofday@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stime>:
sub    $0x18,%rsp
mov    (%rdi),%rax
mov    %rax,0x8(%rsp)
movq   $0x0,0x10(%rsp)
lea    0x8(%rsp),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <settimeofday@plt>
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
%struct.anon = type { i64, i64 }
define i32 @stime(i64* nocapture %0) {
%2 = alloca %struct.anon
%3 = bitcast %struct.anon* %2 to i8*
%4 = load i64, i64* %0
%5 = getelementptr inbounds %struct.anon, %struct.anon* %2, i64 0, i32 0
store i64 %4, i64* %5
%6 = getelementptr inbounds %struct.anon, %struct.anon* %2, i64 0, i32 1
store i64 0, i64* %6
%7 = call i32 (%struct.anon*, i8*, ...) bitcast (i32 (...)* @settimeofday to i32 (%struct.anon*, i8*, ...)*)(%struct.anon* %2, i8* null)
ret i32 %7
}
/* Type definitions */
typedef int bool_t;
typedef int /*<<< orphan*/ XDR;

/* Variables and functions */
int /*<<< orphan*/ xdr_int(int /*<<< orphan*/ *, int *);
bool_t xdr_char(XDR *xdr, char *cp) {
  int i;
  i = (*cp);
  if (!xdr_int(xdr, &i))
    return 0;
  *cp = i;
  return 1;
}


x86 assembly (clang, -O0):
<xdr_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1030 <xdr_int@plt>
cmp    $0x0,%eax
jne    114c <xdr_char+0x3c>
movl   $0x0,-0x4(%rbp)
jmp    115e <xdr_char+0x4e>
mov    -0x1c(%rbp),%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_char>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
movsbl (%rsi),%eax
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rsi
call   1030 <xdr_int@plt>
test   %eax,%eax
je     113a <xdr_char+0x2a>
mov    0xc(%rsp),%al
mov    %al,(%rbx)
mov    $0x1,%eax
jmp    113c <xdr_char+0x2c>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @xdr_char(i32* %0, i8* nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
store i32 %6, i32* %3
%7 = call i32 @xdr_int(i32* %0, i32* %3)
%8 = icmp eq i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = load i32, i32* %3
%11 = trunc i32 %10 to i8
store i8 %11, i8* %1
br label %12
12: ; preds = %2, %9
%13 = phi i32 [ 1, %9 ], [ 0, %2 ]
ret i32 %13
}
/* Variables and functions */
int RAND_MAX;
int rand();
int GetRandom(int n) {
  int u = rand() * RAND_MAX + rand();
  return ((u % n) + n) % n;
}


x86 assembly (clang, -O0):
<GetRandom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    0x2ebf(%rip),%rcx
imul   (%rcx),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
add    -0x4(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetRandom>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,%ebp
mov    0x2ec3(%rip),%rax
imul   (%rax),%ebp
xor    %eax,%eax
call   1030 <rand@plt>
add    %ebp,%eax
cltd
idiv   %ebx
lea    (%rdx,%rbx,1),%eax
cltd
idiv   %ebx
mov    %edx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@RAND_MAX = global i32 0
define i32 @GetRandom(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 (...) @rand()
%5 = load i32, i32* @RAND_MAX
%6 = mul nsw i32 %4, %5
%7 = call i32 (...) @rand()
%8 = add nsw i32 %6, %7
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = srem i32 %9, %10
%12 = load i32, i32* %2
%13 = add nsw i32 %11, %12
%14 = load i32, i32* %2
%15 = srem i32 %13, %14
ret i32 %15
}

LLVM IR (-O2):
@RAND_MAX = global i32 0
define i32 @GetRandom(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = load i32, i32* @RAND_MAX
%4 = mul nsw i32 %3, %2
%5 = tail call i32 (...) @rand()
%6 = add nsw i32 %4, %5
%7 = srem i32 %6, %0
%8 = add nsw i32 %7, %0
%9 = srem i32 %8, %0
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ LCDStr(int /*<<< orphan*/, unsigned char *, int);
void panic(void) {
  char panic[] = "panic";
  LCDStr(0, (unsigned char *)panic, 1);
  while (1)
    ;
}


x86 assembly (clang, -O0):
<panic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xee2(%rip),%eax
mov    %eax,-0x6(%rbp)
mov    0xedc(%rip),%ax
mov    %ax,-0x2(%rbp)
lea    -0x6(%rbp),%rsi
xor    %edi,%edi
mov    $0x1,%edx
call   1030 <LCDStr@plt>
jmp    113c <panic+0x2c>

x86 assembly (clang, -O2):
<panic>:
push   %rax
movw   $0x63,0x4(%rsp)
movl   $0x696e6170,(%rsp)
mov    %rsp,%rsi
xor    %edi,%edi
mov    $0x1,%edx
call   1030 <LCDStr@plt>
xchg   %ax,%ax
jmp    1130 <panic+0x20>

LLVM IR (-O0):
@__const.panic.panic = [6 x i8] c"panic\00"
define void @panic() {
%1 = alloca [6 x i8]
%2 = bitcast [6 x i8]* %1 to i8*
%3 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%4 = call i32 @LCDStr(i32 0, i8* %3, i32 1)
br label %5
5: ; preds = %0, %5
br label %5
}

LLVM IR (-O2):
@__const.panic.panic = [6 x i8] c"panic\00"
define void @panic() {
%1 = alloca [6 x i8]
%2 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%3 = call i32 @LCDStr(i32 0, i8* %2, i32 1)
br label %4
4: ; preds = %4, %0
br label %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, double);
void print_temperatures(int celsius) {
  double fahrenheit = (9.0 / 5.0 * celsius) + 32.0;
  printf("%10d   %10.1f\n", celsius, fahrenheit);
}


x86 assembly (clang, -O0):
<print_temperatures>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xed8(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xed4(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%esi
movsd  -0x10(%rbp),%xmm0
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_temperatures>:
mov    %edi,%esi
cvtsi2sd %edi,%xmm0
mulsd  0xee2(%rip),%xmm0
addsd  0xee2(%rip),%xmm0
lea    0xee3(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"%10d %10.1f\0A\00"
define void @print_temperatures(i32 %0) {
%2 = alloca i32
%3 = alloca double
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sitofp i32 %4 to double
%6 = call double @llvm.fmuladd.f64(double 1.800000e+00, double %5, double 3.200000e+01)
store double %6, double* %3
%7 = load i32, i32* %2
%8 = load double, double* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %7, double %8)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%10d %10.1f\0A\00"
define void @print_temperatures(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = tail call double @llvm.fmuladd.f64(double %2, double 1.800000e+00, double 3.200000e+01)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %0, double %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print_arr(int *a, int n) {
  int i;
  for (i = 0; i < n; ++i) {
    printf("%d ", a[i]);
  }
}


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

x86 assembly (clang, -O2):
<print_arr>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1145 <print_arr+0x35>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <print_arr+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
define void @print_arr(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 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt 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 @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
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @print_arr(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
/* Type definitions */
struct iommu_domain {
  int dummy;
};
struct device {
  int dummy;
};

/* Variables and functions */
int ENODEV;
int iommu_attach_device(struct iommu_domain *domain, struct device *dev) {
  return -ENODEV;
}


x86 assembly (clang, -O0):
<iommu_attach_device>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    0x2ecb(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<iommu_attach_device>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
%struct.iommu_domain = type { i32 }
%struct.device = type { i32 }
@ENODEV = global i32 0
define i32 @iommu_attach_device(%struct.iommu_domain* %0, %struct.device* %1) {
%3 = alloca %struct.iommu_domain*
%4 = alloca %struct.device*
store %struct.iommu_domain* %0, %struct.iommu_domain** %3
store %struct.device* %1, %struct.device** %4
%5 = load i32, i32* @ENODEV
%6 = sub nsw i32 0, %5
ret i32 %6
}

LLVM IR (-O2):
%struct.iommu_domain = type { i32 }
%struct.device = type { i32 }
@ENODEV = global i32 0
define i32 @iommu_attach_device(%struct.iommu_domain* nocapture readnone %0, %struct.device* nocapture readnone %1) {
%3 = load i32, i32* @ENODEV
%4 = sub nsw i32 0, %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  printf("Hello, world!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%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
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [14 x i8] c"Hello, world!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;
typedef int n;

/* Variables and functions */
unsigned int xxdr_roundup(off_t n) {
  unsigned int rounded;
  rounded = (((n) + (4) - 1) & ~((4) - 1));
  return rounded;
}


x86 assembly (clang, -O0):
<xxdr_roundup>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x4,%eax
sub    $0x1,%eax
and    $0xfffffffc,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xxdr_roundup>:
lea    0x3(%rdi),%eax
and    $0xfffffffc,%eax
ret

LLVM IR (-O0):
define i32 @xxdr_roundup(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 4
%6 = sub nsw i32 %5, 1
%7 = and i32 %6, -4
store i32 %7, i32* %3
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
define i32 @xxdr_roundup(i32 %0) {
%2 = add nsw i32 %0, 3
%3 = and i32 %2, -4
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ putchar(int /*<<< orphan*/);
void put1(const char *string) {
  while (*string != '\0')
    putchar(*string++);
}


x86 assembly (clang, -O0):
<put1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1148 <put1+0x38>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <putchar@plt>
jmp    111c <put1+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put1>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <put1+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <put1+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @put1(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %8, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %2
%11 = load i8, i8* %9
%12 = sext i8 %11 to i32
%13 = call i32 @putchar(i32 %12)
br label %3
14: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @put1(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = sext i8 %5 to i32
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = tail call i32 @putchar(i32 %7)
%10 = load i8, i8* %8
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int close_imb();
int ipmi_close_ia(void) {
  int rc = 0;
  rc = close_imb();
  return (rc);
}


x86 assembly (clang, -O0):
<ipmi_close_ia>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <close_imb@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @ipmi_close_ia() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @close_imb()
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @ipmi_close_ia() {
%1 = tail call i32 (...) @close_imb()
ret i32 %1
}
void free(__attribute__((unused)) void *ptr) { return; }


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

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

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

LLVM IR (-O2):
define void @free(i8* nocapture %0) {
ret void
}
char *getenv(char *name) {}


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

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

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

LLVM IR (-O2):
define noalias i8* @getenv(i8* nocapture readnone %0) {
ret i8* undef
}
int FindZero(int *m) {
  int i;
  for (i = 0; i < 3; i++)
    if (m[i] == 0)
      return i;
  return -1;
}


x86 assembly (clang, -O0):
<FindZero>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    1149 <FindZero+0x49>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    1136 <FindZero+0x36>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1150 <FindZero+0x50>
jmp    113b <FindZero+0x3b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    110f <FindZero+0xf>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FindZero>:
cmpl   $0x0,(%rdi)
je     1116 <FindZero+0x16>
cmpl   $0x0,0x4(%rdi)
je     1119 <FindZero+0x19>
xor    %eax,%eax
cmp    0x8(%rdi),%eax
sbb    %eax,%eax
or     $0x2,%eax
ret
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @FindZero(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1
%5 = getelementptr inbounds i32, i32* %0, i64 1
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %4
%9 = getelementptr inbounds i32, i32* %0, i64 2
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i32 2, i32 -1
br label %13
13: ; preds = %8, %4, %1
%14 = phi i32 [ 0, %1 ], [ 1, %4 ], [ %12, %8 ]
ret i32 %14
}
int __attribute__((no)) bar(short *p) {
  unsigned int a = (unsigned short)*p;
  asm volatile("nop" : : "D"((unsigned int)*p));
  asm volatile("nop" : : "D"((unsigned int)*p));
  return 0;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%edi
nop
mov    -0x8(%rbp),%rax
movswl (%rax),%edi
nop
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
mov    %rdi,%rax
movswl (%rdi),%edi
nop
movswl (%rax),%edi
nop
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @bar(i16* %0) {
%2 = alloca i16*
%3 = alloca i32
store i16* %0, i16** %2
%4 = load i16*, i16** %2
%5 = load i16, i16* %4
%6 = zext i16 %5 to i32
store i32 %6, i32* %3
%7 = load i16*, i16** %2
%8 = load i16, i16* %7
%9 = sext i16 %8 to i32
%10 = load i16*, i16** %2
%11 = load i16, i16* %10
%12 = sext i16 %11 to i32
ret i32 0
}

LLVM IR (-O2):
define i32 @bar(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = sext i16 %2 to i32
tail call void asm sideeffect "nop", "{di},~{dirflag},~{fpsr},~{flags}"(i32 %3)
%4 = load i16, i16* %0
%5 = sext i16 %4 to i32
tail call void asm sideeffect "nop", "{di},~{dirflag},~{fpsr},~{flags}"(i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ write_port(int, int);
void enable_cursor(void) {
  write_port(0x3D4, 0x0A);
  write_port(0x3D5, 0x1F);
}


x86 assembly (clang, -O0):
<enable_cursor>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3d4,%edi
mov    $0xa,%esi
call   1030 <write_port@plt>
mov    $0x3d5,%edi
mov    $0x1f,%esi
call   1030 <write_port@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<enable_cursor>:
push   %rax
mov    $0x3d4,%edi
mov    $0xa,%esi
call   1030 <write_port@plt>
mov    $0x3d5,%edi
mov    $0x1f,%esi
pop    %rax
jmp    1030 <write_port@plt>

LLVM IR (-O0):
define void @enable_cursor() {
%1 = call i32 @write_port(i32 980, i32 10)
%2 = call i32 @write_port(i32 981, i32 31)
ret void
}

LLVM IR (-O2):
define void @enable_cursor() {
%1 = tail call i32 @write_port(i32 980, i32 10)
%2 = tail call i32 @write_port(i32 981, i32 31)
ret void
}
int main(void) { float a = {1.0}; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movss  0xef4(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca float
store float 1.000000e+00, float* %1
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
char *tokenParser(char *, char *, int /*<<< orphan*/, char *);
char *swallIDParser(char *header) {
  return tokenParser(header, " \t", 0, "swallIDParser");
}


x86 assembly (clang, -O0):
<swallIDParser>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
xor    %edx,%edx
lea    0xed3(%rip),%rcx
call   1030 <tokenParser@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swallIDParser>:
lea    0xee9(%rip),%rsi
lea    0xee5(%rip),%rcx
xor    %edx,%edx
jmp    1030 <tokenParser@plt>

LLVM IR (-O0):
@.str = [3 x i8] c" \09\00"
@.str.1 = [14 x i8] c"swallIDParser\00"
define i8* @swallIDParser(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @tokenParser(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
ret i8* %4
}

LLVM IR (-O2):
@.str = [3 x i8] c" \09\00"
@.str.1 = [14 x i8] c"swallIDParser\00"
define i8* @swallIDParser(i8* %0) {
%2 = tail call i8* @tokenParser(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ fenv_t;

/* Variables and functions */
int fesetenv(int /*<<< orphan*/ const *);
int feupdateenv(const fenv_t *envp) { return fesetenv(envp); }


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

x86 assembly (clang, -O2):
<feupdateenv>:
jmp    1030 <fesetenv@plt>

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

LLVM IR (-O2):
define i32 @feupdateenv(i32* %0) {
%2 = tail call i32 @fesetenv(i32* %0)
ret i32 %2
}
void w12(void *x, double y) { *(double *)(x + 32756) = y; }


x86 assembly (clang, -O0):
<w12>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x7ff4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<w12>:
movsd  %xmm0,0x7ff4(%rdi)
ret

LLVM IR (-O0):
define void @w12(i8* %0, double %1) {
%3 = alloca i8*
%4 = alloca double
store i8* %0, i8** %3
store double %1, double* %4
%5 = load double, double* %4
%6 = load i8*, i8** %3
%7 = getelementptr i8, i8* %6, i64 32756
%8 = bitcast i8* %7 to double*
store double %5, double* %8
ret void
}

LLVM IR (-O2):
define void @w12(i8* nocapture writeonly %0, double %1) {
%3 = getelementptr i8, i8* %0, i64 32756
%4 = bitcast i8* %3 to double*
store double %1, double* %4
ret void
}
char readUARTChar() {
  int i;
  char out;
  i = (*(volatile int *)(((0x7f000000) | 0x9000000000000000)));
  while ((i & 0x00800000) == 0) {
    i = (*(volatile int *)(((0x7f000000) | 0x9000000000000000)));
  }
  i = i >> 24;
  out = (char)i;
  return out;
}


x86 assembly (clang, -O0):
<readUARTChar>:
push   %rbp
mov    %rsp,%rbp
movabs $0x900000007f000000,%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x800000,%eax
cmp    $0x0,%eax
jne    1138 <readUARTChar+0x38>
movabs $0x900000007f000000,%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1113 <readUARTChar+0x13>
mov    -0x4(%rbp),%eax
sar    $0x18,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<readUARTChar>:
movabs $0x900000007f000000,%rcx
nopw   0x0(%rax,%rax,1)
mov    (%rcx),%eax
test   $0x800000,%eax
je     1110 <readUARTChar+0x10>
shr    $0x18,%eax
ret

LLVM IR (-O0):
define signext i8 @readUARTChar() {
%1 = alloca i32
%2 = alloca i8
%3 = load volatile i32, i32* inttoptr (i64 -8070450530117222400 to i32*)
store i32 %3, i32* %1
br label %4
4: ; preds = %8, %0
%5 = load i32, i32* %1
%6 = and i32 %5, 8388608
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = load volatile i32, i32* inttoptr (i64 -8070450530117222400 to i32*)
store i32 %9, i32* %1
br label %4
10: ; preds = %4
%11 = load i32, i32* %1
%12 = ashr i32 %11, 24
store i32 %12, i32* %1
%13 = load i32, i32* %1
%14 = trunc i32 %13 to i8
store i8 %14, i8* %2
%15 = load i8, i8* %2
ret i8 %15
}

LLVM IR (-O2):
define signext i8 @readUARTChar() {
br label %1
1: ; preds = %1, %0
%2 = load volatile i32, i32* inttoptr (i64 -8070450530117222400 to i32*)
%3 = and i32 %2, 8388608
%4 = icmp eq i32 %3, 0
br i1 %4, label %1, label %5
5: ; preds = %1
%6 = lshr i32 %2, 24
%7 = trunc i32 %6 to i8
ret i8 %7
}
/* Variables and functions */
double sqrt(int);
double getDistancia(int d) { return sqrt(d * d + 12 * 12); }


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

x86 assembly (clang, -O2):
<getDistancia>:
imul   %edi,%edi
add    $0x90,%edi
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define double @getDistancia(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = mul nsw i32 %3, %4
%6 = add nsw i32 %5, 144
%7 = call double @sqrt(i32 %6)
ret double %7
}

LLVM IR (-O2):
define double @getDistancia(i32 %0) {
%2 = mul nsw i32 %0, %0
%3 = add nuw nsw i32 %2, 144
%4 = tail call double @sqrt(i32 %3)
ret double %4
}
int extra_characters(cp)
char *cp;
{
  if (cp) {
    cp = skip_space(cp);
    if (*cp) {
      { printf("%s\n", "Extra characters encountered."); };
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<extra_characters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     117b <extra_characters+0x5b>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <skip_space@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1176 <extra_characters+0x56>
lea    0xea4(%rip),%rdi
lea    0xea1(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1182 <extra_characters+0x62>
jmp    117b <extra_characters+0x5b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extra_characters>:
push   %rbx
xor    %ebx,%ebx
test   %rdi,%rdi
je     1147 <extra_characters+0x27>
xor    %eax,%eax
call   1040 <skip_space@plt>
cltq
cmpb   $0x0,(%rax)
je     1147 <extra_characters+0x27>
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [30 x i8] c"Extra characters encountered.\00"
define i32 @extra_characters(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %17
6: ; preds = %1
%7 = load i8*, i8** %3
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @skip_space to i32 (i8*, ...)*)(i8* %7)
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = icmp ne i8 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %6
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %2
br label %18
16: ; preds = %6
br label %17
17: ; preds = %16, %1
store i32 0, i32* %2
br label %18
18: ; preds = %17, %14
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@.str.1 = [30 x i8] c"Extra characters encountered.\00"
define i32 @extra_characters(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @skip_space to i32 (i8*, ...)*)(i8* %0)
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %3
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %1, %3, %9
%12 = phi i32 [ 1, %9 ], [ 0, %3 ], [ 0, %1 ]
ret i32 %12
}
void foo505() {}


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

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

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

LLVM IR (-O2):
define void @foo505() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ FromLE16(int /*<<< orphan*/ const);
uint16_t ReadUnalignedLE16(const uint16_t *p) { return FromLE16(*p); }


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

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

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

LLVM IR (-O2):
define i32 @ReadUnalignedLE16(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @FromLE16(i32 %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ select_function(int, int *);
int /*<<< orphan*/ selection_menu();
int main(void) {
  int flag = 1, choice;
  selection_menu();
  while (flag) {
    printf("please input you selction:");
    scanf("%d", &choice);
    select_function(choice, &flag);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    $0x0,%al
call   1050 <selection_menu@plt>
cmpl   $0x0,-0x8(%rbp)
je     1194 <main+0x54>
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
lea    0xea1(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0xc(%rbp),%edi
lea    -0x8(%rbp),%rsi
call   1040 <select_function@plt>
jmp    115d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movl   $0x1,(%rsp)
xor    %eax,%eax
call   1050 <selection_menu@plt>
lea    0xea3(%rip),%r14
lea    0xeb7(%rip),%r15
lea    0x4(%rsp),%r12
mov    %rsp,%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
mov    %rbx,%rsi
call   1040 <select_function@plt>
cmpl   $0x0,(%rsp)
jne    1170 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [27 x i8] c"please input you selction:\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
%4 = call i32 (...) @selection_menu()
br label %5
5: ; preds = %8, %0
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%11 = load i32, i32* %3
%12 = call i32 @select_function(i32 %11, i32* %2)
br label %5
13: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"please input you selction:\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (...) @selection_menu()
br label %6
6: ; preds = %0, %6
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = call i32 @select_function(i32 %9, i32* %1)
%11 = load i32, i32* %1
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %6
13: ; preds = %6
ret i32 0
}
unsigned int __sw_hweight32(unsigned int w) {
  unsigned int res = w - ((w >> 1) & 0x55555555);
  res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
  res = (res + (res >> 4)) & 0x0F0F0F0F;
  res = res + (res >> 8);
  return (res + (res >> 16)) & 0x000000FF;
}


x86 assembly (clang, -O0):
<__sw_hweight32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
shr    $0x1,%ecx
and    $0x55555555,%ecx
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x33333333,%eax
mov    -0x8(%rbp),%ecx
shr    $0x2,%ecx
and    $0x33333333,%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    $0x4,%ecx
add    %ecx,%eax
and    $0xf0f0f0f,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    $0x8,%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    $0x10,%ecx
add    %ecx,%eax
and    $0xff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__sw_hweight32>:
mov    %edi,%eax
shr    %eax
and    $0x55555555,%eax
sub    %eax,%edi
mov    %edi,%eax
and    $0x33333333,%eax
shr    $0x2,%edi
and    $0x33333333,%edi
add    %eax,%edi
mov    %edi,%eax
shr    $0x4,%eax
add    %edi,%eax
and    $0xf0f0f0f,%eax
mov    %eax,%ecx
shr    $0x8,%ecx
add    %eax,%ecx
mov    %ecx,%eax
shr    $0x10,%eax
add    %ecx,%eax
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @__sw_hweight32(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* %2
%6 = lshr i32 %5, 1
%7 = and i32 %6, 1431655765
%8 = sub i32 %4, %7
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = and i32 %9, 858993459
%11 = load i32, i32* %3
%12 = lshr i32 %11, 2
%13 = and i32 %12, 858993459
%14 = add i32 %10, %13
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = load i32, i32* %3
%17 = lshr i32 %16, 4
%18 = add i32 %15, %17
%19 = and i32 %18, 252645135
store i32 %19, i32* %3
%20 = load i32, i32* %3
%21 = load i32, i32* %3
%22 = lshr i32 %21, 8
%23 = add i32 %20, %22
store i32 %23, i32* %3
%24 = load i32, i32* %3
%25 = load i32, i32* %3
%26 = lshr i32 %25, 16
%27 = add i32 %24, %26
%28 = and i32 %27, 255
ret i32 %28
}

LLVM IR (-O2):
define i32 @__sw_hweight32(i32 %0) {
%2 = lshr i32 %0, 1
%3 = and i32 %2, 1431655765
%4 = sub i32 %0, %3
%5 = and i32 %4, 858993459
%6 = lshr i32 %4, 2
%7 = and i32 %6, 858993459
%8 = add nuw nsw i32 %7, %5
%9 = lshr i32 %8, 4
%10 = add nuw nsw i32 %9, %8
%11 = and i32 %10, 252645135
%12 = lshr i32 %11, 8
%13 = add nuw nsw i32 %12, %11
%14 = lshr i32 %13, 16
%15 = add nuw nsw i32 %14, %13
%16 = and i32 %15, 63
ret i32 %16
}