#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 */
char *strchr(char *, char);
int gettransport(char *input) {
  char *start = strchr(input, '/');
  if (start != NULL && start[1] >= 48 && start[1] <= 54 && start[2] == '/') {
    return start[1] - 48;
  }
  return 0;
}


x86 assembly (clang, -O0):
<gettransport>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     117f <gettransport+0x6f>
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x30,%eax
jl     117f <gettransport+0x6f>
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x36,%eax
jg     117f <gettransport+0x6f>
mov    -0x18(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x2f,%eax
jne    117f <gettransport+0x6f>
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1186 <gettransport+0x76>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gettransport>:
push   %rax
mov    $0x2f,%esi
call   1030 <strchr@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     113e <gettransport+0x2e>
movzbl 0x1(%rcx),%edx
lea    -0x30(%rdx),%esi
cmp    $0x6,%sil
ja     113e <gettransport+0x2e>
add    $0xffffffd0,%edx
xor    %eax,%eax
cmpb   $0x2f,0x2(%rcx)
cmove  %edx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @gettransport(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @strchr(i8* %5, i8 signext 47)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %33
9: ; preds = %1
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp sge i32 %13, 48
br i1 %14, label %15, label %33
15: ; preds = %9
%16 = load i8*, i8** %4
%17 = getelementptr inbounds i8, i8* %16, i64 1
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp sle i32 %19, 54
br i1 %20, label %21, label %33
21: ; preds = %15
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i64 2
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 47
br i1 %26, label %27, label %33
27: ; preds = %21
%28 = load i8*, i8** %4
%29 = getelementptr inbounds i8, i8* %28, i64 1
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = sub nsw i32 %31, 48
store i32 %32, i32* %2
br label %34
33: ; preds = %21, %15, %9, %1
store i32 0, i32* %2
br label %34
34: ; preds = %33, %27
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
define i32 @gettransport(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
br i1 %3, label %16, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %2, i64 1
%6 = load i8, i8* %5
%7 = add i8 %6, -48
%8 = icmp ult i8 %7, 7
br i1 %8, label %9, label %16
9: ; preds = %4
%10 = zext i8 %6 to i32
%11 = getelementptr inbounds i8, i8* %2, i64 2
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 47
%14 = add nsw i32 %10, -48
%15 = select i1 %13, i32 %14, i32 0
br label %16
16: ; preds = %9, %1, %4
%17 = phi i32 [ 0, %4 ], [ 0, %1 ], [ %15, %9 ]
ret i32 %17
}