#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*/ fputc(char const, int /*<<< orphan*/ *);
void pq(FILE *f, const char *c) {
  while (*c) {
    if (*c == '"')
      fprintf(f, "\\\"");
    else {
      fputc(*c, f);
    }
    c++;
  }
}


x86 assembly (clang, -O0):
<pq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1185 <pq+0x65>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    1162 <pq+0x42>
mov    -0x8(%rbp),%rdi
lea    0xea8(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1174 <pq+0x54>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1030 <fputc@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1130 <pq+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pq>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xece(%rip),%r15
jmp    1159 <pq+0x39>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %r14,%rcx
call   1040 <fwrite@plt>
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x22,%al
je     1140 <pq+0x20>
test   %al,%al
je     1175 <pq+0x55>
movsbl %al,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
add    $0x1,%rbx
jmp    1159 <pq+0x39>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"\\\22\00"
define void @pq(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %22, %2
%6 = load i8*, i8** %4
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %25
9: ; preds = %5
%10 = load i8*, i8** %4
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 34
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = load i32*, i32** %3
%16 = call i32 @fprintf(i32* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %22
17: ; preds = %9
%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 %22
22: ; preds = %17, %14
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %4
br label %5
25: ; preds = %5
ret void
}

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