#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 *strchr(char const *, char);
const char *find_group(const char *buf) {
  while (buf[0] == ';') {
    buf++;
  }
  buf = strchr(buf, ';');
  if (buf && buf[1]) {
    return buf + 1;
  } else {
    return NULL;
  }
}


x86 assembly (clang, -O0):
<find_group>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3b,%eax
jne    113d <find_group+0x2d>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111c <find_group+0xc>
mov    -0x10(%rbp),%rdi
mov    $0x3b,%esi
call   1030 <strchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     117c <find_group+0x6c>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
je     117c <find_group+0x6c>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1184 <find_group+0x74>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_group>:
push   %rax
add    $0xffffffffffffffff,%rdi
cs nopw 0x0(%rax,%rax,1)
nop
cmpb   $0x3b,0x1(%rdi)
lea    0x1(%rdi),%rdi
je     1120 <find_group+0x10>
mov    $0x3b,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1145 <find_group+0x35>
cmpb   $0x0,0x1(%rax)
je     1145 <find_group+0x35>
add    $0x1,%rax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

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