#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*/ strncasecmp(char *, char *, int);
int skip_head(char *url) {
  if (!strncasecmp(url, "http://", 7) || !strncasecmp(url, "https://", 8))
    return url[4] == 's' ? 8 : 7;
  return 0;
}


x86 assembly (clang, -O0):
<skip_head>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncasecmp@plt>
cmp    $0x0,%eax
je     1158 <skip_head+0x48>
mov    -0x10(%rbp),%rdi
lea    0xec3(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncasecmp@plt>
cmp    $0x0,%eax
jne    1178 <skip_head+0x68>
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%edx
mov    $0x7,%eax
mov    $0x8,%ecx
cmp    $0x73,%edx
cmove  %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    117f <skip_head+0x6f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_head>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncasecmp@plt>
test   %eax,%eax
je     1147 <skip_head+0x37>
lea    0xed8(%rip),%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
call   1030 <strncasecmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
je     1147 <skip_head+0x37>
pop    %rbx
ret
xor    %eax,%eax
cmpb   $0x73,0x4(%rbx)
sete   %al
add    $0x7,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"http://\00"
@.str.1 = [9 x i8] c"https://\00"
define i32 @skip_head(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @strncasecmp(i8* %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 @strncasecmp(i8* %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 8)
%10 = icmp ne i32 %9, 0
br i1 %10, label %19, label %11
11: ; preds = %7, %1
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 4
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 115
%17 = zext i1 %16 to i64
%18 = select i1 %16, i32 8, i32 7
store i32 %18, i32* %2
br label %20
19: ; preds = %7
store i32 0, i32* %2
br label %20
20: ; preds = %19, %11
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
@.str = [8 x i8] c"http://\00"
@.str.1 = [9 x i8] c"https://\00"
define i32 @skip_head(i8* nocapture %0) {
%2 = tail call i32 @strncasecmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
%3 = icmp eq i32 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @strncasecmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 8)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %4, %1
%8 = getelementptr inbounds i8, i8* %0, i64 4
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 115
%11 = select i1 %10, i32 8, i32 7
br label %12
12: ; preds = %4, %7
%13 = phi i32 [ %11, %7 ], [ 0, %4 ]
ret i32 %13
}