xunge/DecIR huggingface dataset:
/* Variables and functions */
int omp_get_num_threads();
int /*<<< orphan*/ sort2_1(int *, int /*<<< orphan*/, int, int, int *);
void sort2(int *array, int count) {
  int num_threads;
  int busy = 1;
#pragma omp parallel
#pragma omp single nowait
  num_threads = omp_get_num_threads();
  sort2_1(array, 0, count - 1, num_threads, &busy);
}


x86 assembly (clang, -O0):
<sort2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x1,-0x14(%rbp)
mov    $0x0,%al
call   1030 <omp_get_num_threads@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
mov    -0x10(%rbp),%ecx
xor    %esi,%esi
lea    -0x14(%rbp),%r8
call   1040 <sort2_1@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sort2>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
movl   $0x1,0x4(%rsp)
xor    %eax,%eax
call   1030 <omp_get_num_threads@plt>
add    $0xffffffff,%ebx
lea    0x4(%rsp),%r8
mov    %r14,%rdi
xor    %esi,%esi
mov    %ebx,%edx
mov    %eax,%ecx
call   1040 <sort2_1@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @sort2(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 1, i32* %6
%7 = call i32 (...) @omp_get_num_threads()
store i32 %7, i32* %5
%8 = load i32*, i32** %3
%9 = load i32, i32* %4
%10 = sub nsw i32 %9, 1
%11 = load i32, i32* %5
%12 = call i32 @sort2_1(i32* %8, i32 0, i32 %10, i32 %11, i32* %6)
ret void
}

LLVM IR (-O2):
define void @sort2(i32* %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 1, i32* %3
%5 = tail call i32 (...) @omp_get_num_threads()
%6 = add nsw i32 %1, -1
%7 = call i32 @sort2_1(i32* %0, i32 0, i32 %6, i32 %5, i32* %3)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ C_LOCALTIME_R(int /*<<< orphan*/ *, struct tm *);
int main() {
  time_t time;
  struct tm result;
  C_LOCALTIME_R(&time, &result);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <C_LOCALTIME_R@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.tm
store i32 0, i32* %1
%4 = call i32 @C_LOCALTIME_R(i32* %2, %struct.tm* %3)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.tm
%3 = bitcast i32* %1 to i8*
%4 = bitcast %struct.tm* %2 to i8*
%5 = call i32 @C_LOCALTIME_R(i32* %1, %struct.tm* %2)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
char *pseudotalloc_malloc(int);
int /*<<< orphan*/ vsnprintf(char *, int, char const *, int /*<<< orphan*/);
char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) {
  char *buf = pseudotalloc_malloc(128);
  if (!buf)
    return NULL;
  vsnprintf(buf, 128, fmt, ap);
  return buf;
}


x86 assembly (clang, -O0):
<talloc_vasprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    $0x80,%edi
call   1040 <pseudotalloc_malloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1159 <talloc_vasprintf+0x39>
movq   $0x0,-0x8(%rbp)
jmp    1176 <talloc_vasprintf+0x56>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    $0x80,%esi
call   1030 <vsnprintf@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<talloc_vasprintf>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    $0x80,%edi
call   1040 <pseudotalloc_malloc@plt>
mov    %rax,%rbp
test   %rax,%rax
je     114f <talloc_vasprintf+0x2f>
mov    %rbp,%rdi
mov    $0x80,%esi
mov    %rbx,%rdx
mov    %r14d,%ecx
call   1030 <vsnprintf@plt>
mov    %rbp,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @talloc_vasprintf(i8* nocapture readnone %0, i8* nocapture %1, i32 %2) {
%4 = tail call i8* @pseudotalloc_malloc(i32 128)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @vsnprintf(i8* %4, i32 128, i8* %1, i32 %2)
br label %8
8: ; preds = %3, %6
ret i8* %4
}
int value(char *str) {
  int sum = 0, iter;
  for (iter = 0; str[iter] != '\0'; iter++) {
    sum += str[iter] - 'A' + 1;
  }
  return sum;
}


x86 assembly (clang, -O0):
<value>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1151 <value+0x51>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x41,%eax
add    $0x1,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1116 <value+0x16>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<value>:
mov    (%rdi),%cl
test   %cl,%cl
je     1124 <value+0x24>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
add    %ecx,%eax
add    $0xffffffc0,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <value+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @value(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %11, %4 ], [ 0, %1 ]
%6 = phi i8 [ %13, %4 ], [ %2, %1 ]
%7 = phi i32 [ %10, %4 ], [ 0, %1 ]
%8 = sext i8 %6 to i32
%9 = add i32 %7, -64
%10 = add i32 %9, %8
%11 = add nuw nsw i64 %5, 1
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %4, %1
%16 = phi i32 [ 0, %1 ], [ %10, %4 ]
ret i32 %16
}
void proc_flush_task(struct task_struct *task) {}


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

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

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

LLVM IR (-O2):
%struct.task_struct = type opaque
define void @proc_flush_task(%struct.task_struct* nocapture %0) {
ret void
}
int is_numeric(char *str) {
  do {
    if (!(*str >= '0' && *str <= '9')) {
      return 0;
    }
    str++;
  } while (*str);
  return 1;
}


x86 assembly (clang, -O0):
<is_numeric>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     1128 <is_numeric+0x28>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jle    1134 <is_numeric+0x34>
movl   $0x0,-0x4(%rbp)
jmp    1154 <is_numeric+0x54>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1108 <is_numeric+0x8>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_numeric>:
mov    (%rdi),%al
add    $0x1,%rdi
cs nopw 0x0(%rax,%rax,1)
add    $0xd0,%al
cmp    $0x9,%al
ja     1127 <is_numeric+0x27>
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <is_numeric+0x10>
mov    $0x1,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @is_numeric(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
br label %4
4: ; preds = %18, %1
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp sge i32 %7, 48
br i1 %8, label %9, label %14
9: ; preds = %4
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp sle i32 %12, 57
br i1 %13, label %15, label %14
14: ; preds = %9, %4
store i32 0, i32* %2
br label %23
15: ; preds = %9
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %3
br label %18
18: ; preds = %15
%19 = load i8*, i8** %3
%20 = load i8, i8* %19
%21 = icmp ne i8 %20, 0
br i1 %21, label %4, label %22
22: ; preds = %18
store i32 1, i32* %2
br label %23
23: ; preds = %22, %14
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @is_numeric(i8* nocapture %0) {
%2 = load i8, i8* %0
br label %3
3: ; preds = %8, %1
%4 = phi i8 [ %2, %1 ], [ %10, %8 ]
%5 = phi i8* [ %0, %1 ], [ %9, %8 ]
%6 = add i8 %4, -48
%7 = icmp ult i8 %6, 10
br i1 %7, label %8, label %12
8: ; preds = %3
%9 = getelementptr inbounds i8, i8* %5, i64 1
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %3
12: ; preds = %8, %3
%13 = phi i32 [ 0, %3 ], [ 1, %8 ]
ret i32 %13
}
wm_nciadc() {}


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

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

LLVM IR (-O0):
define i32 @wm_nciadc() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @wm_nciadc() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ sendByte(int);
void endTransmission() {
  for (int i = 0; i < 4; i++) {
    sendByte(255);
  }
}


x86 assembly (clang, -O0):
<endTransmission>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x4,-0x4(%rbp)
jge    1141 <endTransmission+0x31>
mov    $0xff,%edi
call   1030 <sendByte@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <endTransmission+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<endTransmission>:
push   %rax
mov    $0xff,%edi
call   1030 <sendByte@plt>
mov    $0xff,%edi
call   1030 <sendByte@plt>
mov    $0xff,%edi
call   1030 <sendByte@plt>
mov    $0xff,%edi
pop    %rax
jmp    1030 <sendByte@plt>

LLVM IR (-O0):
define void @endTransmission() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %7, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 4
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = call i32 @sendByte(i32 255)
br label %7
7: ; preds = %5
%8 = load i32, i32* %1
%9 = add nsw i32 %8, 1
store i32 %9, i32* %1
br label %2
10: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @endTransmission() {
%1 = tail call i32 @sendByte(i32 255)
%2 = tail call i32 @sendByte(i32 255)
%3 = tail call i32 @sendByte(i32 255)
%4 = tail call i32 @sendByte(i32 255)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ F_WRLCK;
int /*<<< orphan*/ gt_xflock_with_op(int, int /*<<< orphan*/);
void gt_xflock_exclusive(int fd) { gt_xflock_with_op(fd, F_WRLCK); }


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

x86 assembly (clang, -O2):
<gt_xflock_exclusive>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
jmp    1030 <gt_xflock_with_op@plt>

LLVM IR (-O0):
@F_WRLCK = global i32 0
define void @gt_xflock_exclusive(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @F_WRLCK
%5 = call i32 @gt_xflock_with_op(i32 %3, i32 %4)
ret void
}

LLVM IR (-O2):
@F_WRLCK = global i32 0
define void @gt_xflock_exclusive(i32 %0) {
%2 = load i32, i32* @F_WRLCK
%3 = tail call i32 @gt_xflock_with_op(i32 %0, i32 %2)
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ prg8setBank2(int);
void vrc7setParams9000(uint16_t addr, uint8_t val) {
  (void)addr;
  prg8setBank2((val & 0x3F) << 13);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
and    $0x3f,%edi
shl    $0xd,%edi
call   1030 <prg8setBank2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    %esi,%edi
and    $0x3f,%edi
shl    $0xd,%edi
jmp    1030 <prg8setBank2@plt>

LLVM IR (-O0):
define void @vrc7setParams9000(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 = and i32 %6, 63
%8 = shl i32 %7, 13
%9 = call i32 @prg8setBank2(i32 %8)
ret void
}

LLVM IR (-O2):
define void @vrc7setParams9000(i32 %0, i32 %1) {
%3 = shl i32 %1, 13
%4 = and i32 %3, 516096
%5 = tail call i32 @prg8setBank2(i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int m = 0, n = 0, a = 0, b = 0, c = 0, d = 0;
  int temp;
  temp = (m = a == b) || (n = c == d);
  printf("m=%d\nn=%d", m, n);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
sete   %cl
mov    %cl,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
mov    $0x1,%al
test   $0x1,%cl
mov    %al,-0x21(%rbp)
jne    1181 <main+0x71>
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
sete   %al
mov    %al,%cl
and    $0x1,%cl
movzbl %cl,%ecx
mov    %ecx,-0xc(%rbp)
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe67(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [10 x i8] c"m=%d\0An=%d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 1, i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ccvt_420p(int, int, unsigned char const *, unsigned char *,
                             int);
void ccvt_420p_rgb32(int width, int height, const void *src, void *dst) {
  ccvt_420p(width, height, (const unsigned char *)src, (unsigned char *)dst, 3);
}


x86 assembly (clang, -O0):
<ccvt_420p_rgb32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x3,%r8d
call   1030 <ccvt_420p@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ccvt_420p_rgb32>:
mov    $0x3,%r8d
jmp    1030 <ccvt_420p@plt>

LLVM IR (-O0):
define void @ccvt_420p_rgb32(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = load i8*, i8** %7
%12 = load i8*, i8** %8
%13 = call i32 @ccvt_420p(i32 %9, i32 %10, i8* %11, i8* %12, i32 3)
ret void
}

LLVM IR (-O2):
define void @ccvt_420p_rgb32(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = tail call i32 @ccvt_420p(i32 %0, i32 %1, i8* %2, i8* %3, i32 3)
ret void
}
/* Variables and functions */
int _pico_strchcount(char *str, int ch) {
  int count = 0;
  while (*str++)
    if (*str == ch) {
      count++;
    }
  return count;
}


x86 assembly (clang, -O0):
<_pico_strchcount>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
je     1148 <_pico_strchcount+0x48>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    -0xc(%rbp),%eax
jne    1143 <_pico_strchcount+0x43>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <_pico_strchcount+0x12>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_pico_strchcount>:
cmpb   $0x0,(%rdi)
je     1125 <_pico_strchcount+0x25>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
movsbl (%rdi),%ecx
xor    %edx,%edx
cmp    %esi,%ecx
sete   %dl
add    %edx,%eax
add    $0x1,%rdi
test   %ecx,%ecx
jne    1110 <_pico_strchcount+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @_pico_strchcount(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* [ %8, %5 ], [ %0, %2 ]
%7 = phi i32 [ %13, %5 ], [ 0, %2 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, %1
%12 = zext i1 %11 to i32
%13 = add nuw nsw i32 %7, %12
%14 = icmp eq i8 %9, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i32 [ 0, %2 ], [ %13, %5 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
int printf_char(char c, int width) {
  int i;
  for (i = 1; i < width; i++) {
    putchar(' ');
  }
  putchar(c);
  return width;
}


x86 assembly (clang, -O0):
<printf_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    114c <printf_char+0x3c>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1128 <printf_char+0x18>
movsbl -0x1(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printf_char>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%r14d
cmp    $0x2,%esi
jl     113f <printf_char+0x2f>
lea    -0x1(%rbx),%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1130 <printf_char+0x20>
movsbl %r14b,%edi
call   1030 <putchar@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @printf_char(i8 signext %0, i32 returned %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %4, label %9
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ 1, %2 ]
%6 = tail call i32 @putchar(i8 signext 32)
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, %1
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = tail call i32 @putchar(i8 signext %0)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ set_size(int /*<<< orphan*/);
void size0(void) { set_size(0); }


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

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

LLVM IR (-O0):
define void @size0() {
%1 = call i32 @set_size(i32 0)
ret void
}

LLVM IR (-O2):
define void @size0() {
%1 = tail call i32 @set_size(i32 0)
ret void
}
int test_imm_22uint8_mem(unsigned char *val) {
  return ((*val) & (-0x22 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_22uint8_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, -34
%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_22uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -34
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ logger(char *);
char *msg_err(char *, int /*<<< orphan*/);
int /*<<< orphan*/ unlink(char *);
void remove_log_file() {
  if (!unlink("/var/log/ledaemon.log"))
    logger("Success!");
  else
    logger(msg_err("Error", errno));
}


x86 assembly (clang, -O0):
<remove_log_file>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1030 <unlink@plt>
cmp    $0x0,%eax
jne    115a <remove_log_file+0x2a>
lea    0xec6(%rip),%rdi
call   1040 <logger@plt>
jmp    1177 <remove_log_file+0x47>
mov    0x2e7f(%rip),%rax
mov    (%rax),%esi
lea    0xeb5(%rip),%rdi
call   1050 <msg_err@plt>
mov    %rax,%rdi
call   1040 <logger@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_log_file>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <unlink@plt>
test   %eax,%eax
je     115f <remove_log_file+0x2f>
mov    0x2e98(%rip),%rax
mov    (%rax),%esi
lea    0xece(%rip),%rdi
call   1050 <msg_err@plt>
mov    %rax,%rdi
pop    %rax
jmp    1040 <logger@plt>
lea    0xeb0(%rip),%rdi
pop    %rax
jmp    1040 <logger@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"/var/log/ledaemon.log\00"
@.str.1 = [9 x i8] c"Success!\00"
@.str.2 = [6 x i8] c"Error\00"
@errno = global i32 0
define void @remove_log_file() {
%1 = call i32 @unlink(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%2 = icmp ne i32 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = call i32 @logger(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %9
5: ; preds = %0
%6 = load i32, i32* @errno
%7 = call i8* @msg_err(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = call i32 @logger(i8* %7)
br label %9
9: ; preds = %5, %3
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"/var/log/ledaemon.log\00"
@.str.1 = [9 x i8] c"Success!\00"
@.str.2 = [6 x i8] c"Error\00"
@errno = global i32 0
define void @remove_log_file() {
%1 = tail call i32 @unlink(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = load i32, i32* @errno
%5 = tail call i8* @msg_err(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %4)
br label %6
6: ; preds = %0, %3
%7 = phi i8* [ %5, %3 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), %0 ]
%8 = tail call i32 @logger(i8* %7)
ret void
}
void foo(void) { ; }


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

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

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

LLVM IR (-O2):
define void @foo() {
ret void
}
int test_imm_7Eint64_lowword_mem(long long *val) {
  return ((*val) & (0x7E << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_7Eint64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 126
%6 = icmp ne i64 %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_7Eint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 126
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t null_getcurrentsubchannel(uint8_t id, uint8_t *b, int msf) {
  return (0x13);
}


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

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

LLVM IR (-O0):
define i32 @null_getcurrentsubchannel(i32 %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32 %2, i32* %6
ret i32 19
}

LLVM IR (-O2):
define i32 @null_getcurrentsubchannel(i32 %0, i32* nocapture readnone %1, i32 %2) {
ret i32 19
}
int AVI1() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @AVI1() {
ret i32 0
}
R0R1(r0, r1, x0, x1, p0, p1) float r0, r1;
float *p0, *p1;
{ r0 = r1; }


x86 assembly (clang, -O0):
<R0R1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm1,-0x30(%rbp)
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
cvtsd2ss %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm0
movss  %xmm1,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @R0R1(double %0, double %1, i32 %2, i32 %3, float* %4, float* %5) {
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca i32
%12 = alloca float*
%13 = alloca float*
%14 = fptrunc double %0 to float
%15 = fptrunc double %1 to float
store float %14, float* %8
store float %15, float* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store float* %4, float** %12
store float* %5, float** %13
%16 = load float, float* %9
store float %16, float* %8
%17 = load i32, i32* %7
ret i32 %17
}

LLVM IR (-O2):
define i32 @R0R1(double %0, double %1, i32 %2, i32 %3, float* nocapture readnone %4, float* nocapture readnone %5) {
ret i32 undef
}
__float128 f128_sub(__float128 a, __float128 b) { return a - b; }


x86 assembly (clang, -O0):
<f128_sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movaps %xmm0,-0x10(%rbp)
movaps %xmm1,-0x20(%rbp)
movaps -0x10(%rbp),%xmm0
movaps -0x20(%rbp),%xmm1
call   1130 <__subtf3>
add    $0x20,%rsp
pop    %rbp
ret
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)

x86 assembly (clang, -O2):
<f128_sub>:
jmp    1110 <__subtf3>
cs nopw 0x0(%rax,%rax,1)
nop

LLVM IR (-O0):
define fp128 @f128_sub(fp128 %0, fp128 %1) {
%3 = alloca fp128
%4 = alloca fp128
store fp128 %0, fp128* %3
store fp128 %1, fp128* %4
%5 = load fp128, fp128* %3
%6 = load fp128, fp128* %4
%7 = fsub fp128 %5, %6
ret fp128 %7
}

LLVM IR (-O2):
define fp128 @f128_sub(fp128 %0, fp128 %1) {
%3 = fsub fp128 %0, %1
ret fp128 %3
}
int funcion_i_i(int x) {
  int e;
  e = 70 + 322 - 123123 * 332;
}


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

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

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

LLVM IR (-O2):
define i32 @funcion_i_i(i32 %0) {
ret i32 undef
}
unsigned int timer_stop() {
  ((*((volatile unsigned long *)(0xFFD80004))) =
       ((*((volatile unsigned long *)(0xFFD80004))) & (~(1 << 2))));
  return (*((volatile unsigned long *)((0xFFD8000C + (2 * 12)))));
}


x86 assembly (clang, -O0):
<timer_stop>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffd80004,%eax
mov    (%rax),%rcx
and    $0xfffffffffffffffb,%rcx
mov    $0xffd80004,%eax
mov    %rcx,(%rax)
mov    $0xffd80024,%eax
mov    (%rax),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<timer_stop>:
mov    $0xffd80004,%eax
andq   $0xfffffffffffffffb,(%rax)
mov    0x20(%rax),%rax
ret

LLVM IR (-O0):
define i32 @timer_stop() {
%1 = load volatile i64, i64* inttoptr (i64 4292345860 to i64*)
%2 = and i64 %1, -5
store volatile i64 %2, i64* inttoptr (i64 4292345860 to i64*)
%3 = load volatile i64, i64* inttoptr (i64 4292345892 to i64*)
%4 = trunc i64 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @timer_stop() {
%1 = load volatile i64, i64* inttoptr (i64 4292345860 to i64*)
%2 = and i64 %1, -5
store volatile i64 %2, i64* inttoptr (i64 4292345860 to i64*)
%3 = load volatile i64, i64* inttoptr (i64 4292345892 to i64*)
%4 = trunc i64 %3 to i32
ret i32 %4
}
void foo_1_1_1_2_2_2_1_1_2() {}


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

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

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

LLVM IR (-O2):
define void @foo_1_1_1_2_2_2_1_1_2() {
ret void
}
/* Variables and functions */
char *strrchr(char *, char);
char *file_type(char *f) {
  char *cp;
  if ((cp = strrchr(f, '.')) != NULL)
    return cp + 1;
  return "";
}


x86 assembly (clang, -O0):
<file_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1149 <file_type+0x39>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1154 <file_type+0x44>
lea    0xeb0(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_type>:
push   %rax
mov    $0x2e,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
lea    0xed7(%rip),%rax
cmovne %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @file_type(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @strrchr(i8* %5, i8 signext 46)
store i8* %6, i8** %4
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %4
%10 = getelementptr inbounds i8, i8* %9, i64 1
store i8* %10, i8** %2
br label %12
11: ; preds = %1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %2
br label %12
12: ; preds = %11, %8
%13 = load i8*, i8** %2
ret i8* %13
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @file_type(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 46)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %4
ret i8* %5
}
int isCarry(unsigned long op1, unsigned long op2, unsigned C) {
  if ((op2 == 0xFFFFFFFF) && (C == 1))
    return 1;
  return ((op1 > (0xFFFFFFFF - op2 - C)) ? 1 : 0);
}


x86 assembly (clang, -O0):
<isCarry>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    $0xffffffff,%eax
cmp    %rax,-0x18(%rbp)
jne    1134 <isCarry+0x34>
cmpl   $0x1,-0x1c(%rbp)
jne    1134 <isCarry+0x34>
movl   $0x1,-0x4(%rbp)
jmp    1157 <isCarry+0x57>
mov    -0x10(%rbp),%rdx
mov    $0xffffffff,%esi
sub    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%eax
sub    %rax,%rsi
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %rsi,%rdx
cmova  %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isCarry>:
mov    $0xffffffff,%eax
cmp    %rax,%rsi
sete   %r8b
cmp    $0x1,%edx
sete   %cl
and    %r8b,%cl
mov    %edx,%edx
add    %rsi,%rdx
sub    %rdx,%rax
cmp    %rdi,%rax
setb   %al
or     %cl,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @isCarry(i64 %0, i64 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32
store i64 %0, i64* %5
store i64 %1, i64* %6
store i32 %2, i32* %7
%8 = load i64, i64* %6
%9 = icmp eq i64 %8, 4294967295
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = load i32, i32* %7
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 1, i32* %4
br label %24
14: ; preds = %10, %3
%15 = load i64, i64* %5
%16 = load i64, i64* %6
%17 = sub i64 4294967295, %16
%18 = load i32, i32* %7
%19 = zext i32 %18 to i64
%20 = sub i64 %17, %19
%21 = icmp ugt i64 %15, %20
%22 = zext i1 %21 to i64
%23 = select i1 %21, i32 1, i32 0
store i32 %23, i32* %4
br label %24
24: ; preds = %14, %13
%25 = load i32, i32* %4
ret i32 %25
}

LLVM IR (-O2):
define i32 @isCarry(i64 %0, i64 %1, i32 %2) {
%4 = icmp eq i64 %1, 4294967295
%5 = icmp eq i32 %2, 1
%6 = and i1 %4, %5
%7 = zext i32 %2 to i64
%8 = add i64 %7, %1
%9 = sub i64 4294967295, %8
%10 = icmp ult i64 %9, %0
%11 = or i1 %6, %10
%12 = zext i1 %11 to i32
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ do_read_status_reg(int);
uint8_t flash_read_status(int fd) { return do_read_status_reg(fd); }


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

x86 assembly (clang, -O2):
<flash_read_status>:
jmp    1030 <do_read_status_reg@plt>

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

LLVM IR (-O2):
define i32 @flash_read_status(i32 %0) {
%2 = tail call i32 @do_read_status_reg(i32 %0)
ret i32 %2
}
double gen_random(double max) {
  static long last = 42;
  return max * (last = (last * 3877 + 29573) % 139968) / 139968;
}


x86 assembly (clang, -O0):
<gen_random>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
imul   $0xf25,0x2f07(%rip),%rax
add    $0x7385,%rax
mov    $0x222c0,%ecx
cqto
idiv   %rcx
mov    %rdx,0x2ef0(%rip)
cvtsi2sd %rdx,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xebf(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_random>:
imul   $0xf25,0x2f15(%rip),%rcx
add    $0x7385,%rcx
movabs $0x3beead01fd6cbe91,%rdx
ad ee 3b
mov    %rcx,%rax
imul   %rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0xf,%rdx
add    %rax,%rdx
imul   $0x222c0,%rdx,%rax
sub    %rax,%rcx
cvtsi2sd %rcx,%xmm1
mov    %rcx,0x2eda(%rip)
mulsd  %xmm1,%xmm0
divsd  0xeae(%rip),%xmm0
ret

LLVM IR (-O0):
@gen_random.last = internal global i64 42
define double @gen_random(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load i64, i64* @gen_random.last
%5 = mul nsw i64 %4, 3877
%6 = add nsw i64 %5, 29573
%7 = srem i64 %6, 139968
store i64 %7, i64* @gen_random.last
%8 = sitofp i64 %7 to double
%9 = fmul double %3, %8
%10 = fdiv double %9, 1.399680e+05
ret double %10
}

LLVM IR (-O2):
@gen_random.last = internal unnamed_addr global i64 42
define double @gen_random(double %0) {
%2 = load i64, i64* @gen_random.last
%3 = mul nsw i64 %2, 3877
%4 = add nsw i64 %3, 29573
%5 = srem i64 %4, 139968
store i64 %5, i64* @gen_random.last
%6 = sitofp i64 %5 to double
%7 = fmul double %6, %0
%8 = fdiv double %7, 1.399680e+05
ret double %8
}
/* Variables and functions */
unsigned int sqrt(unsigned int);
int isPrimeCal(unsigned int num) {
  unsigned int i;
  for (i = 2; i <= sqrt(num); i++) {
    if (num % i == 0)
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<isPrimeCal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <sqrt@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
ja     116d <isPrimeCal+0x5d>
mov    -0x8(%rbp),%eax
xor    %edx,%edx
divl   -0xc(%rbp)
cmp    $0x0,%edx
jne    115a <isPrimeCal+0x4a>
movl   $0x0,-0x4(%rbp)
jmp    1174 <isPrimeCal+0x64>
jmp    115f <isPrimeCal+0x4f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1122 <isPrimeCal+0x12>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPrimeCal>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
call   1030 <sqrt@plt>
cmp    $0x2,%eax
jb     114a <isPrimeCal+0x3a>
mov    $0x2,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %ecx,%ecx
mov    %ebx,%eax
xor    %edx,%edx
div    %ebp
test   %edx,%edx
je     114f <isPrimeCal+0x3f>
add    $0x1,%ebp
mov    %ebx,%edi
call   1030 <sqrt@plt>
cmp    %eax,%ebp
jbe    1130 <isPrimeCal+0x20>
mov    $0x1,%ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @isPrimeCal(i32 %0) {
%2 = tail call i32 @sqrt(i32 %0)
%3 = icmp ult i32 %2, 2
br i1 %3, label %12, label %7
4: ; preds = %7
%5 = tail call i32 @sqrt(i32 %0)
%6 = icmp ugt i32 %11, %5
br i1 %6, label %12, label %7
7: ; preds = %1, %4
%8 = phi i32 [ %11, %4 ], [ 2, %1 ]
%9 = urem i32 %0, %8
%10 = icmp eq i32 %9, 0
%11 = add i32 %8, 1
br i1 %10, label %12, label %4
12: ; preds = %7, %4, %1
%13 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %7 ]
ret i32 %13
}
/* Type definitions */
struct fsm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fsm_complement(int /*<<< orphan*/);
int /*<<< orphan*/ fsm_compose(int /*<<< orphan*/, struct fsm *);
int /*<<< orphan*/ fsm_copy(struct fsm *);
int /*<<< orphan*/ fsm_extract_ambiguous_domain(int /*<<< orphan*/);
int /*<<< orphan*/ fsm_minimize(int /*<<< orphan*/);
struct fsm *fsm_topsort(int /*<<< orphan*/);
struct fsm *fsm_extract_unambiguous(struct fsm *net) {
  struct fsm *result;
  result = fsm_topsort(fsm_minimize(fsm_compose(
      fsm_complement(fsm_extract_ambiguous_domain(fsm_copy(net))), net)));
  return (result);
}


x86 assembly (clang, -O0):
<fsm_extract_unambiguous>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <fsm_copy@plt>
mov    %eax,%edi
call   1060 <fsm_extract_ambiguous_domain@plt>
mov    %eax,%edi
call   1040 <fsm_complement@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%rsi
call   1080 <fsm_compose@plt>
mov    %eax,%edi
call   1030 <fsm_minimize@plt>
mov    %eax,%edi
call   1070 <fsm_topsort@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fsm_extract_unambiguous>:
push   %rbx
mov    %rdi,%rbx
call   1050 <fsm_copy@plt>
mov    %eax,%edi
call   1060 <fsm_extract_ambiguous_domain@plt>
mov    %eax,%edi
call   1040 <fsm_complement@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1080 <fsm_compose@plt>
mov    %eax,%edi
call   1030 <fsm_minimize@plt>
mov    %eax,%edi
pop    %rbx
jmp    1070 <fsm_topsort@plt>

LLVM IR (-O0):
%struct.fsm = type { i32 }
define %struct.fsm* @fsm_extract_unambiguous(%struct.fsm* %0) {
%2 = alloca %struct.fsm*
%3 = alloca %struct.fsm*
store %struct.fsm* %0, %struct.fsm** %2
%4 = load %struct.fsm*, %struct.fsm** %2
%5 = call i32 @fsm_copy(%struct.fsm* %4)
%6 = call i32 @fsm_extract_ambiguous_domain(i32 %5)
%7 = call i32 @fsm_complement(i32 %6)
%8 = load %struct.fsm*, %struct.fsm** %2
%9 = call i32 @fsm_compose(i32 %7, %struct.fsm* %8)
%10 = call i32 @fsm_minimize(i32 %9)
%11 = call %struct.fsm* @fsm_topsort(i32 %10)
store %struct.fsm* %11, %struct.fsm** %3
%12 = load %struct.fsm*, %struct.fsm** %3
ret %struct.fsm* %12
}

LLVM IR (-O2):
%struct.fsm = type { i32 }
define %struct.fsm* @fsm_extract_unambiguous(%struct.fsm* %0) {
%2 = tail call i32 @fsm_copy(%struct.fsm* %0)
%3 = tail call i32 @fsm_extract_ambiguous_domain(i32 %2)
%4 = tail call i32 @fsm_complement(i32 %3)
%5 = tail call i32 @fsm_compose(i32 %4, %struct.fsm* %0)
%6 = tail call i32 @fsm_minimize(i32 %5)
%7 = tail call %struct.fsm* @fsm_topsort(i32 %6)
ret %struct.fsm* %7
}
int atoi(char *s) {
  int res = 0, i;
  for (i = 0; *(s + i) != '\0'; i++)
    res = res * 10 + *(s + i) - '\0';
  return res;
}


x86 assembly (clang, -O0):
<atoi>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1151 <atoi+0x51>
imul   $0xa,-0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
movslq -0x10(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
sub    $0x0,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1116 <atoi+0x16>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<atoi>:
mov    (%rdi),%cl
test   %cl,%cl
je     1125 <atoi+0x25>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
lea    (%rax,%rax,4),%eax
lea    (%rcx,%rax,2),%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <atoi+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @atoi(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %11, %4 ], [ 0, %1 ]
%6 = phi i8 [ %13, %4 ], [ %2, %1 ]
%7 = phi i32 [ %10, %4 ], [ 0, %1 ]
%8 = sext i8 %6 to i32
%9 = mul nsw i32 %7, 10
%10 = add nsw i32 %9, %8
%11 = add nuw nsw i64 %5, 1
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %4, %1
%16 = phi i32 [ 0, %1 ], [ %10, %4 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void yajl_internal_free(void *ctx, void *ptr) { free(ptr); }


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

x86 assembly (clang, -O2):
<yajl_internal_free>:
mov    %rsi,%rdi
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @yajl_internal_free(i8* nocapture readnone %0, i8* nocapture %1) {
%3 = tail call i32 @free(i8* %1)
ret void
}
int test_imm_D0uint16_reg(unsigned short val) {
  return ((val) & (0xD0 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_D0uint16_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, 208
%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_D0uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 208
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int gettimeofday(struct timeval *p, struct timezone *z) { return -1; }


x86 assembly (clang, -O0):
<gettimeofday>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.timeval = type opaque
%struct.timezone = type opaque
define i32 @gettimeofday(%struct.timeval* %0, %struct.timezone* %1) {
%3 = alloca %struct.timeval*
%4 = alloca %struct.timezone*
store %struct.timeval* %0, %struct.timeval** %3
store %struct.timezone* %1, %struct.timezone** %4
ret i32 -1
}

LLVM IR (-O2):
%struct.timeval = type opaque
%struct.timezone = type opaque
define i32 @gettimeofday(%struct.timeval* nocapture readnone %0, %struct.timezone* nocapture readnone %1) {
ret i32 -1
}