#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*/ deconvolve3_columns(int, int, int, double *, double *,
                                       double, double);
int /*<<< orphan*/ deconvolve3_rows(int, int, int, double *, double *, double,
                                    double);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
void resolve_coeffs_2d(int width, int height, int rowstride, double *data) {
  double *buffer;
  int max;
  max = width > height ? width : height;
  buffer = (double *)malloc(max * sizeof(double));
  deconvolve3_rows(width, height, rowstride, data, buffer, 13.0 / 21.0,
                   4.0 / 21.0);
  deconvolve3_columns(width, height, rowstride, data, buffer, 13.0 / 21.0,
                      4.0 / 21.0);
  free(buffer);
}


x86 assembly (clang, -O0):
<resolve_coeffs_2d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    116c <resolve_coeffs_2d+0x2c>
mov    -0x4(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    1172 <resolve_coeffs_2d+0x32>
mov    -0x8(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x24(%rbp)
movslq -0x24(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
movsd  0xe5c(%rip),%xmm0
movsd  0xe5c(%rip),%xmm1
call   1060 <deconvolve3_rows@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
movsd  0xe36(%rip),%xmm0
movsd  0xe36(%rip),%xmm1
call   1040 <deconvolve3_columns@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<resolve_coeffs_2d>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %edx,%r15d
mov    %esi,%ebx
mov    %edi,%ebp
cmp    %esi,%edi
mov    %esi,%edi
cmovg  %ebp,%edi
shl    $0x3,%edi
call   1050 <malloc@plt>
mov    %rax,%r12
movsd  0xe94(%rip),%xmm0
movsd  0xe94(%rip),%xmm1
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r15d,%edx
mov    %r14,%rcx
mov    %rax,%r8
call   1060 <deconvolve3_rows@plt>
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r15d,%edx
mov    %r14,%rcx
mov    %r12,%r8
movsd  0xe65(%rip),%xmm0
movsd  0xe65(%rip),%xmm1
call   1040 <deconvolve3_columns@plt>
mov    %r12,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @resolve_coeffs_2d(i32 %0, i32 %1, i32 %2, double* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca double*
%9 = alloca double*
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store double* %3, double** %8
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = icmp sgt i32 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %4
%15 = load i32, i32* %5
br label %18
16: ; preds = %4
%17 = load i32, i32* %6
br label %18
18: ; preds = %16, %14
%19 = phi i32 [ %15, %14 ], [ %17, %16 ]
store i32 %19, i32* %10
%20 = load i32, i32* %10
%21 = sext i32 %20 to i64
%22 = mul i64 %21, 8
%23 = trunc i64 %22 to i32
%24 = call i64 @malloc(i32 %23)
%25 = inttoptr i64 %24 to double*
store double* %25, double** %9
%26 = load i32, i32* %5
%27 = load i32, i32* %6
%28 = load i32, i32* %7
%29 = load double*, double** %8
%30 = load double*, double** %9
%31 = call i32 @deconvolve3_rows(i32 %26, i32 %27, i32 %28, double* %29, double* %30, double 0x3FE3CF3CF3CF3CF4, double 0x3FC8618618618618)
%32 = load i32, i32* %5
%33 = load i32, i32* %6
%34 = load i32, i32* %7
%35 = load double*, double** %8
%36 = load double*, double** %9
%37 = call i32 @deconvolve3_columns(i32 %32, i32 %33, i32 %34, double* %35, double* %36, double 0x3FE3CF3CF3CF3CF4, double 0x3FC8618618618618)
%38 = load double*, double** %9
%39 = call i32 @free(double* %38)
ret void
}

LLVM IR (-O2):
define void @resolve_coeffs_2d(i32 %0, i32 %1, i32 %2, double* %3) {
%5 = icmp sgt i32 %0, %1
%6 = select i1 %5, i32 %0, i32 %1
%7 = shl i32 %6, 3
%8 = tail call i64 @malloc(i32 %7)
%9 = inttoptr i64 %8 to double*
%10 = tail call i32 @deconvolve3_rows(i32 %0, i32 %1, i32 %2, double* %3, double* %9, double 0x3FE3CF3CF3CF3CF4, double 0x3FC8618618618618)
%11 = tail call i32 @deconvolve3_columns(i32 %0, i32 %1, i32 %2, double* %3, double* %9, double 0x3FE3CF3CF3CF3CF4, double 0x3FC8618618618618)
%12 = tail call i32 @free(double* %9)
ret void
}