#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 */
int /*<<< orphan*/ diagnostics(int, char *, char *);
char *NextAmpersand(const char *t) {
  char *s;
  int escaped = 0;
  s = (char *)t;
  diagnostics(5, "TabularNextAmpersand seeking '&' in '%s'", s);
  while (s && *s != '\0' && (*s != '&' || (*s == '&' && escaped))) {
    escaped = (*s == '\\') ? 1 : 0;
    s++;
  }
  return s;
}


x86 assembly (clang, -O0):
<NextAmpersand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
mov    $0x5,%edi
lea    0xec5(%rip),%rsi
call   1030 <diagnostics@plt>
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x15(%rbp)
je     11a5 <NextAmpersand+0x95>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x15(%rbp)
je     11a5 <NextAmpersand+0x95>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x26,%ecx
mov    %al,-0x16(%rbp)
jne    119f <NextAmpersand+0x8f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x26,%ecx
mov    %al,-0x17(%rbp)
jne    1199 <NextAmpersand+0x89>
cmpl   $0x0,-0x14(%rbp)
setne  %al
mov    %al,-0x17(%rbp)
mov    -0x17(%rbp),%al
mov    %al,-0x16(%rbp)
mov    -0x16(%rbp),%al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    11b5 <NextAmpersand+0xa5>
jmp    11dd <NextAmpersand+0xcd>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x5c,%edx
cmove  %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1140 <NextAmpersand+0x30>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NextAmpersand>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
mov    $0x5,%edi
mov    %rbx,%rdx
call   1030 <diagnostics@plt>
xor    %eax,%eax
test   %rbx,%rbx
jne    1150 <NextAmpersand+0x40>
xor    %ebx,%ebx
jmp    115c <NextAmpersand+0x4c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
test   %eax,%eax
je     115c <NextAmpersand+0x4c>
xor    %eax,%eax
cmp    $0x5c,%cl
sete   %al
add    $0x1,%rbx
movzbl (%rbx),%ecx
cmp    $0x26,%cl
je     1140 <NextAmpersand+0x30>
test   %cl,%cl
jne    1144 <NextAmpersand+0x34>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [41 x i8] c"TabularNextAmpersand seeking '&' in '%s'\00"
define i8* @NextAmpersand(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %4
%5 = load i8*, i8** %2
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @diagnostics(i32 5, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %35, %1
%9 = load i8*, i8** %3
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %33
11: ; preds = %8
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %33
16: ; preds = %11
%17 = load i8*, i8** %3
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 38
br i1 %20, label %31, label %21
21: ; preds = %16
%22 = load i8*, i8** %3
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 38
br i1 %25, label %26, label %29
26: ; preds = %21
%27 = load i32, i32* %4
%28 = icmp ne i32 %27, 0
br label %29
29: ; preds = %26, %21
%30 = phi i1 [ false, %21 ], [ %28, %26 ]
br label %31
31: ; preds = %29, %16
%32 = phi i1 [ true, %16 ], [ %30, %29 ]
br label %33
33: ; preds = %31, %11, %8
%34 = phi i1 [ false, %11 ], [ false, %8 ], [ %32, %31 ]
br i1 %34, label %35, label %44
35: ; preds = %33
%36 = load i8*, i8** %3
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 92
%40 = zext i1 %39 to i64
%41 = select i1 %39, i32 1, i32 0
store i32 %41, i32* %4
%42 = load i8*, i8** %3
%43 = getelementptr inbounds i8, i8* %42, i32 1
store i8* %43, i8** %3
br label %8
44: ; preds = %33
%45 = load i8*, i8** %3
ret i8* %45
}

LLVM IR (-O2):
@.str = [41 x i8] c"TabularNextAmpersand seeking '&' in '%s'\00"
define i8* @NextAmpersand(i8* %0) {
%2 = tail call i32 @diagnostics(i32 5, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = icmp eq i8* %0, null
br i1 %3, label %14, label %4
4: ; preds = %1, %10
%5 = phi i32 [ %12, %10 ], [ 0, %1 ]
%6 = phi i8* [ %13, %10 ], [ %0, %1 ]
%7 = load i8, i8* %6
switch i8 %7, label %10 [
i8 0, label %14
i8 38, label %8
]
8: ; preds = %4
%9 = icmp eq i32 %5, 0
br i1 %9, label %14, label %10
10: ; preds = %4, %8
%11 = icmp eq i8 %7, 92
%12 = zext i1 %11 to i32
%13 = getelementptr inbounds i8, i8* %6, i64 1
br label %4
14: ; preds = %8, %4, %1
%15 = phi i8* [ null, %1 ], [ %6, %4 ], [ %6, %8 ]
ret i8* %15
}