#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*/ strncmp(char const *, char *, int);
void get_hostname_only(const char *given_url, char *output_string) {
  if (!strncmp(given_url, "http://", 7))
    given_url += 7;
  while ((*given_url > ' ') && (*given_url != '/') && (*given_url != ':'))
    *(output_string++) = *(given_url++);
  *output_string = '\0';
}


x86 assembly (clang, -O0):
<get_hostname_only>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed5(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    114a <get_hostname_only+0x3a>
mov    -0x8(%rbp),%rax
add    $0x7,%rax
mov    %rax,-0x8(%rbp)
jmp    114f <get_hostname_only+0x3f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x11(%rbp)
jle    1189 <get_hostname_only+0x79>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x2f,%ecx
mov    %al,-0x11(%rbp)
je     1189 <get_hostname_only+0x79>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1199 <get_hostname_only+0x89>
jmp    11c0 <get_hostname_only+0xb0>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    114f <get_hostname_only+0x3f>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_hostname_only>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xedf(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
xor    %edx,%edx
test   %eax,%eax
mov    $0x7,%ecx
cmovne %rdx,%rcx
mov    (%r14,%rcx,1),%al
cmp    $0x21,%al
jl     1169 <get_hostname_only+0x59>
add    %r14,%rcx
add    $0x1,%rcx
nopw   0x0(%rax,%rax,1)
cmp    $0x2f,%al
je     1169 <get_hostname_only+0x59>
cmp    $0x3a,%al
je     1169 <get_hostname_only+0x59>
mov    %al,(%rbx)
add    $0x1,%rbx
movzbl (%rcx),%eax
add    $0x1,%rcx
cmp    $0x21,%al
jge    1150 <get_hostname_only+0x40>
movb   $0x0,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [8 x i8] c"http://\00"
define void @get_hostname_only(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = call i32 @strncmp(i8* %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
%7 = icmp ne i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 7
store i8* %10, i8** %3
br label %11
11: ; preds = %8, %2
br label %12
12: ; preds = %29, %11
%13 = load i8*, i8** %3
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp sgt i32 %15, 32
br i1 %16, label %17, label %27
17: ; preds = %12
%18 = load i8*, i8** %3
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 47
br i1 %21, label %22, label %27
22: ; preds = %17
%23 = load i8*, i8** %3
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp ne i32 %25, 58
br label %27
27: ; preds = %22, %17, %12
%28 = phi i1 [ false, %17 ], [ false, %12 ], [ %26, %22 ]
br i1 %28, label %29, label %35
29: ; preds = %27
%30 = load i8*, i8** %3
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %3
%32 = load i8, i8* %30
%33 = load i8*, i8** %4
%34 = getelementptr inbounds i8, i8* %33, i32 1
store i8* %34, i8** %4
store i8 %32, i8* %33
br label %12
35: ; preds = %27
%36 = load i8*, i8** %4
store i8 0, i8* %36
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"http://\00"
define void @get_hostname_only(i8* %0, i8* nocapture writeonly %1) {
%3 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i64 7, i64 0
%6 = getelementptr i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = freeze i8 %7
%9 = icmp slt i8 %8, 33
br i1 %9, label %20, label %10
10: ; preds = %2, %14
%11 = phi i8 [ %18, %14 ], [ %8, %2 ]
%12 = phi i8* [ %16, %14 ], [ %1, %2 ]
%13 = phi i8* [ %15, %14 ], [ %6, %2 ]
switch i8 %11, label %14 [
i8 58, label %20
i8 47, label %20
]
14: ; preds = %10
%15 = getelementptr inbounds i8, i8* %13, i64 1
%16 = getelementptr inbounds i8, i8* %12, i64 1
store i8 %11, i8* %12
%17 = load i8, i8* %15
%18 = freeze i8 %17
%19 = icmp slt i8 %18, 33
br i1 %19, label %20, label %10
20: ; preds = %14, %10, %10, %2
%21 = phi i8* [ %1, %2 ], [ %12, %10 ], [ %12, %10 ], [ %16, %14 ]
store i8 0, i8* %21
ret void
}