#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(unsigned char *);
scalar_t__ malloc(int);
void dilate_erode_3D(int npixel, unsigned char *src, int n,
                     unsigned char *dst) {
  int i, prim[27];
  unsigned char *tmp;
  for (i = 0; i < 27; ++i)
    prim[i] = 1;
  prim[13] = 9;
  tmp = (unsigned char *)malloc(npixel * sizeof(unsigned char));
  for (i = 0; i < npixel; ++i)
    tmp[i] = 0x00;
  free(tmp);
}


x86 assembly (clang, -O0):
<dilate_erode_3D>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x1b,-0x24(%rbp)
jge    1167 <dilate_erode_3D+0x47>
movslq -0x24(%rbp),%rax
movl   $0x1,-0x90(%rbp,%rax,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1140 <dilate_erode_3D+0x20>
movl   $0x9,-0x5c(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x98(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11b4 <dilate_erode_3D+0x94>
mov    -0x98(%rbp),%rax
movslq -0x24(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    118b <dilate_erode_3D+0x6b>
mov    -0x98(%rbp),%rdi
call   1030 <free@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dilate_erode_3D>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %ebp,%ebp
jle    114d <dilate_erode_3D+0x1d>
mov    %ebp,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @dilate_erode_3D(i32 %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca [27 x i32]
%11 = alloca i8*
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
store i32 0, i32* %9
br label %12
12: ; preds = %19, %4
%13 = load i32, i32* %9
%14 = icmp slt i32 %13, 27
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = load i32, i32* %9
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [27 x i32], [27 x i32]* %10, i64 0, i64 %17
store i32 1, i32* %18
br label %19
19: ; preds = %15
%20 = load i32, i32* %9
%21 = add nsw i32 %20, 1
store i32 %21, i32* %9
br label %12
22: ; preds = %12
%23 = getelementptr inbounds [27 x i32], [27 x i32]* %10, i64 0, i64 13
store i32 9, i32* %23
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = mul i64 %25, 1
%27 = trunc i64 %26 to i32
%28 = call i64 @malloc(i32 %27)
%29 = inttoptr i64 %28 to i8*
store i8* %29, i8** %11
store i32 0, i32* %9
br label %30
30: ; preds = %39, %22
%31 = load i32, i32* %9
%32 = load i32, i32* %5
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %42
34: ; preds = %30
%35 = load i8*, i8** %11
%36 = load i32, i32* %9
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %35, i64 %37
store i8 0, i8* %38
br label %39
39: ; preds = %34
%40 = load i32, i32* %9
%41 = add nsw i32 %40, 1
store i32 %41, i32* %9
br label %30
42: ; preds = %30
%43 = load i8*, i8** %11
%44 = call i32 @free(i8* %43)
ret void
}

LLVM IR (-O2):
define void @dilate_erode_3D(i32 %0, i8* nocapture readnone %1, i32 %2, i8* nocapture readnone %3) {
%5 = tail call i64 @malloc(i32 %0)
%6 = inttoptr i64 %5 to i8*
%7 = icmp sgt i32 %0, 0
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = zext i32 %0 to i64
br label %10
10: ; preds = %8, %4
%11 = tail call i32 @free(i8* %6)
ret void
}