#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);
int *divideRectangle(int, int, int, int, int, int);
scalar_t__ round(int /*<<< orphan*/);
int /*<<< orphan*/ sqrt(double);
int *divideRectangle_favorHeight(int areaWidth, int areaHeight, int number,
                                 int gutter) {
  int columns, rows;
  rows = (int)round(sqrt((double)number));
  columns = (int)ceil((double)number / rows);
  return divideRectangle(areaWidth, areaHeight, columns, rows, number, gutter);
}


x86 assembly (clang, -O0):
<divideRectangle_favorHeight>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
call   1060 <sqrt@plt>
mov    %eax,%edi
call   1050 <round@plt>
mov    %eax,-0x18(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
cvtsi2sdl -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1030 <ceil@plt>
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0xc(%rbp),%r8d
mov    -0x10(%rbp),%r9d
call   1040 <divideRectangle@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<divideRectangle_favorHeight>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %esi,%r15d
mov    %edi,%r12d
cvtsi2sd %edx,%xmm0
movsd  %xmm0,0x8(%rsp)
call   1060 <sqrt@plt>
mov    %eax,%edi
call   1050 <round@plt>
mov    %rax,%rbx
cvtsi2sd %ebx,%xmm1
movsd  0x8(%rsp),%xmm0
divsd  %xmm1,%xmm0
call   1030 <ceil@plt>
mov    %r12d,%edi
mov    %r15d,%esi
mov    %eax,%edx
mov    %ebx,%ecx
mov    %ebp,%r8d
mov    %r14d,%r9d
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <divideRectangle@plt>

LLVM IR (-O0):
define i32* @divideRectangle_favorHeight(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %7
%12 = sitofp i32 %11 to double
%13 = call i32 @sqrt(double %12)
%14 = call i64 @round(i32 %13)
%15 = trunc i64 %14 to i32
store i32 %15, i32* %10
%16 = load i32, i32* %7
%17 = sitofp i32 %16 to double
%18 = load i32, i32* %10
%19 = sitofp i32 %18 to double
%20 = fdiv double %17, %19
%21 = call i64 @ceil(double %20)
%22 = trunc i64 %21 to i32
store i32 %22, i32* %9
%23 = load i32, i32* %5
%24 = load i32, i32* %6
%25 = load i32, i32* %9
%26 = load i32, i32* %10
%27 = load i32, i32* %7
%28 = load i32, i32* %8
%29 = call i32* @divideRectangle(i32 %23, i32 %24, i32 %25, i32 %26, i32 %27, i32 %28)
ret i32* %29
}

LLVM IR (-O2):
define i32* @divideRectangle_favorHeight(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = sitofp i32 %2 to double
%6 = tail call i32 @sqrt(double %5)
%7 = tail call i64 @round(i32 %6)
%8 = trunc i64 %7 to i32
%9 = sitofp i32 %8 to double
%10 = fdiv double %5, %9
%11 = tail call i64 @ceil(double %10)
%12 = trunc i64 %11 to i32
%13 = tail call i32* @divideRectangle(i32 %0, i32 %1, i32 %12, i32 %8, i32 %2, i32 %3)
ret i32* %13
}