#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*/ err_quit(char *);
char *strchr(char *, char);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
void split_colon(char *str, char *s1, char *s2) {
  char *ptr;
  int n;
  if ((ptr = strchr(str, ':')) == NULL)
    err_quit("read queue error");
  n = ptr - str;
  strncpy(s1, str, n);
  s1[n] = '\0';
  n = strlen(str) - strlen(s1) - 1;
  strncpy(s2, ptr + 1, n);
  s2[n] = '\0';
  return;
}


x86 assembly (clang, -O0):
<split_colon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3a,%esi
call   1050 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    117c <split_colon+0x3c>
lea    0xe89(%rip),%rdi
call   1060 <err_quit@plt>
mov    -0x20(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
sub    %ecx,%eax
sub    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
add    $0x1,%rsi
mov    -0x24(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<split_colon>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
mov    $0x3a,%esi
call   1050 <strchr@plt>
mov    %rax,%r13
test   %rax,%rax
jne    1172 <split_colon+0x32>
lea    0xe93(%rip),%rdi
call   1060 <err_quit@plt>
mov    %r13,%rbx
sub    %r12,%rbx
mov    %r15,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
call   1030 <strncpy@plt>
movslq %ebx,%rax
movb   $0x0,(%r15,%rax,1)
mov    %r12,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
not    %ebp
add    %ebx,%ebp
add    $0x1,%r13
mov    %r14,%rdi
mov    %r13,%rsi
mov    %ebp,%edx
call   1030 <strncpy@plt>
movslq %ebp,%rax
movb   $0x0,(%r14,%rax,1)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"read queue error\00"
define void @split_colon(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = load i8*, i8** %4
%10 = call i8* @strchr(i8* %9, i8 signext 58)
store i8* %10, i8** %7
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = call i32 @err_quit(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %3
%15 = load i8*, i8** %7
%16 = load i8*, i8** %4
%17 = ptrtoint i8* %15 to i64
%18 = ptrtoint i8* %16 to i64
%19 = sub i64 %17, %18
%20 = trunc i64 %19 to i32
store i32 %20, i32* %8
%21 = load i8*, i8** %5
%22 = load i8*, i8** %4
%23 = load i32, i32* %8
%24 = call i32 @strncpy(i8* %21, i8* %22, i32 %23)
%25 = load i8*, i8** %5
%26 = load i32, i32* %8
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
store i8 0, i8* %28
%29 = load i8*, i8** %4
%30 = call i32 @strlen(i8* %29)
%31 = load i8*, i8** %5
%32 = call i32 @strlen(i8* %31)
%33 = sub nsw i32 %30, %32
%34 = sub nsw i32 %33, 1
store i32 %34, i32* %8
%35 = load i8*, i8** %6
%36 = load i8*, i8** %7
%37 = getelementptr inbounds i8, i8* %36, i64 1
%38 = load i32, i32* %8
%39 = call i32 @strncpy(i8* %35, i8* %37, i32 %38)
%40 = load i8*, i8** %6
%41 = load i32, i32* %8
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %40, i64 %42
store i8 0, i8* %43
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"read queue error\00"
define void @split_colon(i8* %0, i8* %1, i8* %2) {
%4 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 58)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @err_quit(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
%9 = ptrtoint i8* %4 to i64
%10 = ptrtoint i8* %0 to i64
%11 = sub i64 %9, %10
%12 = trunc i64 %11 to i32
%13 = tail call i32 @strncpy(i8* %1, i8* %0, i32 %12)
%14 = shl i64 %11, 32
%15 = ashr exact i64 %14, 32
%16 = getelementptr inbounds i8, i8* %1, i64 %15
store i8 0, i8* %16
%17 = tail call i32 @strlen(i8* %0)
%18 = tail call i32 @strlen(i8* %1)
%19 = xor i32 %18, -1
%20 = add i32 %17, %19
%21 = getelementptr inbounds i8, i8* %4, i64 1
%22 = tail call i32 @strncpy(i8* %2, i8* %21, i32 %20)
%23 = sext i32 %20 to i64
%24 = getelementptr inbounds i8, i8* %2, i64 %23
store i8 0, i8* %24
ret void
}