#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 isspace(unsigned char);
char *find_char_or_comment(const char *s, char c) {
  int was_whitespace = 0;
  while (*s && *s != c && !(was_whitespace && *s == ';')) {
    was_whitespace = isspace((unsigned char)(*s));
    s++;
  }
  return (char *)s;
}


x86 assembly (clang, -O0):
<find_char_or_comment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     117d <find_char_or_comment+0x6d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
movsbl -0x9(%rbp),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x11(%rbp)
je     117d <find_char_or_comment+0x6d>
xor    %eax,%eax
cmpl   $0x0,-0x10(%rbp)
mov    %al,-0x12(%rbp)
je     1175 <find_char_or_comment+0x65>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3b,%eax
sete   %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
xor    $0xff,%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    118d <find_char_or_comment+0x7d>
jmp    11ad <find_char_or_comment+0x9d>
mov    -0x8(%rbp),%rax
movzbl (%rax),%edi
call   1030 <isspace@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1129 <find_char_or_comment+0x19>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_char_or_comment>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%cl
test   %cl,%cl
je     1152 <find_char_or_comment+0x42>
mov    %esi,%ebp
cmp    %bpl,%cl
je     1152 <find_char_or_comment+0x42>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nop
test   %eax,%eax
je     1139 <find_char_or_comment+0x29>
cmp    $0x3b,%cl
je     1152 <find_char_or_comment+0x42>
movzbl %cl,%edi
call   1030 <isspace@plt>
movzbl 0x1(%rbx),%ecx
add    $0x1,%rbx
test   %cl,%cl
je     1152 <find_char_or_comment+0x42>
cmp    %bpl,%cl
jne    1130 <find_char_or_comment+0x20>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i8* @find_char_or_comment(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i32
store i8* %0, i8** %3
store i8 %1, i8* %4
store i32 0, i32* %5
br label %6
6: ; preds = %31, %2
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %29
11: ; preds = %6
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = load i8, i8* %4
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %14, %16
br i1 %17, label %18, label %29
18: ; preds = %11
%19 = load i32, i32* %5
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %26
21: ; preds = %18
%22 = load i8*, i8** %3
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 59
br label %26
26: ; preds = %21, %18
%27 = phi i1 [ false, %18 ], [ %25, %21 ]
%28 = xor i1 %27, true
br label %29
29: ; preds = %26, %11, %6
%30 = phi i1 [ false, %11 ], [ false, %6 ], [ %28, %26 ]
br i1 %30, label %31, label %37
31: ; preds = %29
%32 = load i8*, i8** %3
%33 = load i8, i8* %32
%34 = call i32 @isspace(i8 zeroext %33)
store i32 %34, i32* %5
%35 = load i8*, i8** %3
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %3
br label %6
37: ; preds = %29
%38 = load i8*, i8** %3
ret i8* %38
}

LLVM IR (-O2):
define i8* @find_char_or_comment(i8* %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
%5 = icmp eq i8 %3, %1
%6 = or i1 %4, %5
br i1 %6, label %21, label %7
7: ; preds = %2, %14
%8 = phi i8 [ %17, %14 ], [ %3, %2 ]
%9 = phi i32 [ %15, %14 ], [ 0, %2 ]
%10 = phi i8* [ %16, %14 ], [ %0, %2 ]
%11 = icmp ne i32 %9, 0
%12 = icmp eq i8 %8, 59
%13 = select i1 %11, i1 %12, i1 false
br i1 %13, label %21, label %14
14: ; preds = %7
%15 = tail call i32 @isspace(i8 zeroext %8)
%16 = getelementptr inbounds i8, i8* %10, i64 1
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
%19 = icmp eq i8 %17, %1
%20 = or i1 %18, %19
br i1 %20, label %21, label %7
21: ; preds = %7, %14, %2
%22 = phi i8* [ %0, %2 ], [ %16, %14 ], [ %10, %7 ]
ret i8* %22
}