#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, int len) {
  int i = 1;
  while (*c && i != len) {
    if (*c == '"')
      fprintf(f, "\\\"");
    else {
      fputc(*c, f);
      if (*c == '?' && c[1] == '?') {
        fprintf(f, "\" \"");
      }
    }
    c++;
    i++;
  }
}


x86 assembly (clang, -O0):
<pq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     115b <pq+0x3b>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    116b <pq+0x4b>
jmp    11f2 <pq+0xd2>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    1190 <pq+0x70>
mov    -0x8(%rbp),%rdi
lea    0xe7a(%rip),%rsi
call   1040 <fprintf@plt>
jmp    11d8 <pq+0xb8>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1030 <fputc@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3f,%eax
jne    11d3 <pq+0xb3>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x3f,%eax
jne    11d3 <pq+0xb3>
mov    -0x8(%rbp),%rdi
lea    0xe35(%rip),%rsi
call   1040 <fprintf@plt>
jmp    11d8 <pq+0xb8>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113a <pq+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pq>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    (%rsi),%al
test   %al,%al
je     11cd <pq+0xad>
mov    %edx,%r14d
cmp    $0x1,%edx
je     11cd <pq+0xad>
mov    %rsi,%rbx
mov    %rdi,%r15
add    $0xfffffffe,%r14d
xor    %ebp,%ebp
lea    0xeac(%rip),%r12
lea    0xea8(%rip),%r13
nopl   0x0(%rax,%rax,1)
cmp    $0x22,%al
jne    1180 <pq+0x60>
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r12,%rdi
jmp    11b0 <pq+0x90>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %al,%edi
mov    %r15,%rsi
call   1030 <fputc@plt>
cmpb   $0x3f,(%rbx,%rbp,1)
jne    11b8 <pq+0x98>
cmpb   $0x3f,0x1(%rbx,%rbp,1)
jne    11b8 <pq+0x98>
mov    $0x3,%esi
mov    $0x1,%edx
mov    %r13,%rdi
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rcx
call   1040 <fwrite@plt>
movzbl 0x1(%rbx,%rbp,1),%eax
test   %al,%al
je     11cd <pq+0xad>
lea    0x1(%rbp),%rcx
cmp    %ebp,%r14d
mov    %rcx,%rbp
jne    1160 <pq+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"\\\22\00"
@.str.1 = [4 x i8] c"\22 \22\00"
define void @pq(i32* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = load i8, i8* %1
%5 = icmp ne i8 %4, 0
%6 = icmp ne i32 %2, 1
%7 = and i1 %5, %6
br i1 %7, label %8, label %32
8: ; preds = %3, %25
%9 = phi i8 [ %28, %25 ], [ %4, %3 ]
%10 = phi i32 [ %27, %25 ], [ 1, %3 ]
%11 = phi i8* [ %26, %25 ], [ %1, %3 ]
%12 = icmp eq i8 %9, 34
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = 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 %25
15: ; preds = %8
%16 = tail call i32 @fputc(i8 signext %9, i32* %0)
%17 = load i8, i8* %11
%18 = icmp eq i8 %17, 63
br i1 %18, label %19, label %25
19: ; preds = %15
%20 = getelementptr inbounds i8, i8* %11, i64 1
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 63
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = tail call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 3, i64 1, i32* %0)
br label %25
25: ; preds = %15, %19, %23, %13
%26 = getelementptr inbounds i8, i8* %11, i64 1
%27 = add nuw nsw i32 %10, 1
%28 = load i8, i8* %26
%29 = icmp ne i8 %28, 0
%30 = icmp ne i32 %27, %2
%31 = select i1 %29, i1 %30, i1 false
br i1 %31, label %8, label %32
32: ; preds = %25, %3
ret void
}