#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_first(int x, int y) {
  int i;
  i = 0;
  while (i < x) {
    if (i == 0 && y > 1 && x > 1)
      my_putchar('A');
    if ((i == x - 1) && y > 1 && x > 1)
      my_putchar('C');
    else
      my_putchar('B');
    i++;
  }
  my_putchar('\n');
}


x86 assembly (clang, -O0):
<ft_first>:
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    11a5 <ft_first+0x95>
cmpl   $0x0,-0xc(%rbp)
jne    1159 <ft_first+0x49>
cmpl   $0x1,-0x8(%rbp)
jle    1159 <ft_first+0x49>
cmpl   $0x1,-0x4(%rbp)
jle    1159 <ft_first+0x49>
mov    $0x41,%edi
call   1030 <my_putchar@plt>
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    118d <ft_first+0x7d>
cmpl   $0x1,-0x8(%rbp)
jle    118d <ft_first+0x7d>
cmpl   $0x1,-0x4(%rbp)
jle    118d <ft_first+0x7d>
mov    $0x43,%edi
call   1030 <my_putchar@plt>
jmp    1197 <ft_first+0x87>
mov    $0x42,%edi
call   1030 <my_putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <ft_first+0x15>
mov    $0xa,%edi
call   1030 <my_putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_first>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    117e <ft_first+0x6e>
mov    %esi,%r14d
mov    %edi,%ebx
xor    %ebp,%ebp
jmp    1159 <ft_first+0x49>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0x1,%ebx
setne  %al
cmp    $0x2,%r14d
setge  %cl
cmp    $0x1,%r15d
sete   %dl
and    %al,%cl
and    %dl,%cl
movzbl %cl,%edi
or     $0x42,%edi
call   1030 <my_putchar@plt>
mov    %ebx,%eax
add    %ebp,%eax
je     117e <ft_first+0x6e>
lea    (%rbx,%rbp,1),%r15d
sub    $0x1,%ebp
setb   %al
cmp    $0x1,%ebx
je     1130 <ft_first+0x20>
cmp    $0x2,%r14d
jl     1130 <ft_first+0x20>
test   %al,%al
je     1130 <ft_first+0x20>
mov    $0x41,%edi
call   1030 <my_putchar@plt>
jmp    1130 <ft_first+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <my_putchar@plt>

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

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