#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*/ free(float *);
int /*<<< orphan*/ morsi_dilation(float *, float *, int, int, int *);
int /*<<< orphan*/ morsi_erosion(float *, float *, int, int, int *);
float *xmalloc(int);
void morsi_closing(float *y, float *x, int w, int h, int *e) {
  float *t = xmalloc(w * h * sizeof *t);
  morsi_dilation(t, x, w, h, e);
  morsi_erosion(y, t, w, h, e);
  free(t);
}


x86 assembly (clang, -O0):
<morsi_closing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x18(%rbp),%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <xmalloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x20(%rbp),%r8
call   1040 <morsi_dilation@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x20(%rbp),%r8
call   1060 <morsi_erosion@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<morsi_closing>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r14
mov    %ecx,%r13d
mov    %edx,%ebx
mov    %rsi,%r15
mov    %rdi,%r12
mov    %edx,%edi
imul   %ecx,%edi
shl    $0x2,%edi
call   1050 <xmalloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
mov    %r13d,%ecx
mov    %r14,%r8
call   1040 <morsi_dilation@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
mov    %ebx,%edx
mov    %r13d,%ecx
mov    %r14,%r8
call   1060 <morsi_erosion@plt>
mov    %rbp,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @morsi_closing(float* %0, float* %1, i32 %2, i32 %3, i32* %4) {
%6 = alloca float*
%7 = alloca float*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca float*
store float* %0, float** %6
store float* %1, float** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32* %4, i32** %10
%12 = load i32, i32* %8
%13 = load i32, i32* %9
%14 = mul nsw i32 %12, %13
%15 = sext i32 %14 to i64
%16 = mul i64 %15, 4
%17 = trunc i64 %16 to i32
%18 = call float* @xmalloc(i32 %17)
store float* %18, float** %11
%19 = load float*, float** %11
%20 = load float*, float** %7
%21 = load i32, i32* %8
%22 = load i32, i32* %9
%23 = load i32*, i32** %10
%24 = call i32 @morsi_dilation(float* %19, float* %20, i32 %21, i32 %22, i32* %23)
%25 = load float*, float** %6
%26 = load float*, float** %11
%27 = load i32, i32* %8
%28 = load i32, i32* %9
%29 = load i32*, i32** %10
%30 = call i32 @morsi_erosion(float* %25, float* %26, i32 %27, i32 %28, i32* %29)
%31 = load float*, float** %11
%32 = call i32 @free(float* %31)
ret void
}

LLVM IR (-O2):
define void @morsi_closing(float* %0, float* %1, i32 %2, i32 %3, i32* %4) {
%6 = shl i32 %2, 2
%7 = mul i32 %6, %3
%8 = tail call float* @xmalloc(i32 %7)
%9 = tail call i32 @morsi_dilation(float* %8, float* %1, i32 %2, i32 %3, i32* %4)
%10 = tail call i32 @morsi_erosion(float* %0, float* %8, i32 %2, i32 %3, i32* %4)
%11 = tail call i32 @free(float* %8)
ret void
}