#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_putchar(char);
void ligne_1(int x) {
  int a;
  a = 0;
  while (a != x) {
    if (a != 0 && a != x - 1) {
      ft_putchar('B');
    } else if (a == 0) {
      ft_putchar('A');
    } else {
      ft_putchar('C');
    }
    a++;
  }
}


x86 assembly (clang, -O0):
<ligne_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
je     118e <ligne_1+0x7e>
cmpl   $0x0,-0x8(%rbp)
je     1158 <ligne_1+0x48>
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     1158 <ligne_1+0x48>
mov    $0x42,%edi
call   1030 <ft_putchar@plt>
jmp    1180 <ligne_1+0x70>
cmpl   $0x0,-0x8(%rbp)
jne    1171 <ligne_1+0x61>
mov    $0x41,%edi
call   1030 <ft_putchar@plt>
jmp    117b <ligne_1+0x6b>
mov    $0x43,%edi
call   1030 <ft_putchar@plt>
jmp    1180 <ligne_1+0x70>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <ligne_1+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ligne_1>:
push   %rbx
test   %edi,%edi
je     1146 <ligne_1+0x36>
mov    %edi,%ebx
mov    $0x41,%edi
call   1030 <ft_putchar@plt>
cmp    $0x1,%ebx
je     1146 <ligne_1+0x36>
add    $0xffffffff,%ebx
nopl   0x0(%rax)
xor    %edi,%edi
cmp    $0x1,%ebx
sete   %dil
or     $0x42,%edi
call   1030 <ft_putchar@plt>
add    $0xffffffff,%ebx
jne    1130 <ligne_1+0x20>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @ligne_1(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = add nsw i32 %0, -1
%5 = tail call i32 @ft_putchar(i8 signext 65)
%6 = icmp eq i32 %0, 1
br i1 %6, label %14, label %7
7: ; preds = %3, %7
%8 = phi i32 [ %12, %7 ], [ 1, %3 ]
%9 = icmp eq i32 %8, %4
%10 = select i1 %9, i8 67, i8 66
%11 = tail call i32 @ft_putchar(i8 signext %10)
%12 = add nuw nsw i32 %8, 1
%13 = icmp eq i32 %12, %0
br i1 %13, label %14, label %7
14: ; preds = %7, %3, %1
ret void
}