#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*/ rpgp_is_newline(char);
char *rpgp_find_char(char *p, char c) {
  while (!rpgp_is_newline(*p)) {
    if (*p == c) {
      return p;
    }
    p++;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<rpgp_find_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <rpgp_is_newline@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1143 <rpgp_find_char+0x33>
jmp    1174 <rpgp_find_char+0x64>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    1163 <rpgp_find_char+0x53>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    117c <rpgp_find_char+0x6c>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1122 <rpgp_find_char+0x12>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rpgp_find_char>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
movsbl (%rdi),%edi
nopl   0x0(%rax,%rax,1)
call   1030 <rpgp_is_newline@plt>
test   %eax,%eax
jne    1138 <rpgp_find_char+0x28>
cmp    %bpl,(%rbx)
je     113a <rpgp_find_char+0x2a>
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
jmp    1120 <rpgp_find_char+0x10>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @rpgp_find_char(i8* %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = tail call i32 @rpgp_is_newline(i8 signext %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %15
6: ; preds = %2, %10
%7 = phi i8* [ %11, %10 ], [ %0, %2 ]
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, %1
br i1 %9, label %15, label %10
10: ; preds = %6
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = tail call i32 @rpgp_is_newline(i8 signext %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %6, label %15
15: ; preds = %6, %10, %2
%16 = phi i8* [ null, %2 ], [ null, %10 ], [ %7, %6 ]
ret i8* %16
}