#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*/ my_putchar(char);
void ft_middle(int x, int y) {
  int i;
  i = 0;
  while (i < x) {
    if (i == 0)
      my_putchar('B');
    if (i == x - 1 && x > 1)
      my_putchar('B');
    else if (i != x - 1)
      my_putchar(' ');
    i++;
  }
  my_putchar('\n');
}


x86 assembly (clang, -O0):
<ft_middle>:
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    -0x4(%rbp),%eax
jge    119d <ft_middle+0x8d>
cmpl   $0x0,-0xc(%rbp)
jne    1145 <ft_middle+0x35>
mov    $0x42,%edi
call   1030 <my_putchar@plt>
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    116f <ft_middle+0x5f>
cmpl   $0x1,-0x4(%rbp)
jle    116f <ft_middle+0x5f>
mov    $0x42,%edi
call   1030 <my_putchar@plt>
jmp    118f <ft_middle+0x7f>
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     118a <ft_middle+0x7a>
mov    $0x20,%edi
call   1030 <my_putchar@plt>
jmp    118f <ft_middle+0x7f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <ft_middle+0x15>
mov    $0xa,%edi
call   1030 <my_putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_middle>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
jle    1155 <ft_middle+0x45>
mov    %edi,%ebx
mov    $0x42,%edi
call   1030 <my_putchar@plt>
mov    %ebx,%ebp
add    $0xffffffff,%ebp
je     1134 <ft_middle+0x24>
mov    $0x20,%edi
call   1030 <my_putchar@plt>
cmp    $0x1,%ebx
je     1155 <ft_middle+0x45>
mov    $0x42,%ebx
xchg   %ax,%ax
cmp    $0x1,%ebp
mov    $0x20,%edi
cmove  %ebx,%edi
call   1030 <my_putchar@plt>
add    $0xffffffff,%ebp
jne    1140 <ft_middle+0x30>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <my_putchar@plt>

LLVM IR (-O0):
define void @ft_middle(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 = %33, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %3
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %36
10: ; preds = %6
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 @my_putchar(i8 signext 66)
br label %15
15: ; preds = %13, %10
%16 = load i32, i32* %5
%17 = load i32, i32* %3
%18 = sub nsw i32 %17, 1
%19 = icmp eq i32 %16, %18
br i1 %19, label %20, label %25
20: ; preds = %15
%21 = load i32, i32* %3
%22 = icmp sgt i32 %21, 1
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 @my_putchar(i8 signext 66)
br label %33
25: ; preds = %20, %15
%26 = load i32, i32* %5
%27 = load i32, i32* %3
%28 = sub nsw i32 %27, 1
%29 = icmp ne i32 %26, %28
br i1 %29, label %30, label %32
30: ; preds = %25
%31 = call i32 @my_putchar(i8 signext 32)
br label %32
32: ; preds = %30, %25
br label %33
33: ; preds = %32, %23
%34 = load i32, i32* %5
%35 = add nsw i32 %34, 1
store i32 %35, i32* %5
br label %6
36: ; preds = %6
%37 = call i32 @my_putchar(i8 signext 10)
ret void
}

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