#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*/ assert(char *);
char *strdup(char *);
void parseLabels(char *s, char **l1, char **l2) {
  char *p = s;
  *l1 = NULL;
  *l2 = NULL;
  while (*p) {
    if (*p == ',') {
      *l2 = strdup(p + 1);
      *p = '\0';
      *l1 = strdup(s);
      *p = ',';
      break;
    }
    p++;
  }
  assert(*l1);
  assert(*l2);
}


x86 assembly (clang, -O0):
<parseLabels>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x20(%rbp),%rax
cmpb   $0x0,(%rax)
je     11bd <parseLabels+0x9d>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2c,%eax
jne    11ac <parseLabels+0x8c>
mov    -0x20(%rbp),%rdi
add    $0x1,%rdi
call   1040 <strdup@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
movb   $0x2c,(%rax)
jmp    11bd <parseLabels+0x9d>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1152 <parseLabels+0x32>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <assert@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1030 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseLabels>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
movq   $0x0,(%rsi)
movq   $0x0,(%rdx)
lea    0x1(%rdi),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl -0x1(%rbx),%eax
test   %al,%al
je     1180 <parseLabels+0x60>
cmp    $0x2c,%al
je     1162 <parseLabels+0x42>
add    $0x1,%rbx
jmp    1150 <parseLabels+0x30>
mov    %rbx,%rdi
call   1040 <strdup@plt>
mov    %rax,(%r14)
movb   $0x0,-0x1(%rbx)
mov    %r12,%rdi
call   1040 <strdup@plt>
mov    %rax,(%r15)
movb   $0x2c,-0x1(%rbx)
mov    (%r15),%rdi
call   1030 <assert@plt>
mov    (%r14),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <assert@plt>

LLVM IR (-O0):
define void @parseLabels(i8* %0, i8** %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
%7 = alloca i8*
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
%8 = load i8*, i8** %4
store i8* %8, i8** %7
%9 = load i8**, i8*** %5
store i8* null, i8** %9
%10 = load i8**, i8*** %6
store i8* null, i8** %10
br label %11
11: ; preds = %30, %3
%12 = load i8*, i8** %7
%13 = load i8, i8* %12
%14 = icmp ne i8 %13, 0
br i1 %14, label %15, label %33
15: ; preds = %11
%16 = load i8*, i8** %7
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 44
br i1 %19, label %20, label %30
20: ; preds = %15
%21 = load i8*, i8** %7
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = call i8* @strdup(i8* %22)
%24 = load i8**, i8*** %6
store i8* %23, i8** %24
%25 = load i8*, i8** %7
store i8 0, i8* %25
%26 = load i8*, i8** %4
%27 = call i8* @strdup(i8* %26)
%28 = load i8**, i8*** %5
store i8* %27, i8** %28
%29 = load i8*, i8** %7
store i8 44, i8* %29
br label %33
30: ; preds = %15
%31 = load i8*, i8** %7
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %7
br label %11
33: ; preds = %20, %11
%34 = load i8**, i8*** %5
%35 = load i8*, i8** %34
%36 = call i32 @assert(i8* %35)
%37 = load i8**, i8*** %6
%38 = load i8*, i8** %37
%39 = call i32 @assert(i8* %38)
ret void
}

LLVM IR (-O2):
define void @parseLabels(i8* nocapture %0, i8** nocapture %1, i8** nocapture %2) {
store i8* null, i8** %1
store i8* null, i8** %2
br label %4
4: ; preds = %11, %3
%5 = phi i8* [ %0, %3 ], [ %12, %11 ]
%6 = load i8, i8* %5
switch i8 %6, label %11 [
i8 0, label %13
i8 44, label %7
]
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
%9 = tail call i8* @strdup(i8* %8)
store i8* %9, i8** %2
store i8 0, i8* %5
%10 = tail call i8* @strdup(i8* %0)
store i8* %10, i8** %1
store i8 44, i8* %5
br label %13
11: ; preds = %4
%12 = getelementptr inbounds i8, i8* %5, i64 1
br label %4
13: ; preds = %4, %7
%14 = load i8*, i8** %1
%15 = tail call i32 @assert(i8* %14)
%16 = load i8*, i8** %2
%17 = tail call i32 @assert(i8* %16)
ret void
}