#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 /*<<< orphan*/ putc(char, int /*<<< orphan*/ *);
void tplt_linedir(FILE *out, int lineno, char *filename) {
  fprintf(out, "#line %d \"", lineno);
  while (*filename) {
    if (*filename == '\\')
      putc('\\', out);
    putc(*filename, out);
    filename++;
  }
  fprintf(out, "\"\n");
}


x86 assembly (clang, -O0):
<tplt_linedir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xebf(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1196 <tplt_linedir+0x76>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    1173 <tplt_linedir+0x53>
mov    -0x8(%rbp),%rsi
mov    $0x5c,%edi
call   1030 <putc@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1030 <putc@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1148 <tplt_linedir+0x28>
mov    -0x8(%rbp),%rdi
lea    0xe6a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tplt_linedir>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %esi,%edx
mov    %rdi,%r14
lea    0xebd(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    116f <tplt_linedir+0x3f>
nopl   0x0(%rax)
mov    $0x5c,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
movzbl (%rbx),%eax
movsbl %al,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x5c,%al
je     1150 <tplt_linedir+0x20>
test   %al,%al
jne    1160 <tplt_linedir+0x30>
lea    0xe8a(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <fwrite@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"#line %d \22\00"
@.str.1 = [3 x i8] c"\22\0A\00"
define void @tplt_linedir(i32* %0, i32 %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8*
store i32* %0, i32** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %5
%9 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %10
10: ; preds = %22, %3
%11 = load i8*, i8** %6
%12 = load i8, i8* %11
%13 = icmp ne i8 %12, 0
br i1 %13, label %14, label %29
14: ; preds = %10
%15 = load i8*, i8** %6
%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 = %14
%20 = load i32*, i32** %4
%21 = call i32 @putc(i8 signext 92, i32* %20)
br label %22
22: ; preds = %19, %14
%23 = load i8*, i8** %6
%24 = load i8, i8* %23
%25 = load i32*, i32** %4
%26 = call i32 @putc(i8 signext %24, i32* %25)
%27 = load i8*, i8** %6
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %6
br label %10
29: ; preds = %10
%30 = load i32*, i32** %4
%31 = call i32 (i32*, i8*, ...) @fprintf(i32* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"#line %d \22\00"
@.str.1 = [3 x i8] c"\22\0A\00"
define void @tplt_linedir(i32* nocapture %0, i32 %1, i8* nocapture %2) {
%4 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1)
br label %5
5: ; preds = %11, %3
%6 = phi i8* [ %2, %3 ], [ %14, %11 ]
%7 = load i8, i8* %6
switch i8 %7, label %11 [
i8 0, label %15
i8 92, label %8
]
8: ; preds = %5
%9 = tail call i32 @putc(i8 signext 92, i32* %0)
%10 = load i8, i8* %6
br label %11
11: ; preds = %5, %8
%12 = phi i8 [ %7, %5 ], [ %10, %8 ]
%13 = tail call i32 @putc(i8 signext %12, i32* %0)
%14 = getelementptr inbounds i8, i8* %6, i64 1
br label %5
15: ; preds = %5
%16 = 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)
ret void
}