#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*/ memcmp(char *, char *, int);
int strlen(char *);
char process_ftp_type(char *path) {
  int len = strlen(path);
  if (len >= 7 && !memcmp(path + len - 7, ";type=", 6)) {
    path[len - 7] = '\0';
    return path[len - 1];
  } else
    return '\0';
}


x86 assembly (clang, -O0):
<process_ftp_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x7,-0x14(%rbp)
jl     1194 <process_ftp_type+0x74>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
add    $0xfffffffffffffff9,%rdi
lea    0xea8(%rip),%rsi
mov    $0x6,%edx
call   1040 <memcmp@plt>
cmp    $0x0,%eax
jne    1194 <process_ftp_type+0x74>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x7,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x1(%rbp)
jmp    1198 <process_ftp_type+0x78>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_ftp_type>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
cmp    $0x7,%eax
jl     1152 <process_ftp_type+0x32>
mov    %eax,%ebx
mov    %eax,%eax
lea    (%r14,%rax,1),%rdi
add    $0xfffffffffffffff9,%rdi
lea    0xebc(%rip),%rsi
mov    $0x6,%edx
call   1040 <memcmp@plt>
test   %eax,%eax
je     1156 <process_ftp_type+0x36>
xor    %eax,%eax
jmp    1165 <process_ftp_type+0x45>
lea    -0x7(%rbx),%eax
movb   $0x0,(%r14,%rax,1)
add    $0xffffffff,%ebx
mov    (%r14,%rbx,1),%al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c";type=\00"
define signext i8 @process_ftp_type(i8* %0) {
%2 = alloca i8
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp sge i32 %7, 7
br i1 %8, label %9, label %29
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %10, i64 %12
%14 = getelementptr inbounds i8, i8* %13, i64 -7
%15 = call i32 @memcmp(i8* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
%16 = icmp ne i32 %15, 0
br i1 %16, label %29, label %17
17: ; preds = %9
%18 = load i8*, i8** %3
%19 = load i32, i32* %4
%20 = sub nsw i32 %19, 7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %18, i64 %21
store i8 0, i8* %22
%23 = load i8*, i8** %3
%24 = load i32, i32* %4
%25 = sub nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %23, i64 %26
%28 = load i8, i8* %27
store i8 %28, i8* %2
br label %30
29: ; preds = %9, %1
store i8 0, i8* %2
br label %30
30: ; preds = %29, %17
%31 = load i8, i8* %2
ret i8 %31
}

LLVM IR (-O2):
@.str = [7 x i8] c";type=\00"
define signext i8 @process_ftp_type(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 6
br i1 %3, label %4, label %18
4: ; preds = %1
%5 = zext i32 %2 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = getelementptr inbounds i8, i8* %6, i64 -7
%8 = tail call i32 @memcmp(i8* %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %4
%11 = add nsw i32 %2, -7
%12 = zext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %0, i64 %12
store i8 0, i8* %13
%14 = add nsw i32 %2, -1
%15 = zext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = load i8, i8* %16
br label %18
18: ; preds = %1, %4, %10
%19 = phi i8 [ %17, %10 ], [ 0, %4 ], [ 0, %1 ]
ret i8 %19
}