#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 */
typedef scalar_t__ ssize_t;

/* Variables and functions */
int SIZE_MAX;
int /*<<< orphan*/ assert(int);
ssize_t min_buckets(ssize_t num_elts, ssize_t min_buckets_wanted) {
  assert(0 <= num_elts &&
         num_elts <= ((ssize_t)(((ssize_t)(((size_t)(SIZE_MAX / 2) + 1) >> 1)) *
                                (80 / 100.0))));
  assert(0 <= min_buckets_wanted &&
         min_buckets_wanted <= ((ssize_t)(((size_t)(SIZE_MAX / 2) + 1) >> 1)));
  double enlarge = (80 / 100.0);
  ssize_t sz = 4;
  while (sz < min_buckets_wanted || num_elts > (ssize_t)(sz * enlarge)) {
    assert(sz * 2 > sz);
    sz *= 2;
  }
  return sz;
}


x86 assembly (clang, -O0):
<min_buckets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
xor    %ecx,%ecx
cmp    -0x8(%rbp),%rcx
mov    %al,-0x21(%rbp)
jg     117a <min_buckets+0x6a>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    0x2e98(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
add    $0x1,%rcx
shr    $0x1,%rcx
cvtsi2sd %rcx,%xmm0
movsd  0xe98(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rcx
cmp    %rcx,%rax
setle  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
xor    %ecx,%ecx
cmp    -0x10(%rbp),%rcx
mov    %al,-0x31(%rbp)
jg     11cb <min_buckets+0xbb>
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    0x2e31(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x40(%rbp),%rax
movslq %ecx,%rcx
add    $0x1,%rcx
shr    $0x1,%rcx
cmp    %rcx,%rax
setle  %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  0xe20(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movq   $0x4,-0x20(%rbp)
mov    -0x20(%rbp),%rcx
mov    $0x1,%al
cmp    -0x10(%rbp),%rcx
mov    %al,-0x41(%rbp)
jl     121d <min_buckets+0x10d>
mov    -0x8(%rbp),%rax
cvtsi2sdq -0x20(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%rcx
cmp    %rcx,%rax
setg   %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
test   $0x1,%al
jne    122d <min_buckets+0x11d>
jmp    1257 <min_buckets+0x147>
mov    -0x20(%rbp),%rax
shl    $0x1,%rax
cmp    -0x20(%rbp),%rax
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x20(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11ed <min_buckets+0xdd>
mov    -0x20(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<min_buckets>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
test   %rdi,%rdi
js     1158 <min_buckets+0x48>
mov    0x2eb1(%rip),%rax
mov    (%rax),%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
add    $0x1,%ecx
movslq %ecx,%rax
shr    %rax
cvtsi2sd %rax,%xmm0
mulsd  0xeb8(%rip),%xmm0
cvttsd2si %xmm0,%rax
xor    %edi,%edi
cmp    %r14,%rax
setge  %dil
jmp    115a <min_buckets+0x4a>
xor    %edi,%edi
call   1030 <assert@plt>
test   %r15,%r15
js     1187 <min_buckets+0x77>
mov    0x2e6d(%rip),%rax
mov    (%rax),%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
add    $0x1,%ecx
movslq %ecx,%rax
shr    %rax
cmp    %r15,%rax
setae  %al
jmp    1189 <min_buckets+0x79>
xor    %eax,%eax
mov    $0x4,%ebx
jmp    119d <min_buckets+0x8d>
lea    (%rbx,%rbx,1),%rcx
cmp    %rbx,%rcx
setg   %al
mov    %rcx,%rbx
movzbl %al,%edi
and    $0x1,%edi
call   1030 <assert@plt>
cmp    %r15,%rbx
jl     1190 <min_buckets+0x80>
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
mulsd  0xe43(%rip),%xmm0
cvttsd2si %xmm0,%rax
cmp    %r14,%rax
jl     1190 <min_buckets+0x80>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@SIZE_MAX = global i32 0
define i64 @min_buckets(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca double
%6 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%7 = load i64, i64* %3
%8 = icmp sle i64 0, %7
br i1 %8, label %9, label %20
9: ; preds = %2
%10 = load i64, i64* %3
%11 = load i32, i32* @SIZE_MAX
%12 = sdiv i32 %11, 2
%13 = sext i32 %12 to i64
%14 = add i64 %13, 1
%15 = lshr i64 %14, 1
%16 = sitofp i64 %15 to double
%17 = fmul double %16, 8.000000e-01
%18 = fptosi double %17 to i64
%19 = icmp sle i64 %10, %18
br label %20
20: ; preds = %9, %2
%21 = phi i1 [ false, %2 ], [ %19, %9 ]
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
%24 = load i64, i64* %4
%25 = icmp sle i64 0, %24
br i1 %25, label %26, label %34
26: ; preds = %20
%27 = load i64, i64* %4
%28 = load i32, i32* @SIZE_MAX
%29 = sdiv i32 %28, 2
%30 = sext i32 %29 to i64
%31 = add i64 %30, 1
%32 = lshr i64 %31, 1
%33 = icmp sle i64 %27, %32
br label %34
34: ; preds = %26, %20
%35 = phi i1 [ false, %20 ], [ %33, %26 ]
%36 = zext i1 %35 to i32
%37 = call i32 @assert(i32 %36)
store double 8.000000e-01, double* %5
store i64 4, i64* %6
br label %38
38: ; preds = %52, %34
%39 = load i64, i64* %6
%40 = load i64, i64* %4
%41 = icmp slt i64 %39, %40
br i1 %41, label %50, label %42
42: ; preds = %38
%43 = load i64, i64* %3
%44 = load i64, i64* %6
%45 = sitofp i64 %44 to double
%46 = load double, double* %5
%47 = fmul double %45, %46
%48 = fptosi double %47 to i64
%49 = icmp sgt i64 %43, %48
br label %50
50: ; preds = %42, %38
%51 = phi i1 [ true, %38 ], [ %49, %42 ]
br i1 %51, label %52, label %61
52: ; preds = %50
%53 = load i64, i64* %6
%54 = mul nsw i64 %53, 2
%55 = load i64, i64* %6
%56 = icmp sgt i64 %54, %55
%57 = zext i1 %56 to i32
%58 = call i32 @assert(i32 %57)
%59 = load i64, i64* %6
%60 = mul nsw i64 %59, 2
store i64 %60, i64* %6
br label %38
61: ; preds = %50
%62 = load i64, i64* %6
ret i64 %62
}

LLVM IR (-O2):
@SIZE_MAX = global i32 0
define i64 @min_buckets(i64 %0, i64 %1) {
%3 = icmp sgt i64 %0, -1
br i1 %3, label %4, label %15
4: ; preds = %2
%5 = load i32, i32* @SIZE_MAX
%6 = sdiv i32 %5, 2
%7 = add nsw i32 %6, 1
%8 = sext i32 %7 to i64
%9 = lshr i64 %8, 1
%10 = sitofp i64 %9 to double
%11 = fmul double %10, 8.000000e-01
%12 = fptosi double %11 to i64
%13 = icmp sge i64 %12, %0
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %4, %2
%16 = phi i32 [ 0, %2 ], [ %14, %4 ]
%17 = tail call i32 @assert(i32 %16)
%18 = icmp sgt i64 %1, -1
br i1 %18, label %19, label %26
19: ; preds = %15
%20 = load i32, i32* @SIZE_MAX
%21 = sdiv i32 %20, 2
%22 = add nsw i32 %21, 1
%23 = sext i32 %22 to i64
%24 = lshr i64 %23, 1
%25 = icmp uge i64 %24, %1
br label %26
26: ; preds = %19, %15
%27 = phi i1 [ %25, %19 ], [ false, %15 ]
br label %28
28: ; preds = %26, %39
%29 = phi i1 [ %41, %39 ], [ %27, %26 ]
%30 = phi i64 [ %40, %39 ], [ 4, %26 ]
%31 = zext i1 %29 to i32
%32 = tail call i32 @assert(i32 %31)
%33 = icmp slt i64 %30, %1
br i1 %33, label %39, label %34
34: ; preds = %28
%35 = sitofp i64 %30 to double
%36 = fmul double %35, 8.000000e-01
%37 = fptosi double %36 to i64
%38 = icmp slt i64 %37, %0
br i1 %38, label %39, label %42
39: ; preds = %28, %34
%40 = shl nsw i64 %30, 1
%41 = icmp sgt i64 %40, %30
br label %28
42: ; preds = %34
ret i64 %30
}