#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*/ printf(char *, ...);
void print_str_by_word(char *str) {
  bool getSpace = false;
  while (*str != '\0') {
    if ((*str == ' ' || *str == '\t' || *str == '\n') && !getSpace) {
      printf("\n");
      getSpace = true;
    } else {
      printf("%c", *str);
      getSpace = false;
    }
    str++;
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_str_by_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11b4 <print_str_by_word+0xa4>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     1163 <print_str_by_word+0x53>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
je     1163 <print_str_by_word+0x53>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    1187 <print_str_by_word+0x77>
cmpl   $0x0,-0xc(%rbp)
jne    1187 <print_str_by_word+0x77>
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
jmp    11a3 <print_str_by_word+0x93>
mov    -0x8(%rbp),%rax
movsbl (%rax),%esi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1123 <print_str_by_word+0x13>
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_str_by_word>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %ebp,%ebp
jmp    112b <print_str_by_word+0x1b>
nopw   0x0(%rax,%rax,1)
xor    %ebp,%ebp
call   1030 <putchar@plt>
add    $0x1,%rbx
movsbl (%rbx),%edi
cmp    $0x9,%edi
je     1150 <print_str_by_word+0x40>
cmp    $0x20,%dil
je     1150 <print_str_by_word+0x40>
test   %dil,%dil
je     1160 <print_str_by_word+0x50>
test   %ebp,%ebp
jne    1120 <print_str_by_word+0x10>
cmp    $0xa,%dil
je     1154 <print_str_by_word+0x44>
jmp    1120 <print_str_by_word+0x10>
nopw   0x0(%rax,%rax,1)
test   %ebp,%ebp
jne    1120 <print_str_by_word+0x10>
mov    $0x1,%ebp
mov    $0xa,%edi
jmp    1122 <print_str_by_word+0x12>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @print_str_by_word(i8* nocapture %0) {
br label %2
2: ; preds = %14, %1
%3 = phi i8* [ %0, %1 ], [ %18, %14 ]
%4 = phi i32 [ 0, %1 ], [ %16, %14 ]
%5 = load i8, i8* %3
switch i8 %5, label %6 [
i8 0, label %19
i8 32, label %10
i8 9, label %10
]
6: ; preds = %2
%7 = icmp ne i8 %5, 10
%8 = icmp ne i32 %4, 0
%9 = or i1 %8, %7
br i1 %9, label %12, label %14
10: ; preds = %2, %2
%11 = icmp eq i32 %4, 0
br i1 %11, label %14, label %12
12: ; preds = %10, %6
%13 = sext i8 %5 to i32
br label %14
14: ; preds = %10, %6, %12
%15 = phi i32 [ %13, %12 ], [ 10, %6 ], [ 10, %10 ]
%16 = phi i32 [ 0, %12 ], [ 1, %6 ], [ 1, %10 ]
%17 = tail call i32 @putchar(i32 %15)
%18 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
19: ; preds = %2
%20 = tail call i32 @putchar(i32 10)
ret void
}