#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);
scalar_t__ strchr(char const *, char const);
char *find_chars_or_comment(const char *s, const char *chars) {
  int was_space = 0;
  while (*s && (!chars || !strchr(chars, *s)) &&
         !(was_space && strchr(";", *s))) {
    was_space = isspace((unsigned char)(*s));
    s++;
  }
  return (char *)s;
}


x86 assembly (clang, -O0):
<find_chars_or_comment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x15(%rbp)
je     11ad <find_chars_or_comment+0x8d>
cmpq   $0x0,-0x10(%rbp)
je     1179 <find_chars_or_comment+0x59>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
movsbl (%rax),%esi
call   1030 <strchr@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x15(%rbp)
jne    11ad <find_chars_or_comment+0x8d>
xor    %eax,%eax
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x16(%rbp)
je     11a5 <find_chars_or_comment+0x85>
mov    -0x8(%rbp),%rax
lea    0xe6d(%rip),%rdi
movsbl (%rax),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x16(%rbp)
mov    -0x16(%rbp),%al
xor    $0xff,%al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    11bd <find_chars_or_comment+0x9d>
jmp    11dd <find_chars_or_comment+0xbd>
mov    -0x8(%rbp),%rax
movzbl (%rax),%edi
call   1040 <isspace@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1137 <find_chars_or_comment+0x17>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_chars_or_comment>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     117f <find_chars_or_comment+0x5f>
mov    %rsi,%r14
xor    %ebp,%ebp
lea    0xec4(%rip),%r15
jmp    1156 <find_chars_or_comment+0x36>
xchg   %ax,%ax
movzbl (%rbx),%edi
call   1040 <isspace@plt>
mov    %eax,%ebp
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     117f <find_chars_or_comment+0x5f>
test   %r14,%r14
je     116b <find_chars_or_comment+0x4b>
movsbl %al,%esi
mov    %r14,%rdi
call   1030 <strchr@plt>
test   %rax,%rax
jne    117f <find_chars_or_comment+0x5f>
test   %ebp,%ebp
je     1140 <find_chars_or_comment+0x20>
movsbl (%rbx),%esi
mov    %r15,%rdi
call   1030 <strchr@plt>
test   %rax,%rax
je     1140 <find_chars_or_comment+0x20>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c";\00"
define i8* @find_chars_or_comment(i8* %0, i8* %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 = %33, %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 %31
11: ; preds = %6
%12 = load i8*, i8** %4
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = load i8*, i8** %4
%16 = load i8*, i8** %3
%17 = load i8, i8* %16
%18 = call i64 @strchr(i8* %15, i8 signext %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %31, label %20
20: ; preds = %14, %11
%21 = load i32, i32* %5
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = load i8*, i8** %3
%25 = load i8, i8* %24
%26 = call i64 @strchr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8 signext %25)
%27 = icmp ne i64 %26, 0
br label %28
28: ; preds = %23, %20
%29 = phi i1 [ false, %20 ], [ %27, %23 ]
%30 = xor i1 %29, true
br label %31
31: ; preds = %28, %14, %6
%32 = phi i1 [ false, %14 ], [ false, %6 ], [ %30, %28 ]
br i1 %32, label %33, label %39
33: ; preds = %31
%34 = load i8*, i8** %3
%35 = load i8, i8* %34
%36 = call i32 @isspace(i8 zeroext %35)
store i32 %36, i32* %5
%37 = load i8*, i8** %3
%38 = getelementptr inbounds i8, i8* %37, i32 1
store i8* %38, i8** %3
br label %6
39: ; preds = %31
%40 = load i8*, i8** %3
ret i8* %40
}

LLVM IR (-O2):
@.str = [2 x i8] c";\00"
define i8* @find_chars_or_comment(i8* %0, i8* %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %26, label %5
5: ; preds = %2
%6 = icmp eq i8* %1, null
br label %7
7: ; preds = %5, %20
%8 = phi i8 [ %3, %5 ], [ %24, %20 ]
%9 = phi i32 [ 0, %5 ], [ %22, %20 ]
%10 = phi i8* [ %0, %5 ], [ %23, %20 ]
br i1 %6, label %14, label %11
11: ; preds = %7
%12 = tail call i64 @strchr(i8* %1, i8 signext %8)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %26
14: ; preds = %11, %7
%15 = icmp eq i32 %9, 0
br i1 %15, label %20, label %16
16: ; preds = %14
%17 = load i8, i8* %10
%18 = tail call i64 @strchr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8 signext %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %26
20: ; preds = %14, %16
%21 = load i8, i8* %10
%22 = tail call i32 @isspace(i8 zeroext %21)
%23 = getelementptr inbounds i8, i8* %10, i64 1
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 0
br i1 %25, label %26, label %7
26: ; preds = %16, %11, %20, %2
%27 = phi i8* [ %0, %2 ], [ %23, %20 ], [ %10, %11 ], [ %10, %16 ]
ret i8* %27
}