#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 */
typedef int /*<<< orphan*/ copy;

/* Variables and functions */
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int svz_process_split_usergroup(char *str, char **user, char **group) {
  static char copy[128], *p;
  if (user == NULL || group == NULL)
    return -1;
  *user = *group = NULL;
  if (str == NULL || strlen(str) >= sizeof(copy) - 1)
    return -1;
  strcpy(copy, str);
  if ((p = strchr(copy, '.')) != NULL) {
    *group = p + 1;
    *p = '\0';
  }
  *user = copy;
  return 0;
}


x86 assembly (clang, -O0):
<svz_process_split_usergroup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     115a <svz_process_split_usergroup+0x2a>
cmpq   $0x0,-0x20(%rbp)
jne    1166 <svz_process_split_usergroup+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    120b <svz_process_split_usergroup+0xdb>
mov    -0x20(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
cmpq   $0x0,-0x10(%rbp)
je     119c <svz_process_split_usergroup+0x6c>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cltq
cmp    $0x7f,%rax
jb     11a8 <svz_process_split_usergroup+0x78>
movl   $0xffffffff,-0x4(%rbp)
jmp    120b <svz_process_split_usergroup+0xdb>
mov    -0x10(%rbp),%rsi
lea    0x2e9d(%rip),%rdi
call   1030 <strcpy@plt>
lea    0x2e91(%rip),%rdi
mov    $0x2e,%esi
call   1050 <strchr@plt>
mov    %rax,0x2f00(%rip)
cmp    $0x0,%rax
je     11f6 <svz_process_split_usergroup+0xc6>
mov    0x2eef(%rip),%rcx
add    $0x1,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    0x2edd(%rip),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
lea    0x2e4f(%rip),%rcx
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<svz_process_split_usergroup>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0xffffffff,%ebp
test   %rsi,%rsi
je     11ac <svz_process_split_usergroup+0x7c>
mov    %rdx,%r14
test   %rdx,%rdx
je     11ac <svz_process_split_usergroup+0x7c>
mov    %rsi,%r15
mov    %rdi,%rbx
movq   $0x0,(%r14)
movq   $0x0,(%rsi)
test   %rdi,%rdi
je     11ac <svz_process_split_usergroup+0x7c>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x7e,%eax
ja     11ac <svz_process_split_usergroup+0x7c>
lea    0x2eda(%rip),%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbp,%rdi
mov    $0x2e,%esi
call   1050 <strchr@plt>
mov    %rax,0x2f3b(%rip)
test   %rax,%rax
je     11a7 <svz_process_split_usergroup+0x77>
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,(%r14)
movb   $0x0,(%rax)
mov    %rbp,(%r15)
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@svz_process_split_usergroup.copy = internal global [128 x i8] zeroinitializer
@svz_process_split_usergroup.p = internal global i8* null
define i32 @svz_process_split_usergroup(i8* %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i8**
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%8 = load i8**, i8*** %6
%9 = icmp eq i8** %8, null
br i1 %9, label %13, label %10
10: ; preds = %3
%11 = load i8**, i8*** %7
%12 = icmp eq i8** %11, null
br i1 %12, label %13, label %14
13: ; preds = %10, %3
store i32 -1, i32* %4
br label %37
14: ; preds = %10
%15 = load i8**, i8*** %7
store i8* null, i8** %15
%16 = load i8**, i8*** %6
store i8* null, i8** %16
%17 = load i8*, i8** %5
%18 = icmp eq i8* %17, null
br i1 %18, label %24, label %19
19: ; preds = %14
%20 = load i8*, i8** %5
%21 = call i32 @strlen(i8* %20)
%22 = sext i32 %21 to i64
%23 = icmp uge i64 %22, 127
br i1 %23, label %24, label %25
24: ; preds = %19, %14
store i32 -1, i32* %4
br label %37
25: ; preds = %19
%26 = load i8*, i8** %5
%27 = call i32 @strcpy(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @svz_process_split_usergroup.copy, i64 0, i64 0), i8* %26)
%28 = call i8* @strchr(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @svz_process_split_usergroup.copy, i64 0, i64 0), i8 signext 46)
store i8* %28, i8** @svz_process_split_usergroup.p
%29 = icmp ne i8* %28, null
br i1 %29, label %30, label %35
30: ; preds = %25
%31 = load i8*, i8** @svz_process_split_usergroup.p
%32 = getelementptr inbounds i8, i8* %31, i64 1
%33 = load i8**, i8*** %7
store i8* %32, i8** %33
%34 = load i8*, i8** @svz_process_split_usergroup.p
store i8 0, i8* %34
br label %35
35: ; preds = %30, %25
%36 = load i8**, i8*** %6
store i8* getelementptr inbounds ([128 x i8], [128 x i8]* @svz_process_split_usergroup.copy, i64 0, i64 0), i8** %36
store i32 0, i32* %4
br label %37
37: ; preds = %35, %24, %13
%38 = load i32, i32* %4
ret i32 %38
}

LLVM IR (-O2):
@svz_process_split_usergroup.copy = internal global [128 x i8] zeroinitializer
@svz_process_split_usergroup.p = internal unnamed_addr global i8* null
define i32 @svz_process_split_usergroup(i8* %0, i8** writeonly %1, i8** writeonly %2) {
%4 = icmp eq i8** %1, null
%5 = icmp eq i8** %2, null
%6 = or i1 %4, %5
br i1 %6, label %19, label %7
7: ; preds = %3
store i8* null, i8** %2
store i8* null, i8** %1
%8 = icmp eq i8* %0, null
br i1 %8, label %19, label %9
9: ; preds = %7
%10 = tail call i32 @strlen(i8* %0)
%11 = icmp ugt i32 %10, 126
br i1 %11, label %19, label %12
12: ; preds = %9
%13 = tail call i32 @strcpy(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @svz_process_split_usergroup.copy, i64 0, i64 0), i8* %0)
%14 = tail call i8* @strchr(i8* dereferenceable(1) getelementptr inbounds ([128 x i8], [128 x i8]* @svz_process_split_usergroup.copy, i64 0, i64 0), i8 signext 46)
store i8* %14, i8** @svz_process_split_usergroup.p
%15 = icmp eq i8* %14, null
br i1 %15, label %18, label %16
16: ; preds = %12
%17 = getelementptr inbounds i8, i8* %14, i64 1
store i8* %17, i8** %2
store i8 0, i8* %14
br label %18
18: ; preds = %16, %12
store i8* getelementptr inbounds ([128 x i8], [128 x i8]* @svz_process_split_usergroup.copy, i64 0, i64 0), i8** %1
br label %19
19: ; preds = %7, %9, %3, %18
%20 = phi i32 [ 0, %18 ], [ -1, %3 ], [ -1, %9 ], [ -1, %7 ]
ret i32 %20
}