#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_showing_whitespace(char string[]) {
  for (int i = 0; string[i] != '\0'; ++i) {
    if (string[i] == ' ') {
      printf("<space>");
    } else if (string[i] == '\t') {
      printf("<tab>");
    } else {
      printf("%c", string[i]);
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_showing_whitespace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     11ba <print_showing_whitespace+0xaa>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    1160 <print_showing_whitespace+0x50>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a7 <print_showing_whitespace+0x97>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x9,%eax
jne    1188 <print_showing_whitespace+0x78>
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a2 <print_showing_whitespace+0x92>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a7 <print_showing_whitespace+0x97>
jmp    11ac <print_showing_whitespace+0x9c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <print_showing_whitespace+0x13>
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_showing_whitespace>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
lea    0xed9(%rip),%r14
lea    0xeca(%rip),%r15
jmp    114e <print_showing_whitespace+0x2e>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
movsbl (%rbx),%edi
cmp    $0x9,%edi
je     1170 <print_showing_whitespace+0x50>
cmp    $0x20,%dil
je     1140 <print_showing_whitespace+0x20>
test   %dil,%dil
je     1175 <print_showing_whitespace+0x55>
call   1030 <putchar@plt>
add    $0x1,%rbx
jmp    114e <print_showing_whitespace+0x2e>
nopl   0x0(%rax)
mov    %r14,%rdi
jmp    1143 <print_showing_whitespace+0x23>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"<space>\00"
@.str.1 = [6 x i8] c"<tab>\00"
define void @print_showing_whitespace(i8* nocapture %0) {
br label %2
2: ; preds = %15, %1
%3 = phi i64 [ %16, %15 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
switch i8 %5, label %12 [
i8 0, label %6
i8 32, label %8
i8 9, label %10
]
6: ; preds = %2
%7 = tail call i32 @putchar(i32 10)
ret void
8: ; preds = %2
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %15
10: ; preds = %2
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %15
12: ; preds = %2
%13 = sext i8 %5 to i32
%14 = tail call i32 @putchar(i32 %13)
br label %15
15: ; preds = %8, %12, %10
%16 = add nuw i64 %3, 1
br label %2
}