#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);
int ft_putline(char c1, char c2, char c3, int nb) {
  int i;
  i = 0;
  ft_putchar(c1);
  if (nb > 2) {
    while (i < nb - 1) {
      ft_putchar(c2);
      i++;
    }
  }
  if (nb > 1) {
    ft_putchar(c3);
  }
  ft_putchar('\r');
  ft_putchar('\n');
  return (0);
}


x86 assembly (clang, -O0):
<ft_putline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %sil,%dl
mov    %dil,%sil
mov    %sil,-0x1(%rbp)
mov    %dl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
mov    %ecx,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <ft_putchar@plt>
cmpl   $0x2,-0x8(%rbp)
jle    1179 <ft_putline+0x69>
jmp    114c <ft_putline+0x3c>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1174 <ft_putline+0x64>
movsbl -0x2(%rbp),%edi
call   1030 <ft_putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114c <ft_putline+0x3c>
jmp    1179 <ft_putline+0x69>
cmpl   $0x1,-0x8(%rbp)
jle    118c <ft_putline+0x7c>
movsbl -0x3(%rbp),%edi
call   1030 <ft_putchar@plt>
mov    $0xd,%edi
call   1030 <ft_putchar@plt>
mov    $0xa,%edi
call   1030 <ft_putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putline>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r15d
mov    %edx,%r14d
mov    %esi,%ebp
call   1030 <ft_putchar@plt>
cmp    $0x3,%r15d
jl     114c <ft_putline+0x3c>
lea    -0x1(%r15),%ebx
movsbl %bpl,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebp,%edi
call   1030 <ft_putchar@plt>
add    $0xffffffff,%ebx
jne    1140 <ft_putline+0x30>
cmp    $0x2,%r15d
jl     115b <ft_putline+0x4b>
movsbl %r14b,%edi
call   1030 <ft_putchar@plt>
mov    $0xd,%edi
call   1030 <ft_putchar@plt>
mov    $0xa,%edi
call   1030 <ft_putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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