#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 */
struct libdeflate_compressor {
  int dummy;
};
typedef int in_nbytes;

/* Variables and functions */
size_t libdeflate_deflate_compress_bound(struct libdeflate_compressor *c,
                                         size_t in_nbytes) {
  size_t max_num_blocks = (((((in_nbytes) + (10000) - 1) / (10000))) >= (1)
                               ? ((((in_nbytes) + (10000) - 1) / (10000)))
                               : (1));
  return (5 * max_num_blocks) + in_nbytes + 1 + 8;
}


x86 assembly (clang, -O0):
<libdeflate_deflate_compress_bound>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x2710,%rax
sub    $0x1,%rax
mov    $0x2710,%ecx
xor    %edx,%edx
div    %rcx
cmp    $0x1,%rax
jb     114f <libdeflate_deflate_compress_bound+0x4f>
mov    -0x10(%rbp),%rax
add    $0x2710,%rax
sub    $0x1,%rax
mov    $0x2710,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x20(%rbp)
jmp    115d <libdeflate_deflate_compress_bound+0x5d>
mov    $0x1,%eax
mov    %rax,-0x20(%rbp)
jmp    115d <libdeflate_deflate_compress_bound+0x5d>
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
imul   $0x5,-0x18(%rbp),%rax
add    -0x10(%rbp),%rax
add    $0x1,%rax
add    $0x8,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<libdeflate_deflate_compress_bound>:
lea    0x270f(%rsi),%rax
mov    $0x5,%ecx
cmp    $0x2710,%rax
jb     1129 <libdeflate_deflate_compress_bound+0x29>
movabs $0x346dc5d63886594b,%rcx
c5 6d 34
mul    %rcx
shr    $0xb,%rdx
lea    (%rdx,%rdx,4),%rcx
lea    (%rsi,%rcx,1),%rax
add    $0x9,%rax
ret

LLVM IR (-O0):
%struct.libdeflate_compressor = type { i32 }
define i64 @libdeflate_deflate_compress_bound(%struct.libdeflate_compressor* %0, i64 %1) {
%3 = alloca %struct.libdeflate_compressor*
%4 = alloca i64
%5 = alloca i64
store %struct.libdeflate_compressor* %0, %struct.libdeflate_compressor** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = add i64 %6, 10000
%8 = sub i64 %7, 1
%9 = udiv i64 %8, 10000
%10 = icmp uge i64 %9, 1
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i64, i64* %4
%13 = add i64 %12, 10000
%14 = sub i64 %13, 1
%15 = udiv i64 %14, 10000
br label %17
16: ; preds = %2
br label %17
17: ; preds = %16, %11
%18 = phi i64 [ %15, %11 ], [ 1, %16 ]
store i64 %18, i64* %5
%19 = load i64, i64* %5
%20 = mul i64 5, %19
%21 = load i64, i64* %4
%22 = add i64 %20, %21
%23 = add i64 %22, 1
%24 = add i64 %23, 8
ret i64 %24
}

LLVM IR (-O2):
%struct.libdeflate_compressor = type { i32 }
define i64 @libdeflate_deflate_compress_bound(%struct.libdeflate_compressor* nocapture readnone %0, i64 %1) {
%3 = add i64 %1, 9999
%4 = icmp ult i64 %3, 10000
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = udiv i64 %3, 10000
%7 = mul nuw nsw i64 %6, 5
br label %8
8: ; preds = %2, %5
%9 = phi i64 [ %7, %5 ], [ 5, %2 ]
%10 = add i64 %1, 9
%11 = add i64 %10, %9
ret i64 %11
}