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


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

x86 assembly (clang, -O2):
<test_imm_63uint8_mem>:
testb  $0x63,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_63uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 99
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int test_imm_43uint16_reg(unsigned short val) {
  return ((val) & (-0x43 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_43uint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffffbd,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_43uint16_reg>:
test   $0xffbd,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_43uint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, -67
%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_43uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -67
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int EINVAL;
int pthread_setcancelstate(int state, int *oldstate) {
  (void)state;
  (void)oldstate;
  return EINVAL;
}


x86 assembly (clang, -O0):
<pthread_setcancelstate>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ece(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_setcancelstate>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @pthread_setcancelstate(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 = load i32, i32* @EINVAL
ret i32 %7
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @pthread_setcancelstate(i32 %0, i32* nocapture readnone %1) {
%3 = load i32, i32* @EINVAL
ret i32 %3
}
AR0RX1(r0, r1, x0, x1, p0, p1) unsigned char r0, r1;
unsigned char *p0, *p1;
{
  if ((p0[10000000]) <= (p1[x1]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<AR0RX1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %dil,%sil
mov    %sil,-0x5(%rbp)
mov    %al,-0x6(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movzbl 0x989680(%rax),%eax
mov    -0x20(%rbp),%rcx
movslq -0x10(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jg     1149 <AR0RX1+0x49>
movl   $0x1,-0x4(%rbp)
jmp    1150 <AR0RX1+0x50>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<AR0RX1>:
mov    0x989680(%r8),%dl
movslq %ecx,%rcx
xor    %eax,%eax
cmp    (%r9,%rcx,1),%dl
setbe  %al
ret

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

LLVM IR (-O2):
define i32 @AR0RX1(i32 %0, i32 %1, i32 %2, i32 %3, i8* nocapture %4, i8* nocapture %5) {
%7 = getelementptr inbounds i8, i8* %4, i64 10000000
%8 = load i8, i8* %7
%9 = sext i32 %3 to i64
%10 = getelementptr inbounds i8, i8* %5, i64 %9
%11 = load i8, i8* %10
%12 = icmp ule i8 %8, %11
%13 = zext i1 %12 to i32
ret i32 %13
}
/* Variables and functions */
char *llvm_gc_allocate(size_t);
int /*<<< orphan*/ strcpy(char *, char *);
size_t strlen(char *);
char *__tiger__concat(char *s1, char *s2) {
  char *s = llvm_gc_allocate(strlen(s1) + strlen(s2) + 1);
  strcpy(s, s1);
  strcpy(&s[strlen(s1)], s2);
  return s;
}


x86 assembly (clang, -O0):
<__tiger__concat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rdi
add    %rax,%rdi
add    $0x1,%rdi
call   1050 <llvm_gc_allocate@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__tiger__concat>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
call   1040 <strlen@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    (%r15,%rax,1),%rdi
add    $0x1,%rdi
call   1050 <llvm_gc_allocate@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    %r12,%rdi
call   1040 <strlen@plt>
lea    (%rax,%rbx,1),%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @__tiger__concat(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
%8 = load i8*, i8** %4
%9 = call i64 @strlen(i8* %8)
%10 = add i64 %7, %9
%11 = add i64 %10, 1
%12 = call i8* @llvm_gc_allocate(i64 %11)
store i8* %12, i8** %5
%13 = load i8*, i8** %5
%14 = load i8*, i8** %3
%15 = call i32 @strcpy(i8* %13, i8* %14)
%16 = load i8*, i8** %5
%17 = load i8*, i8** %3
%18 = call i64 @strlen(i8* %17)
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8*, i8** %4
%21 = call i32 @strcpy(i8* %19, i8* %20)
%22 = load i8*, i8** %5
ret i8* %22
}

LLVM IR (-O2):
define i8* @__tiger__concat(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = add i64 %3, 1
%6 = add i64 %5, %4
%7 = tail call i8* @llvm_gc_allocate(i64 %6)
%8 = tail call i32 @strcpy(i8* %7, i8* %0)
%9 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%10 = getelementptr inbounds i8, i8* %7, i64 %9
%11 = tail call i32 @strcpy(i8* %10, i8* %1)
ret i8* %7
}
/* Variables and functions */
unsigned long I2CIntNumberGet(unsigned long);
int /*<<< orphan*/ IntDisable(unsigned long);
int /*<<< orphan*/ IntUnregister(unsigned long);
void I2CIntUnregister(unsigned long ulBase) {
  unsigned long ulInt;
  ;
  ulInt = I2CIntNumberGet(ulBase);
  IntDisable(ulInt);
  IntUnregister(ulInt);
}


x86 assembly (clang, -O0):
<I2CIntUnregister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <I2CIntNumberGet@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <IntDisable@plt>
mov    -0x10(%rbp),%rdi
call   1050 <IntUnregister@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2CIntUnregister>:
push   %rbx
call   1030 <I2CIntNumberGet@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <IntDisable@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <IntUnregister@plt>

LLVM IR (-O0):
define void @I2CIntUnregister(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i64 @I2CIntNumberGet(i64 %4)
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = call i32 @IntDisable(i64 %6)
%8 = load i64, i64* %3
%9 = call i32 @IntUnregister(i64 %8)
ret void
}

LLVM IR (-O2):
define void @I2CIntUnregister(i64 %0) {
%2 = tail call i64 @I2CIntNumberGet(i64 %0)
%3 = tail call i32 @IntDisable(i64 %2)
%4 = tail call i32 @IntUnregister(i64 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void *malloc(size_t);
void *xmalloc(size_t size) {
  void *m = malloc(size);
  if (m == NULL)
    abort();
  return m;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114b <xmalloc+0x2b>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rax
call   1040 <malloc@plt>
test   %rax,%rax
je     112d <xmalloc+0xd>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (...) @abort()
unreachable
10: ; preds = %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @abort()
unreachable
6: ; preds = %1
ret i8* %2
}
void ufshpb_remove(struct ufs_hba *hba) {}


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

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

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

LLVM IR (-O2):
%struct.ufs_hba = type opaque
define void @ufshpb_remove(%struct.ufs_hba* nocapture %0) {
ret void
}
void CG_IronSightUp_f(void) {}


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

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

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

LLVM IR (-O2):
define void @CG_IronSightUp_f() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char const *);
int /*<<< orphan*/ puts(char *);
void print_usage(const char *prog) {
  puts("\ngps-serial - read GPS data from a serial port\n");
  printf("Usage: %s [-h]\n", prog);
  puts("  -h --help\t print this help message");
  exit(1);
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rdi
call   1030 <puts@plt>
mov    -0x8(%rbp),%rsi
lea    0xedd(%rip),%rdi
call   1040 <printf@plt>
lea    0xee1(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<print_usage>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
lea    0xee9(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
lea    0xeea(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [48 x i8] c"\0Agps-serial - read GPS data from a serial port\0A\00"
@.str.1 = [16 x i8] c"Usage: %s [-h]\0A\00"
@.str.2 = [37 x i8] c" -h --help\09 print this help message\00"
define void @print_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @puts(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [48 x i8] c"\0Agps-serial - read GPS data from a serial port\0A\00"
@.str.1 = [16 x i8] c"Usage: %s [-h]\0A\00"
@.str.2 = [37 x i8] c" -h --help\09 print this help message\00"
define void @print_usage(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ StubBug(char *);
void closelog(void) {
  StubBug("STUB:"
          "closelog");
}


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"STUB:closelog\00"
define void @closelog() {
%1 = call i32 @StubBug(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"STUB:closelog\00"
define void @closelog() {
%1 = tail call i32 @StubBug(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ _exit(int /*<<< orphan*/);
int /*<<< orphan*/ daemon_error_exit(char *);
int fork();
void do_fork() {
  switch (fork()) {
  case -1:
    daemon_error_exit("Can't fork: %m\n");
  case 0:
    break;
  default:
    _exit(EXIT_SUCCESS);
  }
}


x86 assembly (clang, -O0):
<do_fork>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
call   1050 <fork@plt>
mov    %eax,%ecx
mov    %ecx,-0x4(%rbp)
sub    $0xffffffff,%eax
je     1162 <do_fork+0x32>
jmp    1152 <do_fork+0x22>
mov    -0x4(%rbp),%eax
test   %eax,%eax
je     116e <do_fork+0x3e>
jmp    1173 <do_fork+0x43>
lea    0xe97(%rip),%rdi
call   1040 <daemon_error_exit@plt>
jmp    1181 <do_fork+0x51>
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
call   1030 <_exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_fork>:
push   %rax
xor    %eax,%eax
call   1050 <fork@plt>
test   %eax,%eax
je     114e <do_fork+0x1e>
cmp    $0xffffffff,%eax
jne    1150 <do_fork+0x20>
lea    0xeb8(%rip),%rdi
pop    %rax
jmp    1040 <daemon_error_exit@plt>
pop    %rax
ret
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"Can't fork: %m\0A\00"
@EXIT_SUCCESS = global i32 0
define void @do_fork() {
%1 = call i32 (...) @fork()
switch i32 %1, label %5 [
i32 -1, label %2
i32 0, label %4
]
2: ; preds = %0
%3 = call i32 @daemon_error_exit(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %0, %2
br label %8
5: ; preds = %0
%6 = load i32, i32* @EXIT_SUCCESS
%7 = call i32 @_exit(i32 %6)
unreachable
8: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"Can't fork: %m\0A\00"
@EXIT_SUCCESS = global i32 0
define void @do_fork() {
%1 = tail call i32 (...) @fork()
switch i32 %1, label %4 [
i32 -1, label %2
i32 0, label %7
]
2: ; preds = %0
%3 = tail call i32 @daemon_error_exit(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %7
4: ; preds = %0
%5 = load i32, i32* @EXIT_SUCCESS
%6 = tail call i32 @_exit(i32 %5)
unreachable
7: ; preds = %2, %0
ret void
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
uint32_t TRNGStatusGet(void) {
  return ((*((volatile unsigned long *)(0x40028000 + 0x00000008))));
}


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

x86 assembly (clang, -O2):
<TRNGStatusGet>:
mov    0x40028008,%rax
40
ret

LLVM IR (-O0):
define i64 @TRNGStatusGet() {
%1 = load volatile i64, i64* inttoptr (i64 1073905672 to i64*)
ret i64 %1
}

LLVM IR (-O2):
define i64 @TRNGStatusGet() {
%1 = load volatile i64, i64* inttoptr (i64 1073905672 to i64*)
ret i64 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
time_t lprofC_get_current() { return time(NULL); }


x86 assembly (clang, -O0):
<lprofC_get_current>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<lprofC_get_current>:
xor    %edi,%edi
jmp    1030 <time@plt>

LLVM IR (-O0):
define i32 @lprofC_get_current() {
%1 = call i32 @time(i32* null)
ret i32 %1
}

LLVM IR (-O2):
define i32 @lprofC_get_current() {
%1 = tail call i32 @time(i32* null)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ f(int);
int /*<<< orphan*/ printf(char *);
int main() {
  1 + 2;
  f(3);
  if (4 * 5 == 6) {
    printf("abcd");
  }
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 3)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ volatile uint32_t;

/* Variables and functions */
void FlashIntEnable(uint32_t ui32IntFlags) {
  (*((volatile uint32_t *)(0x400FD010))) |= ui32IntFlags;
}


x86 assembly (clang, -O0):
<FlashIntEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x400fd010,%ecx
mov    (%rcx),%ecx
or     %eax,%ecx
mov    $0x400fd010,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<FlashIntEnable>:
mov    %edi,-0x4(%rsp)
mov    -0x4(%rsp),%eax
or     %eax,0x400fd010
ret

LLVM IR (-O0):
define void @FlashIntEnable(i32 %0) {
%2 = alloca i32
store volatile i32 %0, i32* %2
%3 = load volatile i32, i32* %2
%4 = load volatile i32, i32* inttoptr (i64 1074778128 to i32*)
%5 = or i32 %4, %3
store volatile i32 %5, i32* inttoptr (i64 1074778128 to i32*)
ret void
}

LLVM IR (-O2):
define void @FlashIntEnable(i32 %0) {
%2 = alloca i32
store volatile i32 %0, i32* %2
%3 = load volatile i32, i32* %2
%4 = load volatile i32, i32* inttoptr (i64 1074778128 to i32*)
%5 = or i32 %4, %3
store volatile i32 %5, i32* inttoptr (i64 1074778128 to i32*)
ret void
}
void foo157(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo157(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double, double);
double sin(double);
int main() {
  double x, ret, val;
  x = 45.0;
  val = 3.14159265 / 180;
  ret = sin(x * val);
  printf("The sine of %lf is %lf degrees\n", x, ret);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xebc(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef8(%rip),%rdi
movsd  0xee0(%rip),%xmm0
movsd  0xee0(%rip),%xmm1
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"The sine of %lf is %lf degrees\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
store i32 0, i32* %1
store double 4.500000e+01, double* %2
store double 0x3F91DF46A1FAE712, double* %4
%5 = load double, double* %2
%6 = load double, double* %4
%7 = fmul double %5, %6
%8 = call double @sin(double %7)
store double %8, double* %3
%9 = load double, double* %2
%10 = load double, double* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), double %9, double %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"The sine of %lf is %lf degrees\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), double 4.500000e+01, double 0x3FE6A09E66280416)
ret i32 0
}
/* Variables and functions */
int htmly_detect_tag(char *, char *);
int htmly_detect_summary(char *line) { return htmly_detect_tag(line, "d"); }


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

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

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

LLVM IR (-O2):
@.str = [2 x i8] c"d\00"
define i32 @htmly_detect_summary(i8* %0) {
%2 = tail call i32 @htmly_detect_tag(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ranged_random_mult(int /*<<< orphan*/);
void loop_mult(size_t count, uint32_t range, uint32_t *output) {
  for (size_t i = 0; i < count; i++) {
    *output++ = ranged_random_mult(range);
  }
}


x86 assembly (clang, -O0):
<loop_mult>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    1165 <loop_mult+0x55>
mov    -0xc(%rbp),%edi
call   1030 <ranged_random_mult@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x18(%rbp)
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    112b <loop_mult+0x1b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loop_mult>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     1145 <loop_mult+0x35>
mov    %rdx,%r14
mov    %esi,%r15d
mov    %rdi,%rbx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    %r15d,%edi
call   1030 <ranged_random_mult@plt>
mov    %eax,(%r14,%rbp,4)
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1130 <loop_mult+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @loop_mult(i64 %0, i32 %1, i32* nocapture writeonly %2) {
%4 = icmp eq i64 %0, 0
br i1 %4, label %5, label %6
5: ; preds = %6, %3
ret void
6: ; preds = %3, %6
%7 = phi i64 [ %11, %6 ], [ 0, %3 ]
%8 = phi i32* [ %10, %6 ], [ %2, %3 ]
%9 = tail call i32 @ranged_random_mult(i32 %1)
%10 = getelementptr inbounds i32, i32* %8, i64 1
store i32 %9, i32* %8
%11 = add nuw i64 %7, 1
%12 = icmp eq i64 %11, %0
br i1 %12, label %5, label %6
}
/* Variables and functions */
int /*<<< orphan*/ my_strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void my_puterror(char *err) { write(2, err, my_strlen(err)); }


x86 assembly (clang, -O0):
<my_puterror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <my_strlen@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
mov    $0x2,%edi
call   1040 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_puterror>:
push   %rbx
mov    %rdi,%rbx
call   1030 <my_strlen@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
mov    %eax,%edx
pop    %rbx
jmp    1040 <write@plt>

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

LLVM IR (-O2):
define void @my_puterror(i8* %0) {
%2 = tail call i32 @my_strlen(i8* %0)
%3 = tail call i32 @write(i32 2, i8* %0, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stdout;
void btor_msg_aig(char *msg) {
  assert(msg != NULL);
  fprintf(stdout, "[btoraig] %s", msg);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<btor_msg_aig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe9e(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<btor_msg_aig>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
mov    0x2e94(%rip),%r14
mov    (%r14),%edi
lea    0xeaa(%rip),%rsi
mov    %rbx,%rdx
call   1040 <fprintf@plt>
mov    (%r14),%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <fflush@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [13 x i8] c"[btoraig] %s\00"
define void @btor_msg_aig(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = load i32, i32* @stdout
%8 = load i8*, i8** %2
%9 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i32, i32* @stdout
%11 = call i32 @fflush(i32 %10)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [13 x i8] c"[btoraig] %s\00"
define void @btor_msg_aig(i8* %0) {
%2 = icmp ne i8* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = load i32, i32* @stdout
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0)
%7 = load i32, i32* @stdout
%8 = tail call i32 @fflush(i32 %7)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void test_newlib() {
  FILE *fp = fopen("console1", "r");
  fprintf(fp, "hehe\r\n");
}


x86 assembly (clang, -O0):
<test_newlib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    0xed3(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec1(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_newlib>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xeda(%rip),%rsi
call   1030 <fopen@plt>
lea    0xed0(%rip),%rdi
mov    $0x6,%esi
mov    $0x1,%edx
mov    %rax,%rcx
pop    %rax
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"console1\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"hehe\0D\0A\00"
define void @test_newlib() {
%1 = alloca i32*
%2 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"console1\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"hehe\0D\0A\00"
define void @test_newlib() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i64 6, i64 1, i32* %1)
ret void
}
double step(double number, double step_d) {
  int i = 0;
  for (i = 1; i < step_d; i++) {
    number *= number;
  };
  return number;
}


x86 assembly (clang, -O0):
<step>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x14(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    114d <step+0x4d>
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    111c <step+0x1c>
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<step>:
ucomisd 0xef8(%rip),%xmm1
jbe    1124 <step+0x24>
mov    $0x2,%eax
nop
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
mulsd  %xmm0,%xmm0
add    $0x1,%eax
ucomisd %xmm2,%xmm1
ja     1110 <step+0x10>
ret

LLVM IR (-O0):
define double @step(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i32
store double %0, double* %3
store double %1, double* %4
store i32 0, i32* %5
store i32 1, i32* %5
br label %6
6: ; preds = %15, %2
%7 = load i32, i32* %5
%8 = sitofp i32 %7 to double
%9 = load double, double* %4
%10 = fcmp olt double %8, %9
br i1 %10, label %11, label %18
11: ; preds = %6
%12 = load double, double* %3
%13 = load double, double* %3
%14 = fmul double %13, %12
store double %14, double* %3
br label %15
15: ; preds = %11
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 1
store i32 %17, i32* %5
br label %6
18: ; preds = %6
%19 = load double, double* %3
ret double %19
}

LLVM IR (-O2):
define double @step(double %0, double %1) {
%3 = fcmp ogt double %1, 1.000000e+00
br i1 %3, label %4, label %11
4: ; preds = %2, %4
%5 = phi i32 [ %8, %4 ], [ 1, %2 ]
%6 = phi double [ %7, %4 ], [ %0, %2 ]
%7 = fmul double %6, %6
%8 = add nuw nsw i32 %5, 1
%9 = sitofp i32 %8 to double
%10 = fcmp olt double %9, %1
br i1 %10, label %4, label %11
11: ; preds = %4, %2
%12 = phi double [ %0, %2 ], [ %7, %4 ]
ret double %12
}
int test_imm_C5int32_mem(int *val) {
  return ((*val) & (0xC5 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_C5int32_mem>:
testb  $0xc5,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_C5int32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 197
%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_C5int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 197
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ u_int8_t;
typedef int /*<<< orphan*/ u_int16_t;

/* Variables and functions */
int isakmp_validate_attribute(u_int16_t type, u_int8_t *value, u_int16_t len,
                              void *vmsg) {
  return -1;
}


x86 assembly (clang, -O0):
<isakmp_validate_attribute>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @isakmp_validate_attribute(i32 %0, i32* %1, i32 %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i8*
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
ret i32 -1
}

LLVM IR (-O2):
define i32 @isakmp_validate_attribute(i32 %0, i32* nocapture readnone %1, i32 %2, i8* nocapture readnone %3) {
ret i32 -1
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ time;
};
struct TYPE_4__ {
  TYPE_1__ xbutton;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
unsigned long get_XEvent_xbutton_time(void *_p) {
  return (unsigned long)((XEvent *)_p)->xbutton.time;
}


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

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

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

LLVM IR (-O2):
define i64 @get_XEvent_xbutton_time(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ execve(char *, char **, int /*<<< orphan*/ *);
int main() {
  char *cmd[] = {"/bin/sh", (char *)0};
  execve("/bin/sh", cmd, NULL);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2cea(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2ce7(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xec0(%rip),%rdi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <execve@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movaps 0x2cf5(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xeda(%rip),%rdi
mov    %rsp,%rsi
xor    %edx,%edx
call   1030 <execve@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"/bin/sh\00"
@__const.main.cmd = [2 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* null]
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i8*]
store i32 0, i32* %1
%3 = bitcast [2 x i8*]* %2 to i8*
%4 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 0
%5 = call i32 @execve(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %4, i32* null)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"/bin/sh\00"
@__const.main.cmd = [2 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* null]
define i32 @main() {
%1 = alloca [2 x i8*]
%2 = bitcast [2 x i8*]* %1 to i8*
%3 = getelementptr inbounds [2 x i8*], [2 x i8*]* %1, i64 0, i64 0
%4 = call i32 @execve(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %3, i32* null)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;

/* Variables and functions */
int __setxid(int, int, int /*<<< orphan*/, int);
int seteuid(uid_t euid) { return __setxid(164, -1, euid, -1); }


x86 assembly (clang, -O0):
<seteuid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0xa4,%edi
mov    $0xffffffff,%ecx
mov    %ecx,%esi
call   1030 <__setxid@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seteuid>:
mov    %edi,%edx
mov    $0xa4,%edi
mov    $0xffffffff,%esi
mov    $0xffffffff,%ecx
jmp    1030 <__setxid@plt>

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

LLVM IR (-O2):
define i32 @seteuid(i32 %0) {
%2 = tail call i32 @__setxid(i32 164, i32 -1, i32 %0, i32 -1)
ret i32 %2
}
int f1(float x, float y) { return x == y; }


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
cmpeqss %xmm1,%xmm0
movd   %xmm0,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @f1(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fcmp oeq float %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @f1(float %0, float %1) {
%3 = fcmp oeq float %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
char *strleft(char *val, int cnt) {
  val[cnt] = '\0';
  return val;
}


x86 assembly (clang, -O0):
<strleft>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strleft>:
mov    %rdi,%rax
movslq %esi,%rcx
movb   $0x0,(%rdi,%rcx,1)
ret

LLVM IR (-O0):
define i8* @strleft(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
store i8 0, i8* %8
%9 = load i8*, i8** %3
ret i8* %9
}

LLVM IR (-O2):
define i8* @strleft(i8* returned writeonly %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
store i8 0, i8* %4
ret i8* %0
}
int test_imm_37uint8_reg(unsigned char val) {
  return ((val) & (-0x37 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_37uint8_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, -55
%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_37uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -55
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ mse(double *, double *, int, double, double);
double sqrt(int /*<<< orphan*/);
double var(double *x, double *y, int n, double slope, double intcp) {
  return sqrt(mse(x, y, n, slope, intcp));
}


x86 assembly (clang, -O0):
<var>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1040 <mse@plt>
mov    %eax,%edi
call   1030 <sqrt@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<var>:
push   %rax
call   1040 <mse@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <sqrt@plt>

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

LLVM IR (-O2):
define double @var(double* %0, double* %1, i32 %2, double %3, double %4) {
%6 = tail call i32 @mse(double* %0, double* %1, i32 %2, double %3, double %4)
%7 = tail call double @sqrt(i32 %6)
ret double %7
}
/* Variables and functions */
char getchar();
void SkipLine(char c) {
  while (c != '\n')
    c = getchar();
}


x86 assembly (clang, -O0):
<SkipLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
je     113a <SkipLine+0x2a>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x1(%rbp)
jmp    111e <SkipLine+0xe>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SkipLine>:
push   %rax
cmp    $0xa,%dil
je     112b <SkipLine+0x1b>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%al
jne    1120 <SkipLine+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @SkipLine(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
br label %3
3: ; preds = %7, %1
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = icmp ne i32 %5, 10
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = call signext i8 (...) @getchar()
store i8 %8, i8* %2
br label %3
9: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @SkipLine(i8 signext %0) {
%2 = icmp eq i8 %0, 10
br i1 %2, label %6, label %3
3: ; preds = %1, %3
%4 = tail call signext i8 (...) @getchar()
%5 = icmp eq i8 %4, 10
br i1 %5, label %6, label %3
6: ; preds = %3, %1
ret void
}
float sgn(float val) {
  return (val > 0.0f) ? 1.0f : ((val < 0.0f) ? -1.0f : 0.0f);
}


x86 assembly (clang, -O0):
<sgn>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    112c <sgn+0x2c>
movss  0xee2(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    1152 <sgn+0x52>
movss  -0x4(%rbp),%xmm0
movss  0xec7(%rip),%xmm3
xorps  %xmm2,%xmm2
cmpltss %xmm2,%xmm0
movaps %xmm0,%xmm1
andps  %xmm3,%xmm1
andnps %xmm2,%xmm0
orps   %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sgn>:
xorps  %xmm1,%xmm1
movaps %xmm0,%xmm2
cmpltss %xmm1,%xmm2
movss  0xeed(%rip),%xmm3
andps  %xmm2,%xmm3
cmpltss %xmm0,%xmm1
movss  0xee1(%rip),%xmm0
andps  %xmm1,%xmm0
andnps %xmm3,%xmm1
orps   %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @sgn(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fcmp ogt float %3, 0.000000e+00
br i1 %4, label %5, label %6
5: ; preds = %1
br label %11
6: ; preds = %1
%7 = load float, float* %2
%8 = fcmp olt float %7, 0.000000e+00
%9 = zext i1 %8 to i64
%10 = select i1 %8, float -1.000000e+00, float 0.000000e+00
br label %11
11: ; preds = %6, %5
%12 = phi float [ 1.000000e+00, %5 ], [ %10, %6 ]
ret float %12
}

LLVM IR (-O2):
define float @sgn(float %0) {
%2 = fcmp ogt float %0, 0.000000e+00
%3 = fcmp olt float %0, 0.000000e+00
%4 = select i1 %3, float -1.000000e+00, float 0.000000e+00
%5 = select i1 %2, float 1.000000e+00, float %4
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void *f1(void *arg) {
  printf("f1(%d)\n", (int)arg);
  return (void *)10;
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%esi
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
mov    $0xa,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xa,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"f1(%d)\0A\00"
define i8* @f1(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i32
%5 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i8* inttoptr (i64 10 to i8*)
}

LLVM IR (-O2):
@.str = [8 x i8] c"f1(%d)\0A\00"
define i8* @f1(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i8* inttoptr (i64 10 to i8*)
}
void MmioUtil_Write16(void *base, const unsigned long offset,
                      const unsigned short val) {
  *(volatile unsigned short *)(void *)((char *)(base) + (offset)) = (val);
}


x86 assembly (clang, -O0):
<MmioUtil_Write16>:
push   %rbp
mov    %rsp,%rbp
mov    %dx,%ax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %ax,-0x12(%rbp)
mov    -0x12(%rbp),%dx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %dx,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<MmioUtil_Write16>:
mov    %dx,(%rdi,%rsi,1)
ret

LLVM IR (-O0):
define void @MmioUtil_Write16(i8* %0, i64 %1, i16 zeroext %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i16
store i8* %0, i8** %4
store i64 %1, i64* %5
store i16 %2, i16* %6
%7 = load i16, i16* %6
%8 = load i8*, i8** %4
%9 = load i64, i64* %5
%10 = getelementptr inbounds i8, i8* %8, i64 %9
%11 = bitcast i8* %10 to i16*
store volatile i16 %7, i16* %11
ret void
}

LLVM IR (-O2):
define void @MmioUtil_Write16(i8* %0, i64 %1, i16 zeroext %2) {
%4 = getelementptr inbounds i8, i8* %0, i64 %1
%5 = bitcast i8* %4 to i16*
store volatile i16 %2, i16* %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
char *strdup(char const *);
char *xstrdup(const char *str) {
  char *tmp;
  tmp = strdup(str);
  if (tmp == NULL) {
    perror("strdup");
    exit(1);
  }
  return tmp;
}


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116a <xstrdup+0x3a>
lea    0xea5(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %rax
call   1050 <strdup@plt>
test   %rax,%rax
je     113d <xstrdup+0xd>
pop    %rcx
ret
lea    0xebc(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c"strdup\00"
define noalias i8* @xstrdup(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1
ret i8* %2
}