#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*/ parse_component_severity_token(char const *, char const *);
char const *strchr(char const *, char);
void dvbindex_log_parse_severity(const char *start) {
  const char *end;
  while ((end = strchr(start, ',')) != 0) {
    parse_component_severity_token(start, end);
    start = end + 1;
  }
  parse_component_severity_token(start, strchr(start, '\0'));
}


x86 assembly (clang, -O0):
<dvbindex_log_parse_severity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2c,%esi
call   1030 <strchr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1166 <dvbindex_log_parse_severity+0x46>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <parse_component_severity_token@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    112c <dvbindex_log_parse_severity+0xc>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <strchr@plt>
mov    -0x18(%rbp),%rdi
mov    %rax,%rsi
call   1040 <parse_component_severity_token@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dvbindex_log_parse_severity>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x2c,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1177 <dvbindex_log_parse_severity+0x47>
mov    %rax,%r14
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <parse_component_severity_token@plt>
mov    %r14,%rbx
add    $0x1,%rbx
mov    %rbx,%rdi
mov    $0x2c,%esi
call   1040 <strchr@plt>
mov    %rax,%r14
test   %rax,%rax
jne    1150 <dvbindex_log_parse_severity+0x20>
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    (%rax,%rbx,1),%rsi
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <parse_component_severity_token@plt>

LLVM IR (-O0):
define void @dvbindex_log_parse_severity(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
br label %4
4: ; preds = %8, %1
%5 = load i8*, i8** %2
%6 = call i8* @strchr(i8* %5, i8 signext 44)
store i8* %6, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %14
8: ; preds = %4
%9 = load i8*, i8** %2
%10 = load i8*, i8** %3
%11 = call i32 @parse_component_severity_token(i8* %9, i8* %10)
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 1
store i8* %13, i8** %2
br label %4
14: ; preds = %4
%15 = load i8*, i8** %2
%16 = load i8*, i8** %2
%17 = call i8* @strchr(i8* %16, i8 signext 0)
%18 = call i32 @parse_component_severity_token(i8* %15, i8* %17)
ret void
}

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