#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*/ ft_memdel(void *);
scalar_t__ malloc(int);
char **trim(char ***, int, int);
scalar_t__ trim_mark_cols(char ***, int, int, char);
scalar_t__ trim_mark_rows(char ***, int, int, char);
char **piece_trim(char **piece) {
  char ***this_piece;
  char **result;
  int x;
  int y;
  x = 4;
  y = 4;
  this_piece = (char ***)(malloc(sizeof(char **)));
  *this_piece = piece;
  y -= trim_mark_rows(this_piece, 4, 4, '.');
  x -= trim_mark_cols(this_piece, 4, 4, '.');
  result = trim(this_piece, x, y);
  ft_memdel((void *)(*this_piece));
  return (result);
}


x86 assembly (clang, -O0):
<piece_trim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x4,-0x1c(%rbp)
movl   $0x4,-0x20(%rbp)
mov    $0x8,%edi
call   1070 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rdi
mov    $0x4,%edx
mov    $0x2e,%ecx
mov    %edx,%esi
call   1060 <trim_mark_rows@plt>
mov    %rax,%rcx
movslq -0x20(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x4,%edx
mov    $0x2e,%ecx
mov    %edx,%esi
call   1050 <trim_mark_cols@plt>
mov    %rax,%rcx
movslq -0x1c(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1040 <trim@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <ft_memdel@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<piece_trim>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
mov    $0x8,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    %r14,(%rax)
mov    $0x4,%r14d
mov    %rax,%rdi
mov    $0x4,%esi
mov    $0x4,%edx
mov    $0x2e,%ecx
call   1060 <trim_mark_rows@plt>
mov    $0x4,%ebp
sub    %eax,%ebp
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x4,%edx
mov    $0x2e,%ecx
call   1050 <trim_mark_cols@plt>
sub    %eax,%r14d
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %ebp,%edx
call   1040 <trim@plt>
mov    %rax,%rbp
mov    (%rbx),%rdi
call   1030 <ft_memdel@plt>
mov    %rbp,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8** @piece_trim(i8** %0) {
%2 = alloca i8**
%3 = alloca i8***
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
store i8** %0, i8*** %2
store i32 4, i32* %5
store i32 4, i32* %6
%7 = call i64 @malloc(i32 8)
%8 = inttoptr i64 %7 to i8***
store i8*** %8, i8**** %3
%9 = load i8**, i8*** %2
%10 = load i8***, i8**** %3
store i8** %9, i8*** %10
%11 = load i8***, i8**** %3
%12 = call i64 @trim_mark_rows(i8*** %11, i32 4, i32 4, i8 signext 46)
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = sub nsw i64 %14, %12
%16 = trunc i64 %15 to i32
store i32 %16, i32* %6
%17 = load i8***, i8**** %3
%18 = call i64 @trim_mark_cols(i8*** %17, i32 4, i32 4, i8 signext 46)
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = sub nsw i64 %20, %18
%22 = trunc i64 %21 to i32
store i32 %22, i32* %5
%23 = load i8***, i8**** %3
%24 = load i32, i32* %5
%25 = load i32, i32* %6
%26 = call i8** @trim(i8*** %23, i32 %24, i32 %25)
store i8** %26, i8*** %4
%27 = load i8***, i8**** %3
%28 = load i8**, i8*** %27
%29 = bitcast i8** %28 to i8*
%30 = call i32 @ft_memdel(i8* %29)
%31 = load i8**, i8*** %4
ret i8** %31
}

LLVM IR (-O2):
define i8** @piece_trim(i8** %0) {
%2 = tail call i64 @malloc(i32 8)
%3 = inttoptr i64 %2 to i8***
store i8** %0, i8*** %3
%4 = tail call i64 @trim_mark_rows(i8*** %3, i32 4, i32 4, i8 signext 46)
%5 = trunc i64 %4 to i32
%6 = sub i32 4, %5
%7 = tail call i64 @trim_mark_cols(i8*** %3, i32 4, i32 4, i8 signext 46)
%8 = trunc i64 %7 to i32
%9 = sub i32 4, %8
%10 = tail call i8** @trim(i8*** %3, i32 %9, i32 %6)
%11 = inttoptr i64 %2 to i8**
%12 = load i8*, i8** %11
%13 = tail call i32 @ft_memdel(i8* %12)
ret i8** %10
}