#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int ft_putnbrl_fd(int const, int);
int ft_putstr_fd(char const *, int);
int ft_putnbr2labelled_fd(const int *nbr2, const char **labels, size_t size,
                          int fd) {
  size_t i;
  int ret;
  i = 0;
  ret = EXIT_SUCCESS;
  while (i < size) {
    ret = ft_putstr_fd(labels[i], fd) == EXIT_SUCCESS ? ret : EXIT_FAILURE;
    ret = ft_putstr_fd(": ", fd) == EXIT_SUCCESS ? ret : EXIT_FAILURE;
    ret = ft_putnbrl_fd(nbr2[i++], fd) == EXIT_SUCCESS ? ret : EXIT_FAILURE;
  }
  return (ret);
}


x86 assembly (clang, -O0):
<ft_putnbr2labelled_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movq   $0x0,-0x28(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1223 <ft_putnbr2labelled_fd+0x103>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x1c(%rbp),%esi
call   1040 <ft_putstr_fd@plt>
mov    0x2e64(%rip),%rcx
cmp    (%rcx),%eax
jne    1187 <ft_putnbr2labelled_fd+0x67>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    1193 <ft_putnbr2labelled_fd+0x73>
mov    0x2e52(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xe5d(%rip),%rdi
call   1040 <ft_putstr_fd@plt>
mov    0x2e29(%rip),%rcx
cmp    (%rcx),%eax
jne    11c2 <ft_putnbr2labelled_fd+0xa2>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x34(%rbp)
jmp    11ce <ft_putnbr2labelled_fd+0xae>
mov    0x2e17(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    (%rax,%rcx,4),%edi
mov    -0x1c(%rbp),%esi
call   1030 <ft_putnbrl_fd@plt>
mov    0x2ddf(%rip),%rcx
cmp    (%rcx),%eax
jne    120c <ft_putnbr2labelled_fd+0xec>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x38(%rbp)
jmp    1218 <ft_putnbr2labelled_fd+0xf8>
mov    0x2dcd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    114b <ft_putnbr2labelled_fd+0x2b>
mov    -0x2c(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbr2labelled_fd>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,(%rsp)
mov    0x2ea2(%rip),%r13
mov    0x0(%r13),%ebp
test   %rdx,%rdx
je     11b0 <ft_putnbr2labelled_fd+0x90>
mov    %ecx,%ebx
mov    %rdx,%r14
mov    %rdi,%r12
xor    %r15d,%r15d
jmp    1155 <ft_putnbr2labelled_fd+0x35>
nopl   0x0(%rax)
cmp    %r15,%r14
je     11b0 <ft_putnbr2labelled_fd+0x90>
mov    (%rsp),%rax
mov    (%rax,%r15,8),%rdi
mov    %ebx,%esi
call   1040 <ft_putstr_fd@plt>
cmp    0x0(%r13),%eax
je     1173 <ft_putnbr2labelled_fd+0x53>
mov    0x2e6f(%rip),%rax
mov    (%rax),%ebp
lea    0xe86(%rip),%rdi
mov    %ebx,%esi
call   1040 <ft_putstr_fd@plt>
cmp    0x0(%r13),%eax
je     1190 <ft_putnbr2labelled_fd+0x70>
mov    0x2e52(%rip),%rax
mov    (%rax),%ebp
mov    (%r12,%r15,4),%edi
add    $0x1,%r15
mov    %ebx,%esi
call   1030 <ft_putnbrl_fd@plt>
cmp    0x0(%r13),%eax
je     1150 <ft_putnbr2labelled_fd+0x30>
mov    0x2e34(%rip),%rax
mov    (%rax),%ebp
jmp    1150 <ft_putnbr2labelled_fd+0x30>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
@.str = [3 x i8] c": \00"
define i32 @ft_putnbr2labelled_fd(i32* %0, i8** %1, i64 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i8**
%7 = alloca i64
%8 = alloca i32
%9 = alloca i64
%10 = alloca i32
store i32* %0, i32** %5
store i8** %1, i8*** %6
store i64 %2, i64* %7
store i32 %3, i32* %8
store i64 0, i64* %9
%11 = load i32, i32* @EXIT_SUCCESS
store i32 %11, i32* %10
br label %12
12: ; preds = %54, %4
%13 = load i64, i64* %9
%14 = load i64, i64* %7
%15 = icmp ult i64 %13, %14
br i1 %15, label %16, label %56
16: ; preds = %12
%17 = load i8**, i8*** %6
%18 = load i64, i64* %9
%19 = getelementptr inbounds i8*, i8** %17, i64 %18
%20 = load i8*, i8** %19
%21 = load i32, i32* %8
%22 = call i32 @ft_putstr_fd(i8* %20, i32 %21)
%23 = load i32, i32* @EXIT_SUCCESS
%24 = icmp eq i32 %22, %23
br i1 %24, label %25, label %27
25: ; preds = %16
%26 = load i32, i32* %10
br label %29
27: ; preds = %16
%28 = load i32, i32* @EXIT_FAILURE
br label %29
29: ; preds = %27, %25
%30 = phi i32 [ %26, %25 ], [ %28, %27 ]
store i32 %30, i32* %10
%31 = load i32, i32* %8
%32 = call i32 @ft_putstr_fd(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %31)
%33 = load i32, i32* @EXIT_SUCCESS
%34 = icmp eq i32 %32, %33
br i1 %34, label %35, label %37
35: ; preds = %29
%36 = load i32, i32* %10
br label %39
37: ; preds = %29
%38 = load i32, i32* @EXIT_FAILURE
br label %39
39: ; preds = %37, %35
%40 = phi i32 [ %36, %35 ], [ %38, %37 ]
store i32 %40, i32* %10
%41 = load i32*, i32** %5
%42 = load i64, i64* %9
%43 = add i64 %42, 1
store i64 %43, i64* %9
%44 = getelementptr inbounds i32, i32* %41, i64 %42
%45 = load i32, i32* %44
%46 = load i32, i32* %8
%47 = call i32 @ft_putnbrl_fd(i32 %45, i32 %46)
%48 = load i32, i32* @EXIT_SUCCESS
%49 = icmp eq i32 %47, %48
br i1 %49, label %50, label %52
50: ; preds = %39
%51 = load i32, i32* %10
br label %54
52: ; preds = %39
%53 = load i32, i32* @EXIT_FAILURE
br label %54
54: ; preds = %52, %50
%55 = phi i32 [ %51, %50 ], [ %53, %52 ]
store i32 %55, i32* %10
br label %12
56: ; preds = %12
%57 = load i32, i32* %10
ret i32 %57
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
@.str = [3 x i8] c": \00"
define i32 @ft_putnbr2labelled_fd(i32* nocapture %0, i8** nocapture %1, i64 %2, i32 %3) {
%5 = load i32, i32* @EXIT_SUCCESS
%6 = icmp eq i64 %2, 0
br i1 %6, label %31, label %7
7: ; preds = %4, %7
%8 = phi i32 [ %29, %7 ], [ %5, %4 ]
%9 = phi i64 [ %22, %7 ], [ 0, %4 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i32 @ft_putstr_fd(i8* %11, i32 %3)
%13 = load i32, i32* @EXIT_SUCCESS
%14 = icmp eq i32 %12, %13
%15 = load i32, i32* @EXIT_FAILURE
%16 = select i1 %14, i32 %8, i32 %15
%17 = tail call i32 @ft_putstr_fd(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
%18 = load i32, i32* @EXIT_SUCCESS
%19 = icmp eq i32 %17, %18
%20 = load i32, i32* @EXIT_FAILURE
%21 = select i1 %19, i32 %16, i32 %20
%22 = add nuw i64 %9, 1
%23 = getelementptr inbounds i32, i32* %0, i64 %9
%24 = load i32, i32* %23
%25 = tail call i32 @ft_putnbrl_fd(i32 %24, i32 %3)
%26 = load i32, i32* @EXIT_SUCCESS
%27 = icmp eq i32 %25, %26
%28 = load i32, i32* @EXIT_FAILURE
%29 = select i1 %27, i32 %21, i32 %28
%30 = icmp eq i64 %22, %2
br i1 %30, label %31, label %7
31: ; preds = %7, %4
%32 = phi i32 [ %5, %4 ], [ %29, %7 ]
ret i32 %32
}