#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_first(int, int);
int /*<<< orphan*/ ft_middle(int, int);
void ft_cube(int x, int y) {
  int i;
  i = 0;
  while (i < y) {
    if (i == 0 || i == y - 1)
      ft_first(x, y);
    else
      ft_middle(x, y);
    i++;
  }
}


x86 assembly (clang, -O0):
<ft_cube>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1185 <ft_cube+0x65>
cmpl   $0x0,-0xc(%rbp)
je     115c <ft_cube+0x3c>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    116c <ft_cube+0x4c>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <ft_first@plt>
jmp    1177 <ft_cube+0x57>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <ft_middle@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1135 <ft_cube+0x15>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_cube>:
push   %rbp
push   %r14
push   %rbx
test   %esi,%esi
jle    116a <ft_cube+0x4a>
mov    %esi,%ebx
mov    %edi,%r14d
xor    %eax,%eax
xor    %ebp,%ebp
jmp    1152 <ft_cube+0x32>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14d,%edi
mov    %ebx,%esi
call   1030 <ft_first@plt>
mov    %ebx,%ecx
mov    %ebp,%eax
add    %ebp,%ecx
je     116a <ft_cube+0x4a>
sub    $0x1,%ebp
jb     1140 <ft_cube+0x20>
add    %ebx,%eax
cmp    $0x1,%eax
je     1140 <ft_cube+0x20>
mov    %r14d,%edi
mov    %ebx,%esi
call   1040 <ft_middle@plt>
jmp    114a <ft_cube+0x2a>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @ft_cube(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %26, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %29
10: ; preds = %6
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, 0
br i1 %12, label %18, label %13
13: ; preds = %10
%14 = load i32, i32* %5
%15 = load i32, i32* %4
%16 = sub nsw i32 %15, 1
%17 = icmp eq i32 %14, %16
br i1 %17, label %18, label %22
18: ; preds = %13, %10
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = call i32 @ft_first(i32 %19, i32 %20)
br label %26
22: ; preds = %13
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = call i32 @ft_middle(i32 %23, i32 %24)
br label %26
26: ; preds = %22, %18
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %6
29: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @ft_cube(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %18
4: ; preds = %2
%5 = add nsw i32 %1, -1
br label %6
6: ; preds = %4, %15
%7 = phi i32 [ 0, %4 ], [ %16, %15 ]
%8 = icmp eq i32 %7, 0
%9 = icmp eq i32 %7, %5
%10 = select i1 %8, i1 true, i1 %9
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = tail call i32 @ft_first(i32 %0, i32 %1)
br label %15
13: ; preds = %6
%14 = tail call i32 @ft_middle(i32 %0, i32 %1)
br label %15
15: ; preds = %13, %11
%16 = add nuw nsw i32 %7, 1
%17 = icmp eq i32 %16, %1
br i1 %17, label %18, label %6
18: ; preds = %15, %2
ret void
}