#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 */
scalar_t__ ft_isspace(char);
int /*<<< orphan*/ write(int, char *, int);
void ft_print(char *a) {
  int i;
  int space;
  space = 0;
  i = 0;
  while (a[i] != '\0') {
    if (ft_isspace(a[i])) {
      space = 1;
    } else {
      if (space) {
        space = 0;
        write(1, "   ", 3);
      }
      write(1, &a[i], 1);
      space = 0;
    }
    i++;
  }
}


x86 assembly (clang, -O0):
<ft_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     11c9 <ft_print+0xa9>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <ft_isspace@plt>
cmp    $0x0,%rax
je     1176 <ft_print+0x56>
movl   $0x1,-0x10(%rbp)
jmp    11bb <ft_print+0x9b>
cmpl   $0x0,-0x10(%rbp)
je     119d <ft_print+0x7d>
movl   $0x0,-0x10(%rbp)
mov    $0x1,%edi
lea    0xe6d(%rip),%rsi
mov    $0x3,%edx
call   1030 <write@plt>
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
add    %rax,%rsi
mov    $0x1,%edx
mov    %edx,%edi
call   1030 <write@plt>
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113a <ft_print+0x1a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_print>:
push   %rbp
push   %r14
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     118c <ft_print+0x6c>
mov    %rdi,%rbx
xor    %ebp,%ebp
lea    0xeca(%rip),%r14
jmp    1162 <ft_print+0x42>
nopl   0x0(%rax,%rax,1)
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
xor    %ecx,%ecx
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
mov    %ecx,%ebp
test   %al,%al
je     118c <ft_print+0x6c>
movsbl %al,%edi
call   1040 <ft_isspace@plt>
mov    $0x1,%ecx
test   %rax,%rax
jne    1154 <ft_print+0x34>
test   %ebp,%ebp
je     1140 <ft_print+0x20>
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x3,%edx
call   1030 <write@plt>
jmp    1140 <ft_print+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c" \00"
define void @ft_print(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %4
store i32 0, i32* %3
br label %5
5: ; preds = %33, %1
%6 = load i8*, i8** %2
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %36
13: ; preds = %5
%14 = load i8*, i8** %2
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = call i64 @ft_isspace(i8 signext %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %13
store i32 1, i32* %4
br label %33
22: ; preds = %13
%23 = load i32, i32* %4
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22
store i32 0, i32* %4
%26 = call i32 @write(i32 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
br label %27
27: ; preds = %25, %22
%28 = load i8*, i8** %2
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = call i32 @write(i32 1, i8* %31, i32 1)
store i32 0, i32* %4
br label %33
33: ; preds = %27, %21
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %5
36: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c" \00"
define void @ft_print(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %23, label %4
4: ; preds = %1, %17
%5 = phi i64 [ %19, %17 ], [ 0, %1 ]
%6 = phi i8 [ %21, %17 ], [ %2, %1 ]
%7 = phi i8* [ %20, %17 ], [ %0, %1 ]
%8 = phi i32 [ %18, %17 ], [ 0, %1 ]
%9 = tail call i64 @ft_isspace(i8 signext %6)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %4
%12 = icmp eq i32 %8, 0
br i1 %12, label %15, label %13
13: ; preds = %11
%14 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
br label %15
15: ; preds = %13, %11
%16 = tail call i32 @write(i32 1, i8* %7, i32 1)
br label %17
17: ; preds = %4, %15
%18 = phi i32 [ 0, %15 ], [ 1, %4 ]
%19 = add nuw i64 %5, 1
%20 = getelementptr inbounds i8, i8* %0, i64 %19
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 0
br i1 %22, label %23, label %4
23: ; preds = %17, %1
ret void
}