#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const);
int /*<<< orphan*/ fputc(char const, int /*<<< orphan*/ *);
scalar_t__ isprint(int);
void _TIFFprintAscii(FILE *fd, const char *cp) {
  for (; *cp != '\0'; cp++) {
    const char *tp;
    if (isprint((int)*cp)) {
      fputc(*cp, fd);
      continue;
    }
    for (tp = "\tt\bb\rr\nn\vv"; *tp; tp++)
      if (*tp++ == *cp)
        break;
    if (*tp)
      fprintf(fd, "\\%c", *tp);
    else
      fprintf(fd, "\\%03o", *cp & 0xff);
  }
}


x86 assembly (clang, -O0):
<_TIFFprintAscii>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     122f <_TIFFprintAscii+0xff>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1050 <isprint@plt>
cmp    $0x0,%rax
je     117d <_TIFFprintAscii+0x4d>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1030 <fputc@plt>
jmp    121e <_TIFFprintAscii+0xee>
lea    0xe7c(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     11d1 <_TIFFprintAscii+0xa1>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    11bb <_TIFFprintAscii+0x8b>
jmp    11d1 <_TIFFprintAscii+0xa1>
jmp    11c0 <_TIFFprintAscii+0x90>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1188 <_TIFFprintAscii+0x58>
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     11fa <_TIFFprintAscii+0xca>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
lea    0xe1e(%rip),%rsi
movsbl (%rax),%edx
call   1040 <fprintf@plt>
jmp    1219 <_TIFFprintAscii+0xe9>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
and    $0xff,%eax
lea    0xdfe(%rip),%rsi
movsbl %al,%edx
call   1040 <fprintf@plt>
jmp    121e <_TIFFprintAscii+0xee>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1140 <_TIFFprintAscii+0x10>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_TIFFprintAscii>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    (%rsi),%al
test   %al,%al
je     11e0 <_TIFFprintAscii+0xb0>
mov    %rsi,%rbx
mov    %rdi,%r14
add    $0x1,%rbx
mov    $0x2f,%ebp
lea    0xebd(%rip),%r13
lea    0xea9(%rip),%r15
lea    0xea6(%rip),%r12
jmp    1186 <_TIFFprintAscii+0x56>
nopl   0x0(%rax,%rax,1)
movsbl %cl,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     11e0 <_TIFFprintAscii+0xb0>
movsbl %al,%edi
call   1050 <isprint@plt>
movzbl -0x1(%rbx),%ecx
test   %rax,%rax
jne    1170 <_TIFFprintAscii+0x40>
lea    -0x8(%rcx),%eax
cmp    $0x6,%al
jae    11d0 <_TIFFprintAscii+0xa0>
movzbl %al,%edx
bt     %edx,%ebp
jae    11d0 <_TIFFprintAscii+0xa0>
movsbq %al,%rax
movslq 0x0(%r13,%rax,4),%rax
movzbl 0x1(%rax,%r13,1),%eax
test   %al,%al
je     11d0 <_TIFFprintAscii+0xa0>
movsbl %al,%edx
mov    %r14,%rdi
mov    %r15,%rsi
jmp    11d9 <_TIFFprintAscii+0xa9>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %cl,%edx
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <fprintf@plt>
jmp    117b <_TIFFprintAscii+0x4b>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"\09t\08b\0Dr\0An\0Bv\00"
@.str.1 = [4 x i8] c"\\%c\00"
@.str.2 = [6 x i8] c"\\%03o\00"
define void @_TIFFprintAscii(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
br label %6
6: ; preds = %59, %2
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %62
11: ; preds = %6
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = call i64 @isprint(i32 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %11
%18 = load i8*, i8** %4
%19 = load i8, i8* %18
%20 = load i32*, i32** %3
%21 = call i32 @fputc(i8 signext %19, i32* %20)
br label %59
22: ; preds = %11
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %5
br label %23
23: ; preds = %38, %22
%24 = load i8*, i8** %5
%25 = load i8, i8* %24
%26 = icmp ne i8 %25, 0
br i1 %26, label %27, label %41
27: ; preds = %23
%28 = load i8*, i8** %5
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %5
%30 = load i8, i8* %28
%31 = sext i8 %30 to i32
%32 = load i8*, i8** %4
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %31, %34
br i1 %35, label %36, label %37
36: ; preds = %27
br label %41
37: ; preds = %27
br label %38
38: ; preds = %37
%39 = load i8*, i8** %5
%40 = getelementptr inbounds i8, i8* %39, i32 1
store i8* %40, i8** %5
br label %23
41: ; preds = %36, %23
%42 = load i8*, i8** %5
%43 = load i8, i8* %42
%44 = icmp ne i8 %43, 0
br i1 %44, label %45, label %50
45: ; preds = %41
%46 = load i32*, i32** %3
%47 = load i8*, i8** %5
%48 = load i8, i8* %47
%49 = call i32 @fprintf(i32* %46, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %48)
br label %58
50: ; preds = %41
%51 = load i32*, i32** %3
%52 = load i8*, i8** %4
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = and i32 %54, 255
%56 = trunc i32 %55 to i8
%57 = call i32 @fprintf(i32* %51, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8 signext %56)
br label %58
58: ; preds = %50, %45
br label %59
59: ; preds = %58, %17
%60 = load i8*, i8** %4
%61 = getelementptr inbounds i8, i8* %60, i32 1
store i8* %61, i8** %4
br label %6
62: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"\09t\08b\0Dr\0An\0Bv\00"
@.str.1 = [4 x i8] c"\\%c\00"
@.str.2 = [6 x i8] c"\\%03o\00"
@reltable._TIFFprintAscii = [6 x i32] [i32 trunc (i64 sub (i64 ptrtoint (i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 2) to i64), i64 ptrtoint ([6 x i32]* @reltable._TIFFprintAscii to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str to i64), i64 ptrtoint ([6 x i32]* @reltable._TIFFprintAscii to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 6) to i64), i64 ptrtoint ([6 x i32]* @reltable._TIFFprintAscii to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 8) to i64), i64 ptrtoint ([6 x i32]* @reltable._TIFFprintAscii to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str to i64), i64 ptrtoint ([6 x i32]* @reltable._TIFFprintAscii to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 4) to i64), i64 ptrtoint ([6 x i32]* @reltable._TIFFprintAscii to i64)) to i32)]
define void @_TIFFprintAscii(i32* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %36, label %5
5: ; preds = %2, %32
%6 = phi i8 [ %34, %32 ], [ %3, %2 ]
%7 = phi i8* [ %33, %32 ], [ %1, %2 ]
%8 = sext i8 %6 to i32
%9 = tail call i64 @isprint(i32 %8)
%10 = icmp eq i64 %9, 0
%11 = load i8, i8* %7
br i1 %10, label %12, label %15
12: ; preds = %5
%13 = add i8 %11, -8
%14 = icmp ult i8 %13, 6
br i1 %14, label %17, label %30
15: ; preds = %5
%16 = tail call i32 @fputc(i8 signext %11, i32* %0)
br label %32
17: ; preds = %12
%18 = lshr i8 47, %13
%19 = and i8 %18, 1
%20 = icmp eq i8 %19, 0
br i1 %20, label %30, label %21
21: ; preds = %17
%22 = sext i8 %13 to i64
%23 = shl i64 %22, 2
%24 = call i8* @llvm.load.relative.i64(i8* bitcast ([6 x i32]* @reltable._TIFFprintAscii to i8*), i64 %23)
%25 = getelementptr inbounds i8, i8* %24, i64 1
%26 = load i8, i8* %25
%27 = icmp eq i8 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %21
%29 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %26)
br label %32
30: ; preds = %17, %12, %21
%31 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8 signext %11)
br label %32
32: ; preds = %28, %30, %15
%33 = getelementptr inbounds i8, i8* %7, i64 1
%34 = load i8, i8* %33
%35 = icmp eq i8 %34, 0
br i1 %35, label %36, label %5
36: ; preds = %32, %2
ret void
}