#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(char const);
void _TIFFprintAscii(FILE *fd, const char *cp) {
  for (; *cp != '\0'; cp++) {
    const char *tp;
    if (isprint(*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 = %58, %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 %61
11: ; preds = %6
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = call i64 @isprint(i8 signext %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %11
%17 = load i8*, i8** %4
%18 = load i8, i8* %17
%19 = load i32*, i32** %3
%20 = call i32 @fputc(i8 signext %18, i32* %19)
br label %58
21: ; preds = %11
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %5
br label %22
22: ; preds = %37, %21
%23 = load i8*, i8** %5
%24 = load i8, i8* %23
%25 = icmp ne i8 %24, 0
br i1 %25, label %26, label %40
26: ; preds = %22
%27 = load i8*, i8** %5
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %5
%29 = load i8, i8* %27
%30 = sext i8 %29 to i32
%31 = load i8*, i8** %4
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %30, %33
br i1 %34, label %35, label %36
35: ; preds = %26
br label %40
36: ; preds = %26
br label %37
37: ; preds = %36
%38 = load i8*, i8** %5
%39 = getelementptr inbounds i8, i8* %38, i32 1
store i8* %39, i8** %5
br label %22
40: ; preds = %35, %22
%41 = load i8*, i8** %5
%42 = load i8, i8* %41
%43 = icmp ne i8 %42, 0
br i1 %43, label %44, label %49
44: ; preds = %40
%45 = load i32*, i32** %3
%46 = load i8*, i8** %5
%47 = load i8, i8* %46
%48 = call i32 @fprintf(i32* %45, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %47)
br label %57
49: ; preds = %40
%50 = load i32*, i32** %3
%51 = load i8*, i8** %4
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = and i32 %53, 255
%55 = trunc i32 %54 to i8
%56 = call i32 @fprintf(i32* %50, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8 signext %55)
br label %57
57: ; preds = %49, %44
br label %58
58: ; preds = %57, %16
%59 = load i8*, i8** %4
%60 = getelementptr inbounds i8, i8* %59, i32 1
store i8* %60, i8** %4
br label %6
61: ; 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 %35, label %5
5: ; preds = %2, %31
%6 = phi i8 [ %33, %31 ], [ %3, %2 ]
%7 = phi i8* [ %32, %31 ], [ %1, %2 ]
%8 = tail call i64 @isprint(i8 signext %6)
%9 = icmp eq i64 %8, 0
%10 = load i8, i8* %7
br i1 %9, label %11, label %14
11: ; preds = %5
%12 = add i8 %10, -8
%13 = icmp ult i8 %12, 6
br i1 %13, label %16, label %29
14: ; preds = %5
%15 = tail call i32 @fputc(i8 signext %10, i32* %0)
br label %31
16: ; preds = %11
%17 = lshr i8 47, %12
%18 = and i8 %17, 1
%19 = icmp eq i8 %18, 0
br i1 %19, label %29, label %20
20: ; preds = %16
%21 = sext i8 %12 to i64
%22 = shl i64 %21, 2
%23 = call i8* @llvm.load.relative.i64(i8* bitcast ([6 x i32]* @reltable._TIFFprintAscii to i8*), i64 %22)
%24 = getelementptr inbounds i8, i8* %23, i64 1
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 0
br i1 %26, label %29, label %27
27: ; preds = %20
%28 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %25)
br label %31
29: ; preds = %16, %11, %20
%30 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8 signext %10)
br label %31
31: ; preds = %27, %29, %14
%32 = getelementptr inbounds i8, i8* %7, i64 1
%33 = load i8, i8* %32
%34 = icmp eq i8 %33, 0
br i1 %34, label %35, label %5
35: ; preds = %31, %2
ret void
}