#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_putnbr_base(int, char *);
int /*<<< orphan*/ ft_putstr(char *);
void hexa_line_two(int n) {
  if (n == 0)
    ft_putstr("000000");
  else if (n == 16 || n < 256)
    ft_putstr("00000");
  else if (n == 256 || n < 4096)
    ft_putstr("0000");
  else if (n == 4096 || n < 65536)
    ft_putstr("000");
  else if (n == 65536 || n < 1048576)
    ft_putstr("00");
  else if (n == 1048576 || n < 16777216)
    ft_putstr("0");
  ft_putnbr_base(n, "0123456789abcdef");
}


x86 assembly (clang, -O0):
<hexa_line_two>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1146 <hexa_line_two+0x26>
lea    0xec4(%rip),%rdi
call   1040 <ft_putstr@plt>
jmp    122e <hexa_line_two+0x10e>
cmpl   $0x10,-0x4(%rbp)
je     115d <hexa_line_two+0x3d>
cmpl   $0x100,-0x4(%rbp)
jge    116e <hexa_line_two+0x4e>
lea    0xe9d(%rip),%rdi
call   1040 <ft_putstr@plt>
jmp    1229 <hexa_line_two+0x109>
cmpl   $0x100,-0x4(%rbp)
je     1188 <hexa_line_two+0x68>
cmpl   $0x1000,-0x4(%rbp)
jge    1199 <hexa_line_two+0x79>
lea    0xe73(%rip),%rdi
call   1040 <ft_putstr@plt>
jmp    1224 <hexa_line_two+0x104>
cmpl   $0x1000,-0x4(%rbp)
je     11b3 <hexa_line_two+0x93>
cmpl   $0x10000,-0x4(%rbp)
jge    11c4 <hexa_line_two+0xa4>
lea    0xe49(%rip),%rdi
call   1040 <ft_putstr@plt>
jmp    121f <hexa_line_two+0xff>
cmpl   $0x10000,-0x4(%rbp)
je     11de <hexa_line_two+0xbe>
cmpl   $0x100000,-0x4(%rbp)
jge    11ef <hexa_line_two+0xcf>
lea    0xe1f(%rip),%rdi
call   1040 <ft_putstr@plt>
jmp    121a <hexa_line_two+0xfa>
cmpl   $0x100000,-0x4(%rbp)
je     1209 <hexa_line_two+0xe9>
cmpl   $0x1000000,-0x4(%rbp)
jge    1215 <hexa_line_two+0xf5>
lea    0xdf5(%rip),%rdi
call   1040 <ft_putstr@plt>
jmp    121a <hexa_line_two+0xfa>
jmp    121f <hexa_line_two+0xff>
jmp    1224 <hexa_line_two+0x104>
jmp    1229 <hexa_line_two+0x109>
jmp    122e <hexa_line_two+0x10e>
mov    -0x4(%rbp),%edi
lea    0xdcf(%rip),%rsi
call   1030 <ft_putnbr_base@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexa_line_two>:
push   %rbx
mov    %edi,%ebx
test   %edi,%edi
je     1138 <hexa_line_two+0x18>
cmp    $0x100,%ebx
jge    1141 <hexa_line_two+0x21>
lea    0xecb(%rip),%rdi
jmp    1183 <hexa_line_two+0x63>
lea    0xec1(%rip),%rdi
jmp    1183 <hexa_line_two+0x63>
cmp    $0x1000,%ebx
jae    1152 <hexa_line_two+0x32>
lea    0xeb2(%rip),%rdi
jmp    1183 <hexa_line_two+0x63>
cmp    $0x10000,%ebx
jae    1163 <hexa_line_two+0x43>
lea    0xea2(%rip),%rdi
jmp    1183 <hexa_line_two+0x63>
cmp    $0x100000,%ebx
jae    1174 <hexa_line_two+0x54>
lea    0xe92(%rip),%rdi
jmp    1183 <hexa_line_two+0x63>
cmp    $0xffffff,%ebx
ja     1188 <hexa_line_two+0x68>
lea    0xe82(%rip),%rdi
call   1040 <ft_putstr@plt>
lea    0xe78(%rip),%rsi
mov    %ebx,%edi
pop    %rbx
jmp    1030 <ft_putnbr_base@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"000000\00"
@.str.1 = [6 x i8] c"00000\00"
@.str.2 = [5 x i8] c"0000\00"
@.str.3 = [4 x i8] c"000\00"
@.str.4 = [3 x i8] c"00\00"
@.str.5 = [2 x i8] c"0\00"
@.str.6 = [17 x i8] c"0123456789abcdef\00"
define void @hexa_line_two(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @ft_putstr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %52
7: ; preds = %1
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 16
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 256
br i1 %12, label %13, label %15
13: ; preds = %10, %7
%14 = call i32 @ft_putstr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %51
15: ; preds = %10
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 256
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = load i32, i32* %2
%20 = icmp slt i32 %19, 4096
br i1 %20, label %21, label %23
21: ; preds = %18, %15
%22 = call i32 @ft_putstr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %50
23: ; preds = %18
%24 = load i32, i32* %2
%25 = icmp eq i32 %24, 4096
br i1 %25, label %29, label %26
26: ; preds = %23
%27 = load i32, i32* %2
%28 = icmp slt i32 %27, 65536
br i1 %28, label %29, label %31
29: ; preds = %26, %23
%30 = call i32 @ft_putstr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %49
31: ; preds = %26
%32 = load i32, i32* %2
%33 = icmp eq i32 %32, 65536
br i1 %33, label %37, label %34
34: ; preds = %31
%35 = load i32, i32* %2
%36 = icmp slt i32 %35, 1048576
br i1 %36, label %37, label %39
37: ; preds = %34, %31
%38 = call i32 @ft_putstr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %48
39: ; preds = %34
%40 = load i32, i32* %2
%41 = icmp eq i32 %40, 1048576
br i1 %41, label %45, label %42
42: ; preds = %39
%43 = load i32, i32* %2
%44 = icmp slt i32 %43, 16777216
br i1 %44, label %45, label %47
45: ; preds = %42, %39
%46 = call i32 @ft_putstr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %47
47: ; preds = %45, %42
br label %48
48: ; preds = %47, %37
br label %49
49: ; preds = %48, %29
br label %50
50: ; preds = %49, %21
br label %51
51: ; preds = %50, %13
br label %52
52: ; preds = %51, %5
%53 = load i32, i32* %2
%54 = call i32 @ft_putnbr_base(i32 %53, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"000000\00"
@.str.1 = [6 x i8] c"00000\00"
@.str.2 = [5 x i8] c"0000\00"
@.str.3 = [4 x i8] c"000\00"
@.str.4 = [3 x i8] c"00\00"
@.str.5 = [2 x i8] c"0\00"
@.str.6 = [17 x i8] c"0123456789abcdef\00"
define void @hexa_line_two(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = icmp slt i32 %0, 256
br i1 %4, label %13, label %5
5: ; preds = %3
%6 = icmp ult i32 %0, 4096
br i1 %6, label %13, label %7
7: ; preds = %5
%8 = icmp ult i32 %0, 65536
br i1 %8, label %13, label %9
9: ; preds = %7
%10 = icmp ult i32 %0, 1048576
br i1 %10, label %13, label %11
11: ; preds = %9
%12 = icmp ult i32 %0, 16777216
br i1 %12, label %13, label %16
13: ; preds = %11, %9, %7, %5, %3, %1
%14 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %5 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), %7 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), %9 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), %11 ]
%15 = tail call i32 @ft_putstr(i8* %14)
br label %16
16: ; preds = %13, %11
%17 = tail call i32 @ft_putnbr_base(i32 %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
ret void
}