xunge/DecIR huggingface dataset:
/* Variables and functions */
volatile bool buttonCenter(volatile unsigned int *p) {
  static bool b = false;
  if (((*p) & 0x00000001) == 0x00000001) {
    if (b == false) {
      b = true;
      return true;
    } else
      return false;
  }
  b = false;
  return false;
}


x86 assembly (clang, -O0):
<buttonCenter>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x1,%eax
jne    1149 <buttonCenter+0x49>
cmpl   $0x0,0x2f03(%rip)
jne    113d <buttonCenter+0x3d>
movl   $0x1,0x2ef3(%rip)
movl   $0x1,-0x4(%rbp)
jmp    115a <buttonCenter+0x5a>
movl   $0x0,-0x4(%rbp)
jmp    115a <buttonCenter+0x5a>
movl   $0x0,0x2ed1(%rip)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<buttonCenter>:
mov    (%rdi),%ecx
xor    %edx,%edx
test   $0x1,%cl
je     1119 <buttonCenter+0x19>
mov    $0x1,%edx
xor    %eax,%eax
cmpb   $0x0,0x2f0d(%rip)
jne    1124 <buttonCenter+0x24>
and    $0x1,%ecx
mov    %cl,0x2f02(%rip)
mov    %edx,%eax
ret

LLVM IR (-O0):
@buttonCenter.b = internal global i32 0
define i32 @buttonCenter(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = load volatile i32, i32* %4
%6 = and i32 %5, 1
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i32, i32* @buttonCenter.b
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %8
store i32 1, i32* @buttonCenter.b
store i32 1, i32* %2
br label %14
12: ; preds = %8
store i32 0, i32* %2
br label %14
13: ; preds = %1
store i32 0, i32* @buttonCenter.b
store i32 0, i32* %2
br label %14
14: ; preds = %13, %12, %11
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@buttonCenter.b = internal unnamed_addr global i1 false
define i32 @buttonCenter(i32* %0) {
%2 = load volatile i32, i32* %0
%3 = and i32 %2, 1
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = load i1, i1* @buttonCenter.b
br i1 %6, label %10, label %7
7: ; preds = %1, %5
%8 = phi i32 [ 1, %5 ], [ 0, %1 ]
%9 = xor i1 %4, true
store i1 %9, i1* @buttonCenter.b
br label %10
10: ; preds = %7, %5
%11 = phi i32 [ 0, %5 ], [ %8, %7 ]
ret i32 %11
}
/* Variables and functions */
char const *getlogin();
const char *get_platform_user_name(void) { return getlogin(); }


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

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

LLVM IR (-O0):
define i8* @get_platform_user_name() {
%1 = call i8* (...) @getlogin()
ret i8* %1
}

LLVM IR (-O2):
define i8* @get_platform_user_name() {
%1 = tail call i8* (...) @getlogin()
ret i8* %1
}
/* Variables and functions */
int L0__tigermain_0(int /*<<< orphan*/);
int main() {
  int i;
  return L0__tigermain_0(0);
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @L0__tigermain_0(i32 0)
ret i32 %1
}
int f2(void) { return 2; }


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

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

LLVM IR (-O0):
define i32 @f2() {
ret i32 2
}

LLVM IR (-O2):
define i32 @f2() {
ret i32 2
}
/* Variables and functions */
scalar_t__ malloc(int);
void *sqlite3GenericMalloc(int n) {
  char *p = (char *)malloc(n);
  return (void *)p;
}


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

x86 assembly (clang, -O2):
<sqlite3GenericMalloc>:
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @sqlite3GenericMalloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %3
%7 = load i8*, i8** %3
ret i8* %7
}

LLVM IR (-O2):
define i8* @sqlite3GenericMalloc(i32 %0) {
%2 = tail call i64 @malloc(i32 %0)
%3 = inttoptr i64 %2 to i8*
ret i8* %3
}
int mult(int x, int y) {
  if (x == 1)
    return y;
  else
    return y + mult(x - 1, y);
}


x86 assembly (clang, -O0):
<mult>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1133 <mult+0x23>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1151 <mult+0x41>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0xc(%rbp),%esi
call   1030 <mult@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mult>:
lea    -0x1(%rdi),%ecx
imul   %esi,%ecx
xor    %eax,%eax
cmp    $0x1,%edi
cmovne %ecx,%eax
add    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @mult(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 1
%4 = add i32 %0, -1
%5 = mul i32 %4, %1
%6 = select i1 %3, i32 0, i32 %5
%7 = add nsw i32 %6, %1
ret i32 %7
}
/* Variables and functions */
int check_win(void *);
int value(void *s) {
  int win = check_win(s);
  if (win == -1) {
    return 0;
  } else if (win == 0) {
    return 1;
  } else {
    return -1;
  }
}


x86 assembly (clang, -O0):
<value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <check_win@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    113e <value+0x2e>
movl   $0x0,-0x4(%rbp)
jmp    115b <value+0x4b>
cmpl   $0x0,-0x14(%rbp)
jne    1154 <value+0x44>
movl   $0x1,-0x4(%rbp)
jmp    115b <value+0x4b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<value>:
push   %rax
call   1030 <check_win@plt>
mov    %eax,%ecx
neg    %ecx
sbb    %edx,%edx
or     $0x1,%edx
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
cmovne %edx,%ecx
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @value(i8* %0) {
%2 = tail call i32 @check_win(i8* %0)
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 1, i32 -1
%5 = icmp eq i32 %2, -1
%6 = select i1 %5, i32 0, i32 %4
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;
typedef int /*<<< orphan*/ pathname;

/* Variables and functions */
int chown(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ snprintf(char *, int, char *, unsigned int);
int chrdev_chown(unsigned minor, uid_t uid, uid_t gid) {
  char pathname[64];
  int x;
  snprintf(pathname, sizeof(pathname), "/dev/mhvtl%u", minor);
  ;
  x = chown(pathname, uid, uid);
  if (x == -1) {

    ;
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<chrdev_chown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%ecx
mov    $0x40,%esi
lea    0xebc(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x50(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <chown@plt>
mov    %eax,-0x54(%rbp)
cmpl   $0xffffffff,-0x54(%rbp)
jne    1171 <chrdev_chown+0x51>
movl   $0xffffffff,-0x4(%rbp)
jmp    1178 <chrdev_chown+0x58>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chrdev_chown>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %esi,%ebx
mov    %edi,%ecx
lea    0xece(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x40,%esi
call   1030 <snprintf@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebx,%edx
call   1040 <chown@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
sete   %cl
neg    %ecx
mov    %ecx,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [13 x i8] c"/dev/mhvtl%u\00"
define i32 @chrdev_chown(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [64 x i8]
%9 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%10 = getelementptr inbounds [64 x i8], [64 x i8]* %8, i64 0, i64 0
%11 = load i32, i32* %5
%12 = call i32 @snprintf(i8* %10, i32 64, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = getelementptr inbounds [64 x i8], [64 x i8]* %8, i64 0, i64 0
%14 = load i32, i32* %6
%15 = load i32, i32* %6
%16 = call i32 @chown(i8* %13, i32 %14, i32 %15)
store i32 %16, i32* %9
%17 = load i32, i32* %9
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %20
19: ; preds = %3
store i32 -1, i32* %4
br label %21
20: ; preds = %3
store i32 0, i32* %4
br label %21
21: ; preds = %20, %19
%22 = load i32, i32* %4
ret i32 %22
}

LLVM IR (-O2):
@.str = [13 x i8] c"/dev/mhvtl%u\00"
define i32 @chrdev_chown(i32 %0, i32 %1, i32 %2) {
%4 = alloca [64 x i8]
%5 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%6 = call i32 @snprintf(i8* %5, i32 64, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %0)
%7 = call i32 @chown(i8* %5, i32 %1, i32 %1)
%8 = icmp eq i32 %7, -1
%9 = sext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int, int);
void exitfunc7(int status, void *arg) {
  printf("Executing exitfunc7 (status=%d, arg=%d)\n", status, (int)arg);
  exit((int)arg);
}


x86 assembly (clang, -O0):
<exitfunc7>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rax
mov    %eax,%edx
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %eax,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<exitfunc7>:
push   %rbx
mov    %rsi,%rbx
mov    %edi,%esi
lea    0xed3(%rip),%rdi
mov    %ebx,%edx
call   1030 <printf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"Executing exitfunc7 (status=%d, arg=%d)\0A\00"
define void @exitfunc7(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = load i8*, i8** %4
%7 = ptrtoint i8* %6 to i32
%8 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %7)
%9 = load i8*, i8** %4
%10 = ptrtoint i8* %9 to i32
%11 = call i32 @exit(i32 %10)
unreachable
}

LLVM IR (-O2):
@.str = [41 x i8] c"Executing exitfunc7 (status=%d, arg=%d)\0A\00"
define void @exitfunc7(i32 %0, i8* %1) {
%3 = ptrtoint i8* %1 to i64
%4 = trunc i64 %3 to i32
%5 = tail call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %4)
%6 = tail call i32 @exit(i32 %4)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ heap_SetFreeFlags(int /*<<< orphan*/, int);
void heap_Init() { heap_SetFreeFlags(0, 1000); }


x86 assembly (clang, -O0):
<heap_Init>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
mov    $0x3e8,%esi
call   1030 <heap_SetFreeFlags@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<heap_Init>:
xor    %edi,%edi
mov    $0x3e8,%esi
jmp    1030 <heap_SetFreeFlags@plt>

LLVM IR (-O0):
define void @heap_Init() {
%1 = call i32 @heap_SetFreeFlags(i32 0, i32 1000)
ret void
}

LLVM IR (-O2):
define void @heap_Init() {
%1 = tail call i32 @heap_SetFreeFlags(i32 0, i32 1000)
ret void
}
char *send_file(char *encoded_file, char *fileinfo) { return "ok"; }


x86 assembly (clang, -O0):
<send_file>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeed(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_file>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"ok\00"
define i8* @send_file(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [3 x i8] c"ok\00"
define i8* @send_file(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ printflaat(float);
void floattest() {
  float x = 1.1f;
  printflaat(x);
}


x86 assembly (clang, -O0):
<floattest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  0xee0(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <printflaat@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<floattest>:
movss  0xee8(%rip),%xmm0
jmp    1030 <printflaat@plt>

LLVM IR (-O0):
define void @floattest() {
%1 = alloca float
store float 0x3FF19999A0000000, float* %1
%2 = load float, float* %1
%3 = call i32 @printflaat(float %2)
ret void
}

LLVM IR (-O2):
define void @floattest() {
%1 = tail call i32 @printflaat(float 0x3FF19999A0000000)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int tm_mday;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ time(void *);
int date_get_day(void) {
  time_t t;
  struct tm *lt;
  t = time((void *)0);
  lt = localtime(&t);
  return lt->tm_mday;
}


x86 assembly (clang, -O0):
<date_get_day>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<date_get_day>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define i32 @date_get_day() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = call i32 @time(i8* null)
store i32 %3, i32* %1
%4 = call %struct.tm* @localtime(i32* %1)
store %struct.tm* %4, %struct.tm** %2
%5 = load %struct.tm*, %struct.tm** %2
%6 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 0
%7 = load i32, i32* %6
ret i32 %7
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define i32 @date_get_day() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i8* null)
store i32 %3, i32* %1
%4 = call %struct.tm* @localtime(i32* %1)
%5 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%6 = load i32, i32* %5
ret i32 %6
}
int foo(int x) {
  int y = 0;
  int z = x + 1;
  return z + y;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int foo(int);
int bar() {
  int x = foo(foo(1));
#pragma omp taskwait on(x)
  return x;
}


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

x86 assembly (clang, -O2):
<bar>:
push   %rax
mov    $0x1,%edi
call   1030 <foo@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <foo@plt>

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

LLVM IR (-O2):
define i32 @bar() {
%1 = tail call i32 @foo(i32 1)
%2 = tail call i32 @foo(i32 %1)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ GetGust86OsculatingCoor(double const, double const,
                                           int const, double *);
void GetGust86Coor(const double jd, const int body, double *xyz) {
  GetGust86OsculatingCoor(jd, jd, body, xyz);
}


x86 assembly (clang, -O0):
<GetGust86Coor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1030 <GetGust86OsculatingCoor@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetGust86Coor>:
movaps %xmm0,%xmm1
jmp    1030 <GetGust86OsculatingCoor@plt>

LLVM IR (-O0):
define void @GetGust86Coor(double %0, i32 %1, double* %2) {
%4 = alloca double
%5 = alloca i32
%6 = alloca double*
store double %0, double* %4
store i32 %1, i32* %5
store double* %2, double** %6
%7 = load double, double* %4
%8 = load double, double* %4
%9 = load i32, i32* %5
%10 = load double*, double** %6
%11 = call i32 @GetGust86OsculatingCoor(double %7, double %8, i32 %9, double* %10)
ret void
}

LLVM IR (-O2):
define void @GetGust86Coor(double %0, i32 %1, double* %2) {
%4 = tail call i32 @GetGust86OsculatingCoor(double %0, double %0, i32 %1, double* %2)
ret void
}
int test_imm_40int16_mem(short *val) {
  return ((*val) & (0x40 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_40int16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = and i32 %5, 64
%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_40int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 64
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char, float, short, double, int, float, long,
                          double);
void p2(char c, float f1, short s, double d1, int i, float f2, long l,
        double d2) {
  printf("%c %f %d %f %d %f %d %f\n", c, f1, s, d1, i, f2, l, d2);
}


x86 assembly (clang, -O0):
<p2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %si,%ax
mov    %dil,%sil
mov    %sil,-0x1(%rbp)
movss  %xmm0,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movss  %xmm2,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movsd  %xmm3,-0x30(%rbp)
mov    -0x1(%rbp),%dl
movss  -0x8(%rbp),%xmm0
mov    -0xa(%rbp),%ax
movsd  -0x18(%rbp),%xmm1
mov    -0x1c(%rbp),%ecx
movss  -0x20(%rbp),%xmm2
mov    -0x28(%rbp),%r8
movsd  -0x30(%rbp),%xmm3
lea    0xe96(%rip),%rdi
movsbl %dl,%esi
movswl %ax,%edx
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<p2>:
mov    %rcx,%r8
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%esi
lea    0xee0(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"%c %f %d %f %d %f %d %f\0A\00"
define void @p2(i8 signext %0, float %1, i16 signext %2, double %3, i32 %4, float %5, i64 %6, double %7) {
%9 = alloca i8
%10 = alloca float
%11 = alloca i16
%12 = alloca double
%13 = alloca i32
%14 = alloca float
%15 = alloca i64
%16 = alloca double
store i8 %0, i8* %9
store float %1, float* %10
store i16 %2, i16* %11
store double %3, double* %12
store i32 %4, i32* %13
store float %5, float* %14
store i64 %6, i64* %15
store double %7, double* %16
%17 = load i8, i8* %9
%18 = load float, float* %10
%19 = load i16, i16* %11
%20 = load double, double* %12
%21 = load i32, i32* %13
%22 = load float, float* %14
%23 = load i64, i64* %15
%24 = load double, double* %16
%25 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8 signext %17, float %18, i16 signext %19, double %20, i32 %21, float %22, i64 %23, double %24)
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"%c %f %d %f %d %f %d %f\0A\00"
define void @p2(i8 signext %0, float %1, i16 signext %2, double %3, i32 %4, float %5, i64 %6, double %7) {
%9 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8 signext %0, float %1, i16 signext %2, double %3, i32 %4, float %5, i64 %6, double %7)
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ class;
};
typedef TYPE_1__ XWindowAttributes;

/* Variables and functions */
int get_XWindowAttributes_class(void *_p) {
  return (int)((XWindowAttributes *)_p)->class;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i32 @get_XWindowAttributes_class(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_XWindowAttributes_class(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Type definitions */
struct stat {
  int st_size;
};

/* Variables and functions */
int fstat(int, struct stat *);
int /*<<< orphan*/ perror(char *);
int get_fileSize(int fd) {
  struct stat buf;
  int ret;
  ret = fstat(fd, &buf);
  if (ret < 0) {
    perror("stat");
    return -1;
  }
  return buf.st_size;
}


x86 assembly (clang, -O0):
<get_fileSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1040 <fstat@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    115c <get_fileSize+0x3c>
lea    0xeb5(%rip),%rdi
call   1030 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1162 <get_fileSize+0x42>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_fileSize>:
push   %rax
mov    %rsp,%rsi
call   1040 <fstat@plt>
test   %eax,%eax
js     1132 <get_fileSize+0x12>
mov    (%rsp),%eax
pop    %rcx
ret
lea    0xec7(%rip),%rdi
call   1030 <perror@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [5 x i8] c"stat\00"
define i32 @get_fileSize(i32 %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @fstat(i32 %0, %struct.stat* %2)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %11
8: ; preds = %1
%9 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%10 = load i32, i32* %9
br label %11
11: ; preds = %8, %6
%12 = phi i32 [ -1, %6 ], [ %10, %8 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ GENIRTimer100Us();
void HandlerTimer2() { GENIRTimer100Us(); }


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

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

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

LLVM IR (-O2):
define void @HandlerTimer2() {
%1 = tail call i32 (...) @GENIRTimer100Us()
ret void
}
unsigned speaker_period_to_Hz(unsigned short period) {
  unsigned Hz;
  Hz = (period) ? (1193180U / period) : 18;
  return Hz;
}


x86 assembly (clang, -O0):
<speaker_period_to_Hz>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
cmp    $0x0,%eax
je     112d <speaker_period_to_Hz+0x2d>
movzwl -0x2(%rbp),%ecx
mov    $0x1234dc,%eax
xor    %edx,%edx
div    %ecx
mov    %eax,-0xc(%rbp)
jmp    113a <speaker_period_to_Hz+0x3a>
mov    $0x12,%eax
mov    %eax,-0xc(%rbp)
jmp    113a <speaker_period_to_Hz+0x3a>
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<speaker_period_to_Hz>:
test   %edi,%edi
je     1111 <speaker_period_to_Hz+0x11>
movzwl %di,%ecx
mov    $0x1234dc,%eax
xor    %edx,%edx
div    %ecx
ret
mov    $0x12,%eax
ret

LLVM IR (-O0):
define i32 @speaker_period_to_Hz(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i32
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = zext i16 %4 to i32
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i16, i16* %2
%9 = zext i16 %8 to i32
%10 = udiv i32 1193180, %9
br label %12
11: ; preds = %1
br label %12
12: ; preds = %11, %7
%13 = phi i32 [ %10, %7 ], [ 18, %11 ]
store i32 %13, i32* %3
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @speaker_period_to_Hz(i16 zeroext %0) {
%2 = icmp eq i16 %0, 0
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = zext i16 %0 to i32
%5 = udiv i32 1193180, %4
br label %6
6: ; preds = %1, %3
%7 = phi i32 [ %5, %3 ], [ 18, %1 ]
ret i32 %7
}
/* Variables and functions */
char *skip_arg(char const *);
char *skip_sep(char const *);
int count_argc(const char *str) {
  int count = 0;
  while (*str) {
    str = skip_sep(str);
    if (*str) {
      count++;
      str = skip_arg(str);
    }
  }
  return count;
}


x86 assembly (clang, -O0):
<count_argc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1175 <count_argc+0x55>
mov    -0x8(%rbp),%rdi
call   1040 <skip_sep@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1170 <count_argc+0x50>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <skip_arg@plt>
mov    %rax,-0x8(%rbp)
jmp    1133 <count_argc+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_argc>:
push   %rbx
cmpb   $0x0,(%rdi)
je     114f <count_argc+0x2f>
mov    %rdi,%rax
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    %rax,%rdi
call   1040 <skip_sep@plt>
cmpb   $0x0,(%rax)
je     1151 <count_argc+0x31>
add    $0x1,%ebx
mov    %rax,%rdi
call   1030 <skip_arg@plt>
cmpb   $0x0,(%rax)
jne    1130 <count_argc+0x10>
jmp    1151 <count_argc+0x31>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @count_argc(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %10
%5 = phi i32 [ %11, %10 ], [ 0, %1 ]
%6 = phi i8* [ %12, %10 ], [ %0, %1 ]
%7 = tail call i8* @skip_sep(i8* %6)
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %4
%11 = add nuw nsw i32 %5, 1
%12 = tail call i8* @skip_arg(i8* %7)
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %4, %10, %1
%16 = phi i32 [ 0, %1 ], [ %5, %4 ], [ %11, %10 ]
ret i32 %16
}
/* Variables and functions */
char *calloc(int, int);
int rand();
int /*<<< orphan*/ strcpy(char *, char *);
char *fn109() {
  char *result;
  result = calloc(5 + rand() % 5, 4);
  strcpy((char *)result, "fn109");
  return result;
}


x86 assembly (clang, -O0):
<fn109>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x5,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn109>:
push   %rbx
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edi
add    $0x5,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
lea    0xe93(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"fn109\00"
define i8* @fn109() {
%1 = alloca i8*
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 5
%4 = add nsw i32 5, %3
%5 = call i8* @calloc(i32 %4, i32 4)
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %1
ret i8* %8
}

LLVM IR (-O2):
@.str = [6 x i8] c"fn109\00"
define i8* @fn109() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 5
%3 = add nsw i32 %2, 5
%4 = tail call i8* @calloc(i32 %3, i32 4)
%5 = tail call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i8* %4
}
int owReadBitPower(int portnum, int applyPowerResponse) {
  portnum = 0;
  applyPowerResponse = 0;
  return 0;
}


x86 assembly (clang, -O0):
<owReadBitPower>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @owReadBitPower(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %3
store i32 0, i32* %4
ret i32 0
}

LLVM IR (-O2):
define i32 @owReadBitPower(i32 %0, i32 %1) {
ret i32 0
}
int generate_dh_params(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @generate_dh_params() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ printf(char *);
void test_continue_while() {
  printf("\n===== test_continue_while\n");
  int result = 1;
  int alt_result = 1;
  while (result < 10) {
    ++result;
    if (result < 10)
      continue;
    ++alt_result;
  }
  assert(result == 10);
  assert(alt_result == 2);
}


x86 assembly (clang, -O0):
<test_continue_while>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1172 <test_continue_while+0x52>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1164 <test_continue_while+0x44>
jmp    1142 <test_continue_while+0x22>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <test_continue_while+0x22>
cmpl   $0xa,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpl   $0x2,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_continue_while>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
pop    %rax
jmp    1040 <assert@plt>

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

LLVM IR (-O2):
@str = [27 x i8] c"\0A===== test_continue_while\00"
define void @test_continue_while() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @assert(i32 1)
%3 = tail call i32 @assert(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fatal(char *);
void *realloc(void *, size_t);
void *ec_realloc(void *ptr, size_t size) {
  void *new_ptr;
  new_ptr = realloc(ptr, size);
  if (new_ptr == NULL)
    fatal("in ec_realloc() on memory allocation");
  return new_ptr;
}


x86 assembly (clang, -O0):
<ec_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1158 <ec_realloc+0x38>
lea    0xead(%rip),%rdi
call   1040 <fatal@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ec_realloc>:
push   %rbx
call   1030 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <ec_realloc+0x1a>
lea    0xecb(%rip),%rdi
call   1040 <fatal@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"in ec_realloc() on memory allocation\00"
define i8* @ec_realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @fatal(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %2
%14 = load i8*, i8** %5
ret i8* %14
}

LLVM IR (-O2):
@.str = [37 x i8] c"in ec_realloc() on memory allocation\00"
define noalias i8* @ec_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @fatal(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret i8* %3
}
unsigned long WatchdogReloadGet(unsigned long ulBase) {
  ;
  return ((*((volatile unsigned long *)(ulBase + 0x00000000))));
}


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

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

LLVM IR (-O0):
define i64 @WatchdogReloadGet(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add i64 %3, 0
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
ret i64 %6
}

LLVM IR (-O2):
define i64 @WatchdogReloadGet(i64 %0) {
%2 = inttoptr i64 %0 to i64*
%3 = load volatile i64, i64* %2
ret i64 %3
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void cmac_shared_unlock(void) {
  volatile uint32_t *bsr_reset = (void *)0x50050078;
  *bsr_reset = 0x40000000;
}


x86 assembly (clang, -O0):
<cmac_shared_unlock>:
push   %rbp
mov    %rsp,%rbp
mov    $0x50050078,%eax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x40000000,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmac_shared_unlock>:
movl   $0x40000000,0x50050078
ret

LLVM IR (-O0):
define void @cmac_shared_unlock() {
%1 = alloca i32*
store i32* inttoptr (i64 1342505080 to i32*), i32** %1
%2 = load i32*, i32** %1
store volatile i32 1073741824, i32* %2
ret void
}

LLVM IR (-O2):
define void @cmac_shared_unlock() {
store volatile i32 1073741824, i32* inttoptr (i64 1342505080 to i32*)
ret void
}
void GPIOPortS_Handler(void) {
  while (1) {
  }
}


x86 assembly (clang, -O0):
<GPIOPortS_Handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <GPIOPortS_Handler+0x9>
jmp    1109 <GPIOPortS_Handler+0x9>

x86 assembly (clang, -O2):
<GPIOPortS_Handler>:
jmp    1100 <GPIOPortS_Handler>

LLVM IR (-O0):
define void @GPIOPortS_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @GPIOPortS_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ nomem();
void *xmalloc(size_t n) {
  void *v;
  v = malloc(n);
  if (!v)
    nomem();
  return v;
}


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 <nomem@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rbx
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1135 <xmalloc+0x15>
xor    %eax,%eax
call   1030 <nomem@plt>
mov    %rbx,%rax
pop    %rbx
ret

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 ne i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 (...) @nomem()
br label %10
10: ; preds = %8, %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 (...) @nomem()
br label %6
6: ; preds = %4, %1
ret i8* %2
}
long double _min(long double a, long double b) {
  if (a > b)
    return b;
  else
    return a;
}


x86 assembly (clang, -O0):
<_min>:
push   %rbp
mov    %rsp,%rbp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x20(%rbp)
fstpt  -0x30(%rbp)
fldt   -0x20(%rbp)
fldt   -0x30(%rbp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jbe    1132 <_min+0x32>
jmp    1127 <_min+0x27>
fldt   -0x30(%rbp)
fstpt  -0x10(%rbp)
jmp    1138 <_min+0x38>
fldt   -0x20(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<_min>:
fldt   0x18(%rsp)
fldt   0x8(%rsp)
fucomi %st(1),%st
fcmovnbe %st(1),%st
fstp   %st(1)
ret

LLVM IR (-O0):
define x86_fp80 @_min(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80
%5 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %4
store x86_fp80 %1, x86_fp80* %5
%6 = load x86_fp80, x86_fp80* %4
%7 = load x86_fp80, x86_fp80* %5
%8 = fcmp ogt x86_fp80 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load x86_fp80, x86_fp80* %5
store x86_fp80 %10, x86_fp80* %3
br label %13
11: ; preds = %2
%12 = load x86_fp80, x86_fp80* %4
store x86_fp80 %12, x86_fp80* %3
br label %13
13: ; preds = %11, %9
%14 = load x86_fp80, x86_fp80* %3
ret x86_fp80 %14
}

LLVM IR (-O2):
define x86_fp80 @_min(x86_fp80 %0, x86_fp80 %1) {
%3 = fcmp ogt x86_fp80 %0, %1
%4 = select i1 %3, x86_fp80 %1, x86_fp80 %0
ret x86_fp80 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_memblockq_set_maxlength() {
  printf("NOT IMPLEMENTED:"
         "pa_memblockq_set_maxlength"
         "\n");
}


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

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

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

LLVM IR (-O2):
@str = [43 x i8] c"NOT IMPLEMENTED:pa_memblockq_set_maxlength\00"
define i32 @pa_memblockq_set_maxlength() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ my_putchar(char);
int /*<<< orphan*/ my_putstr(char *);
int my_show_wordtab(char **tab) {
  int i;
  i = 0;
  while (tab[i] != 0) {
    my_putstr(tab[i]);
    my_putchar('\n');
    i++;
  }
  return (0);
}


x86 assembly (clang, -O0):
<my_show_wordtab>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     116f <my_show_wordtab+0x4f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <my_putstr@plt>
mov    $0xa,%edi
call   1030 <my_putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <my_show_wordtab+0x13>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_show_wordtab>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     114b <my_show_wordtab+0x2b>
add    $0x8,%rbx
call   1040 <my_putstr@plt>
mov    $0xa,%edi
call   1030 <my_putchar@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1130 <my_show_wordtab+0x10>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @my_show_wordtab(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %9, %4 ], [ 0, %1 ]
%6 = phi i8* [ %11, %4 ], [ %2, %1 ]
%7 = tail call i32 @my_putstr(i8* %6)
%8 = tail call i32 @my_putchar(i8 signext 10)
%9 = add nuw i64 %5, 1
%10 = getelementptr inbounds i8*, i8** %0, i64 %9
%11 = load i8*, i8** %10
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %4
13: ; preds = %4, %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void print_usage() { puts("Usage: rowind [test|<device name>]"); }


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

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

LLVM IR (-O0):
@.str = [35 x i8] c"Usage: rowind [test|<device name>]\00"
define void @print_usage() {
%1 = call i32 @puts(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"Usage: rowind [test|<device name>]\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
ret void
}
unsigned long hash(const char *pText, int maxValue) {
  unsigned long auxHash;
  unsigned const char *pUnsignedText;
  pUnsignedText = (unsigned const char *)pText;
  auxHash = 0;
  while (*pUnsignedText != '\0') {
    auxHash = auxHash * (97) + *pUnsignedText;
    pUnsignedText++;
  }
  auxHash = auxHash % maxValue;
  return auxHash;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x20(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x0,%eax
je     114f <hash+0x4f>
imul   $0x61,-0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
movzbl (%rcx),%ecx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    111b <hash+0x1b>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
xor    %edx,%edx
div    %rcx
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1127 <hash+0x27>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
imul   $0x61,%rax,%rdx
movzbl %cl,%eax
add    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash+0x10>
jmp    1129 <hash+0x29>
xor    %eax,%eax
movslq %esi,%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
je     1141 <hash+0x41>
xor    %edx,%edx
div    %rcx
mov    %rdx,%rax
ret
xor    %edx,%edx
div    %esi
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i64 @hash(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i8* [ %12, %5 ], [ %0, %2 ]
%8 = phi i64 [ %11, %5 ], [ 0, %2 ]
%9 = mul i64 %8, 97
%10 = zext i8 %6 to i64
%11 = add i64 %9, %10
%12 = getelementptr inbounds i8, i8* %7, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i64 [ 0, %2 ], [ %11, %5 ]
%17 = sext i32 %1 to i64
%18 = urem i64 %16, %17
ret i64 %18
}