#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 */

/* Variables and functions */
char *scout_pchar(char const *);
const char *scout_query(const char *c) {
  const char *p = NULL;
  do {
    if (*c == '/' || *c == '?')
      p = c++;
    else if ((c = scout_pchar(c)) != NULL)
      p = c++;
  } while (c != NULL);
  return p;
}


x86 assembly (clang, -O0):
<scout_query>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     1144 <scout_query+0x34>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3f,%eax
jne    115c <scout_query+0x4c>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
jmp    118b <scout_query+0x7b>
mov    -0x8(%rbp),%rdi
call   1030 <scout_pchar@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
je     1186 <scout_query+0x76>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
jmp    118b <scout_query+0x7b>
jmp    1190 <scout_query+0x80>
cmpq   $0x0,-0x8(%rbp)
jne    1124 <scout_query+0x14>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scout_query>:
push   %rbx
mov    %rdi,%rax
xor    %ebx,%ebx
jmp    1127 <scout_query+0x17>
nopl   0x0(%rax,%rax,1)
mov    %rax,%rbx
add    $0x1,%rax
movzbl (%rax),%ecx
or     $0x10,%cl
cmp    $0x3f,%cl
je     1120 <scout_query+0x10>
mov    %rax,%rdi
call   1030 <scout_pchar@plt>
test   %rax,%rax
jne    1120 <scout_query+0x10>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @scout_query(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
store i8* null, i8** %3
br label %4
4: ; preds = %26, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 47
br i1 %8, label %14, label %9
9: ; preds = %4
%10 = load i8*, i8** %2
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 63
br i1 %13, label %14, label %17
14: ; preds = %9, %4
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %2
store i8* %15, i8** %3
br label %25
17: ; preds = %9
%18 = load i8*, i8** %2
%19 = call i8* @scout_pchar(i8* %18)
store i8* %19, i8** %2
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i8*, i8** %2
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %2
store i8* %22, i8** %3
br label %24
24: ; preds = %21, %17
br label %25
25: ; preds = %24, %14
br label %26
26: ; preds = %25
%27 = load i8*, i8** %2
%28 = icmp ne i8* %27, null
br i1 %28, label %4, label %29
29: ; preds = %26
%30 = load i8*, i8** %3
ret i8* %30
}

LLVM IR (-O2):
define i8* @scout_query(i8* %0) {
br label %2
2: ; preds = %9, %1
%3 = phi i8* [ %0, %1 ], [ %11, %9 ]
%4 = phi i8* [ null, %1 ], [ %10, %9 ]
%5 = load i8, i8* %3
switch i8 %5, label %6 [
i8 47, label %9
i8 63, label %9
]
6: ; preds = %2
%7 = tail call i8* @scout_pchar(i8* %3)
%8 = icmp eq i8* %7, null
br i1 %8, label %12, label %9
9: ; preds = %2, %2, %6
%10 = phi i8* [ %7, %6 ], [ %3, %2 ], [ %3, %2 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
br label %2
12: ; preds = %6
ret i8* %4
}