#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 *);
int /*<<< orphan*/ putchar(char);
size_t strlen(char *);
void errprint(char *str) {
  size_t i;
  for (i = 0; i < strlen(str); i++) {
    if (str[i] == '\t')
      printf("    ");
    else if (str[i] != '\n')
      putchar(str[i]);
  }
}


x86 assembly (clang, -O0):
<errprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
jae    11cc <errprint+0x9c>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x9,%eax
jne    118b <errprint+0x5b>
lea    0xe7f(%rip),%rdi
call   1050 <printf@plt>
jmp    11b6 <errprint+0x86>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
je     11b1 <errprint+0x81>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
jmp    11b6 <errprint+0x86>
jmp    11bb <errprint+0x8b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1144 <errprint+0x14>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<errprint>:
push   %r15
push   %r14
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1184 <errprint+0x54>
mov    %rdi,%r15
mov    $0x1,%ebx
lea    0xeb6(%rip),%r14
cmp    $0xa,%al
je     1168 <errprint+0x38>
xchg   %ax,%ax
cmp    $0x9,%al
jne    1160 <errprint+0x30>
mov    %r14,%rdi
call   1050 <printf@plt>
jmp    1168 <errprint+0x38>
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
cmp    %rax,%rbx
jae    1184 <errprint+0x54>
movzbl (%r15,%rbx,1),%eax
add    $0x1,%rbx
cmp    $0xa,%al
jne    1150 <errprint+0x20>
jmp    1168 <errprint+0x38>
pop    %rbx
pop    %r14
pop    %r15
ret

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

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