#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 /*<<< orphan*/ sliceGaussianKernel(float *, int, float);
void scaledGaussianKernel(float *mat, int *dim, int limit, float sigma) {
  *dim = 2 * (int)ceil((double)sigma) + 1;
  *dim = ((limit) < (*dim) ? (limit) : (*dim));
  sliceGaussianKernel(mat, *dim, sigma);
}


x86 assembly (clang, -O0):
<scaledGaussianKernel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <ceil@plt>
mov    %eax,%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    116e <scaledGaussianKernel+0x4e>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1177 <scaledGaussianKernel+0x57>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
movss  -0x18(%rbp),%xmm0
call   1040 <sliceGaussianKernel@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scaledGaussianKernel>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movss  %xmm0,0xc(%rsp)
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%r15
cvtss2sd %xmm0,%xmm0
call   1030 <ceil@plt>
lea    (%rax,%rax,1),%esi
add    $0x1,%esi
cmp    %ebx,%esi
cmovg  %ebx,%esi
mov    %esi,(%r14)
mov    %r15,%rdi
movss  0xc(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <sliceGaussianKernel@plt>

LLVM IR (-O0):
define void @scaledGaussianKernel(float* %0, i32* %1, i32 %2, float %3) {
%5 = alloca float*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca float
store float* %0, float** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store float %3, float* %8
%9 = load float, float* %8
%10 = fpext float %9 to double
%11 = call i64 @ceil(double %10)
%12 = trunc i64 %11 to i32
%13 = mul nsw i32 2, %12
%14 = add nsw i32 %13, 1
%15 = load i32*, i32** %6
store i32 %14, i32* %15
%16 = load i32, i32* %7
%17 = load i32*, i32** %6
%18 = load i32, i32* %17
%19 = icmp slt i32 %16, %18
br i1 %19, label %20, label %22
20: ; preds = %4
%21 = load i32, i32* %7
br label %25
22: ; preds = %4
%23 = load i32*, i32** %6
%24 = load i32, i32* %23
br label %25
25: ; preds = %22, %20
%26 = phi i32 [ %21, %20 ], [ %24, %22 ]
%27 = load i32*, i32** %6
store i32 %26, i32* %27
%28 = load float*, float** %5
%29 = load i32*, i32** %6
%30 = load i32, i32* %29
%31 = load float, float* %8
%32 = call i32 @sliceGaussianKernel(float* %28, i32 %30, float %31)
ret void
}

LLVM IR (-O2):
define void @scaledGaussianKernel(float* %0, i32* nocapture writeonly %1, i32 %2, float %3) {
%5 = fpext float %3 to double
%6 = tail call i64 @ceil(double %5)
%7 = trunc i64 %6 to i32
%8 = shl nsw i32 %7, 1
%9 = or i32 %8, 1
%10 = icmp sgt i32 %9, %2
%11 = select i1 %10, i32 %2, i32 %9
store i32 %11, i32* %1
%12 = tail call i32 @sliceGaussianKernel(float* %0, i32 %11, float %3)
ret void
}