#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*/ prcode(int /*<<< orphan*/ *, char *, ...);
void generatePreprocLine(int linenr, const char *fname, FILE *fp) {
  prcode(fp, "#line %d \"", linenr);
  while (*fname != '\0') {
    prcode(fp, "%c", *fname);
    if (*fname == '\\')
      prcode(fp, "\\");
    ++fname;
  }
  prcode(fp, "\"\n");
}


x86 assembly (clang, -O0):
<generatePreprocLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xecf(%rip),%rsi
mov    $0x0,%al
call   1030 <prcode@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1194 <generatePreprocLine+0x84>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
movsbl (%rax),%edx
lea    0xeb1(%rip),%rsi
mov    $0x0,%al
call   1030 <prcode@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    1183 <generatePreprocLine+0x73>
mov    -0x18(%rbp),%rdi
lea    0xe92(%rip),%rsi
mov    $0x0,%al
call   1030 <prcode@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1138 <generatePreprocLine+0x28>
mov    -0x18(%rbp),%rdi
lea    0xe71(%rip),%rsi
mov    $0x0,%al
call   1030 <prcode@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generatePreprocLine>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%edx
lea    0xed9(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <prcode@plt>
mov    (%rbx),%al
test   %al,%al
je     1180 <generatePreprocLine+0x70>
add    $0x1,%rbx
lea    0xec9(%rip),%r15
lea    0xec5(%rip),%r12
jmp    115b <generatePreprocLine+0x4b>
nopl   0x0(%rax,%rax,1)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1180 <generatePreprocLine+0x70>
movsbl %al,%edx
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <prcode@plt>
cmpb   $0x5c,-0x1(%rbx)
jne    1150 <generatePreprocLine+0x40>
mov    %r14,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <prcode@plt>
jmp    1150 <generatePreprocLine+0x40>
lea    0xe89(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <prcode@plt>

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

LLVM IR (-O2):
@.str = [11 x i8] c"#line %d \22\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [2 x i8] c"\\\00"
@.str.3 = [3 x i8] c"\22\0A\00"
define void @generatePreprocLine(i32 %0, i8* nocapture %1, i32* %2) {
%4 = tail call i32 (i32*, i8*, ...) @prcode(i32* %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = load i8, i8* %1
%6 = icmp eq i8 %5, 0
br i1 %6, label %20, label %7
7: ; preds = %3, %16
%8 = phi i8 [ %18, %16 ], [ %5, %3 ]
%9 = phi i8* [ %17, %16 ], [ %1, %3 ]
%10 = sext i8 %8 to i32
%11 = tail call i32 (i32*, i8*, ...) @prcode(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 92
br i1 %13, label %14, label %16
14: ; preds = %7
%15 = tail call i32 (i32*, i8*, ...) @prcode(i32* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %7
%17 = getelementptr inbounds i8, i8* %9, i64 1
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %7
20: ; preds = %16, %3
%21 = tail call i32 (i32*, i8*, ...) @prcode(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
ret void
}