#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 */
scalar_t__ is_remote(char *);
char *strchr(char *, char);
void extract_remote_host_and_filename(char *subject, char **remote_host,
                                      char **filename) {
  if (is_remote(subject)) {
    char *colon = strchr(subject, ':');
    *colon = '\0';
    *remote_host = subject;
    *filename = colon + 1;
  } else {
    *remote_host = NULL;
    *filename = subject;
  }
}


x86 assembly (clang, -O0):
<extract_remote_host_and_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <is_remote@plt>
cmp    $0x0,%rax
je     117f <extract_remote_host_and_filename+0x5f>
mov    -0x8(%rbp),%rdi
mov    $0x3a,%esi
call   1030 <strchr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rcx
add    $0x1,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    1195 <extract_remote_host_and_filename+0x75>
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_remote_host_and_filename>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1040 <is_remote@plt>
test   %rax,%rax
je     1154 <extract_remote_host_and_filename+0x34>
mov    %rbx,%rdi
mov    $0x3a,%esi
call   1030 <strchr@plt>
movb   $0x0,(%rax)
mov    %rbx,(%r15)
add    $0x1,%rax
mov    %rax,%rbx
jmp    115b <extract_remote_host_and_filename+0x3b>
movq   $0x0,(%r15)
mov    %rbx,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @extract_remote_host_and_filename(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
%9 = call i64 @is_remote(i8* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %20
11: ; preds = %3
%12 = load i8*, i8** %4
%13 = call i8* @strchr(i8* %12, i8 signext 58)
store i8* %13, i8** %7
%14 = load i8*, i8** %7
store i8 0, i8* %14
%15 = load i8*, i8** %4
%16 = load i8**, i8*** %5
store i8* %15, i8** %16
%17 = load i8*, i8** %7
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = load i8**, i8*** %6
store i8* %18, i8** %19
br label %24
20: ; preds = %3
%21 = load i8**, i8*** %5
store i8* null, i8** %21
%22 = load i8*, i8** %4
%23 = load i8**, i8*** %6
store i8* %22, i8** %23
br label %24
24: ; preds = %20, %11
ret void
}

LLVM IR (-O2):
define void @extract_remote_host_and_filename(i8* %0, i8** nocapture writeonly %1, i8** nocapture writeonly %2) {
%4 = tail call i64 @is_remote(i8* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 58)
store i8 0, i8* %7
store i8* %0, i8** %1
%8 = getelementptr inbounds i8, i8* %7, i64 1
br label %10
9: ; preds = %3
store i8* null, i8** %1
br label %10
10: ; preds = %9, %6
%11 = phi i8* [ %0, %9 ], [ %8, %6 ]
store i8* %11, i8** %2
ret void
}