#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 */
scalar_t__ ceil(double);
size_t sxbp_get_pbm_image_size(size_t width, size_t height,
                               size_t width_string_length,
                               size_t height_string_length,
                               size_t *bytes_per_row) {
  *bytes_per_row = (size_t)ceil((double)width / 8.0);
  size_t image_bytes = *bytes_per_row * height;
  return (3 + width_string_length + 1 + height_string_length + 1 + image_bytes);
}


x86 assembly (clang, -O0):
<sxbp_get_pbm_image_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movaps 0xedd(%rip),%xmm1
movq   -0x8(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xedc(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xea5(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <ceil@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
imul   -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
add    $0x3,%rax
add    $0x1,%rax
add    -0x20(%rbp),%rax
add    $0x1,%rax
add    -0x30(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sxbp_get_pbm_image_size>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %r8,%r15
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%rbx
movq   %rdi,%xmm1
punpckldq 0xecf(%rip),%xmm1
subpd  0xed7(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
mulsd  0xed3(%rip),%xmm0
call   1030 <ceil@plt>
mov    %rax,(%r15)
imul   %rax,%rbx
add    %r14,%r12
lea    (%rbx,%r12,1),%rax
add    $0x5,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @sxbp_get_pbm_image_size(i64 %0, i64 %1, i64 %2, i64 %3, i64* %4) {
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64*
%11 = alloca i64
store i64 %0, i64* %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i64* %4, i64** %10
%12 = load i64, i64* %6
%13 = uitofp i64 %12 to double
%14 = fdiv double %13, 8.000000e+00
%15 = call i64 @ceil(double %14)
%16 = load i64*, i64** %10
store i64 %15, i64* %16
%17 = load i64*, i64** %10
%18 = load i64, i64* %17
%19 = load i64, i64* %7
%20 = mul i64 %18, %19
store i64 %20, i64* %11
%21 = load i64, i64* %8
%22 = add i64 3, %21
%23 = add i64 %22, 1
%24 = load i64, i64* %9
%25 = add i64 %23, %24
%26 = add i64 %25, 1
%27 = load i64, i64* %11
%28 = add i64 %26, %27
ret i64 %28
}

LLVM IR (-O2):
define i64 @sxbp_get_pbm_image_size(i64 %0, i64 %1, i64 %2, i64 %3, i64* nocapture writeonly %4) {
%6 = uitofp i64 %0 to double
%7 = fmul double %6, 1.250000e-01
%8 = tail call i64 @ceil(double %7)
store i64 %8, i64* %4
%9 = mul i64 %8, %1
%10 = add i64 %2, 5
%11 = add i64 %10, %3
%12 = add i64 %11, %9
ret i64 %12
}