#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ miller_rabin_size_t(size_t);
size_t miller_rabin_next_prime_size_t(size_t n) {
  if (n < 2) {
    return 2;
  }
  n |= 1UL;
  while (!miller_rabin_size_t(n)) {
    if (n == ~0UL) {
      return 0;
    }
    n += 2;
  }
  return n;
}


x86 assembly (clang, -O0):
<miller_rabin_next_prime_size_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x2,-0x10(%rbp)
jae    1134 <miller_rabin_next_prime_size_t+0x24>
movq   $0x2,-0x8(%rbp)
jmp    118f <miller_rabin_next_prime_size_t+0x7f>
mov    -0x10(%rbp),%rax
or     $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <miller_rabin_size_t@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    115e <miller_rabin_next_prime_size_t+0x4e>
jmp    1187 <miller_rabin_next_prime_size_t+0x77>
cmpq   $0xffffffffffffffff,-0x10(%rbp)
jne    1176 <miller_rabin_next_prime_size_t+0x66>
movq   $0x0,-0x8(%rbp)
jmp    118f <miller_rabin_next_prime_size_t+0x7f>
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
jmp    1140 <miller_rabin_next_prime_size_t+0x30>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<miller_rabin_next_prime_size_t>:
push   %r14
push   %rbx
push   %rax
mov    $0x2,%r14d
cmp    $0x2,%rdi
jb     115d <miller_rabin_next_prime_size_t+0x4d>
mov    %rdi,%rbx
or     $0x1,%rbx
mov    %rbx,%rdi
call   1030 <miller_rabin_size_t@plt>
test   %eax,%eax
jne    115a <miller_rabin_next_prime_size_t+0x4a>
add    $0x2,%rbx
xor    %r14d,%r14d
nopw   0x0(%rax,%rax,1)
cmp    $0x1,%rbx
je     115d <miller_rabin_next_prime_size_t+0x4d>
mov    %rbx,%rdi
call   1030 <miller_rabin_size_t@plt>
add    $0x2,%rbx
test   %eax,%eax
je     1140 <miller_rabin_next_prime_size_t+0x30>
add    $0xfffffffffffffffe,%rbx
mov    %rbx,%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @miller_rabin_next_prime_size_t(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = icmp ult i64 %4, 2
br i1 %5, label %6, label %7
6: ; preds = %1
store i64 2, i64* %2
br label %24
7: ; preds = %1
%8 = load i64, i64* %3
%9 = or i64 %8, 1
store i64 %9, i64* %3
br label %10
10: ; preds = %19, %7
%11 = load i64, i64* %3
%12 = call i32 @miller_rabin_size_t(i64 %11)
%13 = icmp ne i32 %12, 0
%14 = xor i1 %13, true
br i1 %14, label %15, label %22
15: ; preds = %10
%16 = load i64, i64* %3
%17 = icmp eq i64 %16, -1
br i1 %17, label %18, label %19
18: ; preds = %15
store i64 0, i64* %2
br label %24
19: ; preds = %15
%20 = load i64, i64* %3
%21 = add i64 %20, 2
store i64 %21, i64* %3
br label %10
22: ; preds = %10
%23 = load i64, i64* %3
store i64 %23, i64* %2
br label %24
24: ; preds = %22, %18, %6
%25 = load i64, i64* %2
ret i64 %25
}

LLVM IR (-O2):
define i64 @miller_rabin_next_prime_size_t(i64 %0) {
%2 = icmp ult i64 %0, 2
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = or i64 %0, 1
%5 = tail call i32 @miller_rabin_size_t(i64 %4)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %3, %10
%8 = phi i64 [ %11, %10 ], [ %4, %3 ]
%9 = icmp eq i64 %8, -1
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = add i64 %8, 2
%12 = tail call i32 @miller_rabin_size_t(i64 %11)
%13 = icmp eq i32 %12, 0
br i1 %13, label %7, label %14
14: ; preds = %7, %10, %3, %1
%15 = phi i64 [ 2, %1 ], [ %4, %3 ], [ 0, %7 ], [ %11, %10 ]
ret i64 %15
}