#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*/ assert(int);
int GetWindowSizeForHashChain(int quality, int xsize) {
  const int max_window_size = (quality > 75)   ? ((1 << 20) - 120)
                              : (quality > 50) ? (xsize << 8)
                              : (quality > 25) ? (xsize << 6)
                                               : (xsize << 4);
  assert(xsize > 0);
  return (max_window_size > ((1 << 20) - 120)) ? ((1 << 20) - 120)
                                               : max_window_size;
}


x86 assembly (clang, -O0):
<GetWindowSizeForHashChain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x4b,-0x4(%rbp)
jle    1135 <GetWindowSizeForHashChain+0x25>
mov    $0xfff88,%eax
mov    %eax,-0x10(%rbp)
jmp    117a <GetWindowSizeForHashChain+0x6a>
cmpl   $0x32,-0x4(%rbp)
jle    114d <GetWindowSizeForHashChain+0x3d>
mov    -0x8(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x14(%rbp)
jmp    1174 <GetWindowSizeForHashChain+0x64>
cmpl   $0x19,-0x4(%rbp)
jle    1165 <GetWindowSizeForHashChain+0x55>
mov    -0x8(%rbp),%eax
shl    $0x6,%eax
mov    %eax,-0x18(%rbp)
jmp    116e <GetWindowSizeForHashChain+0x5e>
mov    -0x8(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0xfff88,-0xc(%rbp)
jle    11ab <GetWindowSizeForHashChain+0x9b>
mov    $0xfff88,%eax
mov    %eax,-0x1c(%rbp)
jmp    11b1 <GetWindowSizeForHashChain+0xa1>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetWindowSizeForHashChain>:
push   %rbp
push   %rbx
push   %rax
mov    $0xfff88,%ebx
mov    $0xfff88,%ebp
cmp    $0x4b,%edi
jg     113d <GetWindowSizeForHashChain+0x2d>
cmp    $0x33,%edi
jl     112e <GetWindowSizeForHashChain+0x1e>
mov    %esi,%ebp
shl    $0x8,%ebp
jmp    113d <GetWindowSizeForHashChain+0x2d>
cmp    $0x1a,%edi
setge  %cl
add    %cl,%cl
or     $0x4,%cl
mov    %esi,%ebp
shl    %cl,%ebp
xor    %edi,%edi
test   %esi,%esi
setg   %dil
call   1030 <assert@plt>
cmp    $0xfff88,%ebp
cmovl  %ebp,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @GetWindowSizeForHashChain(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = icmp sgt i32 %6, 75
br i1 %7, label %8, label %9
8: ; preds = %2
br label %28
9: ; preds = %2
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 50
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load i32, i32* %4
%14 = shl i32 %13, 8
br label %26
15: ; preds = %9
%16 = load i32, i32* %3
%17 = icmp sgt i32 %16, 25
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* %4
%20 = shl i32 %19, 6
br label %24
21: ; preds = %15
%22 = load i32, i32* %4
%23 = shl i32 %22, 4
br label %24
24: ; preds = %21, %18
%25 = phi i32 [ %20, %18 ], [ %23, %21 ]
br label %26
26: ; preds = %24, %12
%27 = phi i32 [ %14, %12 ], [ %25, %24 ]
br label %28
28: ; preds = %26, %8
%29 = phi i32 [ 1048456, %8 ], [ %27, %26 ]
store i32 %29, i32* %5
%30 = load i32, i32* %4
%31 = icmp sgt i32 %30, 0
%32 = zext i1 %31 to i32
%33 = call i32 @assert(i32 %32)
%34 = load i32, i32* %5
%35 = icmp sgt i32 %34, 1048456
br i1 %35, label %36, label %37
36: ; preds = %28
br label %39
37: ; preds = %28
%38 = load i32, i32* %5
br label %39
39: ; preds = %37, %36
%40 = phi i32 [ 1048456, %36 ], [ %38, %37 ]
ret i32 %40
}

LLVM IR (-O2):
define i32 @GetWindowSizeForHashChain(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, 75
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = icmp sgt i32 %0, 50
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = shl i32 %1, 8
br label %12
8: ; preds = %4
%9 = icmp sgt i32 %0, 25
%10 = select i1 %9, i32 6, i32 4
%11 = shl i32 %1, %10
br label %12
12: ; preds = %6, %8, %2
%13 = phi i32 [ 1048456, %2 ], [ %7, %6 ], [ %11, %8 ]
%14 = icmp sgt i32 %1, 0
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
%17 = icmp slt i32 %13, 1048456
%18 = select i1 %17, i32 %13, i32 1048456
ret i32 %18
}