#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 *, ...);
int strlen(char *);
void outputNroffLine(FILE *outputfile, char *line) {
  int i = 0;
  for (i = 0; i < strlen(line); i++) {
    if (line[i] == '\\') {
      fprintf(outputfile, "\\\\");
    } else if (i == 0 && line[0] == '.') {
      fprintf(outputfile, " .");
    } else if (i == 0 && line[0] == '\'') {
      fprintf(outputfile, " '");
    } else {
      fprintf(outputfile, "%c", line[i]);
    }
  }
  fprintf(outputfile, "\n");
  return;
}


x86 assembly (clang, -O0):
<outputNroffLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    1223 <outputNroffLine+0x103>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5c,%eax
jne    1186 <outputNroffLine+0x66>
mov    -0x8(%rbp),%rdi
lea    0xe86(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    1210 <outputNroffLine+0xf0>
cmpl   $0x0,-0x14(%rbp)
jne    11b7 <outputNroffLine+0x97>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    11b7 <outputNroffLine+0x97>
mov    -0x8(%rbp),%rdi
lea    0xe58(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    120b <outputNroffLine+0xeb>
cmpl   $0x0,-0x14(%rbp)
jne    11e8 <outputNroffLine+0xc8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x27,%eax
jne    11e8 <outputNroffLine+0xc8>
mov    -0x8(%rbp),%rdi
lea    0xe2a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    1206 <outputNroffLine+0xe6>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xe0a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    120b <outputNroffLine+0xeb>
jmp    1210 <outputNroffLine+0xf0>
jmp    1215 <outputNroffLine+0xf5>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113e <outputNroffLine+0x1e>
mov    -0x8(%rbp),%rdi
lea    0xdde(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outputNroffLine>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    11fc <outputNroffLine+0xcc>
movsbl (%r12),%edi
cmp    $0x5c,%edi
je     116d <outputNroffLine+0x3d>
cmp    $0x2e,%dil
je     1176 <outputNroffLine+0x46>
cmp    $0x27,%dil
jne    1191 <outputNroffLine+0x61>
lea    0xe9b(%rip),%rdi
jmp    117d <outputNroffLine+0x4d>
lea    0xe8c(%rip),%rdi
jmp    117d <outputNroffLine+0x4d>
lea    0xe86(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fwrite@plt>
jmp    1199 <outputNroffLine+0x69>
mov    %r14,%rsi
call   1040 <fputc@plt>
mov    %r12,%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jl     11fc <outputNroffLine+0xcc>
mov    $0x1,%ebx
lea    0xe4e(%rip),%r15
jmp    11db <outputNroffLine+0xab>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rsi
call   1040 <fputc@plt>
add    $0x1,%rbx
mov    %r12,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    11fc <outputNroffLine+0xcc>
movsbl (%r12,%rbx,1),%edi
cmp    $0x5c,%edi
jne    11c0 <outputNroffLine+0x90>
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %r14,%rcx
call   1050 <fwrite@plt>
jmp    11c8 <outputNroffLine+0x98>
mov    $0xa,%edi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <fputc@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"\\\\\00"
@.str.1 = [3 x i8] c" .\00"
@.str.2 = [3 x i8] c" '\00"
define void @outputNroffLine(i32* nocapture %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %34
5: ; preds = %2
%6 = load i8, i8* %1
switch i8 %6, label %11 [
i8 92, label %14
i8 46, label %9
i8 39, label %7
]
7: ; preds = %5
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i64 2, i64 1, i32* %0)
br label %16
9: ; preds = %5
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64 2, i64 1, i32* %0)
br label %16
11: ; preds = %5
%12 = sext i8 %6 to i32
%13 = tail call i32 @fputc(i32 %12, i32* %0)
br label %16
14: ; preds = %5
%15 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 2, i64 1, i32* %0)
br label %16
16: ; preds = %14, %11, %9, %7
%17 = tail call i32 @strlen(i8* %1)
%18 = icmp sgt i32 %17, 1
br i1 %18, label %19, label %34
19: ; preds = %16, %29
%20 = phi i64 [ %30, %29 ], [ 1, %16 ]
%21 = getelementptr inbounds i8, i8* %1, i64 %20
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 92
br i1 %23, label %24, label %26
24: ; preds = %19
%25 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 2, i64 1, i32* %0)
br label %29
26: ; preds = %19
%27 = sext i8 %22 to i32
%28 = tail call i32 @fputc(i32 %27, i32* %0)
br label %29
29: ; preds = %24, %26
%30 = add nuw nsw i64 %20, 1
%31 = tail call i32 @strlen(i8* %1)
%32 = sext i32 %31 to i64
%33 = icmp slt i64 %30, %32
br i1 %33, label %19, label %34
34: ; preds = %29, %16, %2
%35 = tail call i32 @fputc(i32 10, i32* %0)
ret void
}