#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*/ sscanf(char *, char *, int *, int *, int *, int *);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char const *);
char *strrchr(char *, char);
char *strstr(char *, char *);
int /*<<< orphan*/ tracet(int, char *, char const *);
void decodeftppath(const char *path, char *addr, char *file, char *user,
                   char *passwd, int *topts) {
  char buff[1024], *p, *q;
  tracet(4, "decodeftpath: path=%s\n", path);
  if (user)
    *user = '\0';
  if (passwd)
    *passwd = '\0';
  if (topts) {
    topts[0] = 0;
    topts[1] = 3600;
    topts[2] = 0;
    topts[3] = 0;
  }
  strcpy(buff, path);
  if ((p = strchr(buff, '/'))) {
    if ((q = strstr(p + 1, "::"))) {
      *q = '\0';
      if (topts)
        sscanf(q + 2, "T=%d,%d,%d,%d", topts, topts + 1, topts + 2, topts + 3);
    }
    strcpy(file, p + 1);
    *p = '\0';
  } else
    file[0] = '\0';
  if ((p = strrchr(buff, '@'))) {
    *p++ = '\0';
    if ((q = strchr(buff, ':'))) {
      *q = '\0';
      if (passwd)
        strcpy(passwd, q + 1);
    }
    *q = '\0';
    if (user)
      strcpy(user, buff);
  } else
    p = buff;
  strcpy(addr, p);
}


x86 assembly (clang, -O0):
<decodeftppath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdx
mov    $0x4,%edi
lea    0xe6d(%rip),%rsi
call   1070 <tracet@plt>
cmpq   $0x0,-0x20(%rbp)
je     11aa <decodeftppath+0x4a>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
cmpq   $0x0,-0x28(%rbp)
je     11bc <decodeftppath+0x5c>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
cmpq   $0x0,-0x30(%rbp)
je     11f2 <decodeftppath+0x92>
mov    -0x30(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x30(%rbp),%rax
movl   $0xe10,0x4(%rax)
mov    -0x30(%rbp),%rax
movl   $0x0,0x8(%rax)
mov    -0x30(%rbp),%rax
movl   $0x0,0xc(%rax)
lea    -0x430(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x430(%rbp),%rdi
mov    $0x2f,%esi
call   1040 <strchr@plt>
mov    %rax,-0x438(%rbp)
cmp    $0x0,%rax
je     12bc <decodeftppath+0x15c>
mov    -0x438(%rbp),%rdi
add    $0x1,%rdi
lea    0xde1(%rip),%rsi
call   1080 <strstr@plt>
mov    %rax,-0x440(%rbp)
cmp    $0x0,%rax
je     1299 <decodeftppath+0x139>
mov    -0x440(%rbp),%rax
movb   $0x0,(%rax)
cmpq   $0x0,-0x30(%rbp)
je     1294 <decodeftppath+0x134>
mov    -0x440(%rbp),%rdi
add    $0x2,%rdi
mov    -0x30(%rbp),%rdx
mov    -0x30(%rbp),%rcx
add    $0x4,%rcx
mov    -0x30(%rbp),%r8
add    $0x8,%r8
mov    -0x30(%rbp),%r9
add    $0xc,%r9
lea    0xd8b(%rip),%rsi
call   1060 <sscanf@plt>
jmp    1299 <decodeftppath+0x139>
mov    -0x18(%rbp),%rdi
mov    -0x438(%rbp),%rsi
add    $0x1,%rsi
call   1030 <strcpy@plt>
mov    -0x438(%rbp),%rax
movb   $0x0,(%rax)
jmp    12c3 <decodeftppath+0x163>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x430(%rbp),%rdi
mov    $0x40,%esi
call   1050 <strrchr@plt>
mov    %rax,-0x438(%rbp)
cmp    $0x0,%rax
je     1377 <decodeftppath+0x217>
mov    -0x438(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x438(%rbp)
movb   $0x0,(%rax)
lea    -0x430(%rbp),%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
mov    %rax,-0x440(%rbp)
cmp    $0x0,%rax
je     134d <decodeftppath+0x1ed>
mov    -0x440(%rbp),%rax
movb   $0x0,(%rax)
cmpq   $0x0,-0x28(%rbp)
je     1348 <decodeftppath+0x1e8>
mov    -0x28(%rbp),%rdi
mov    -0x440(%rbp),%rsi
add    $0x1,%rsi
call   1030 <strcpy@plt>
jmp    134d <decodeftppath+0x1ed>
mov    -0x440(%rbp),%rax
movb   $0x0,(%rax)
cmpq   $0x0,-0x20(%rbp)
je     1372 <decodeftppath+0x212>
mov    -0x20(%rbp),%rdi
lea    -0x430(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    1385 <decodeftppath+0x225>
lea    -0x430(%rbp),%rax
mov    %rax,-0x438(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x438(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decodeftppath>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x428,%rsp
mov    %r9,%r12
mov    %r8,%rbp
mov    %rcx,%rbx
mov    %rdx,%r13
mov    %rsi,0x8(%rsp)
mov    %rdi,%r15
lea    0xe84(%rip),%rsi
mov    $0x4,%edi
mov    %r15,%rdx
call   1070 <tracet@plt>
test   %rbx,%rbx
je     11a1 <decodeftppath+0x41>
movb   $0x0,(%rbx)
test   %rbp,%rbp
je     11aa <decodeftppath+0x4a>
movb   $0x0,0x0(%rbp)
mov    %rbx,0x10(%rsp)
mov    %rbp,0x18(%rsp)
test   %r12,%r12
je     11c5 <decodeftppath+0x65>
movaps 0xe40(%rip),%xmm0
movups %xmm0,(%r12)
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %r14,%rdi
mov    $0x2f,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     123d <decodeftppath+0xdd>
mov    %rax,%rbx
lea    0x1(%rax),%r15
lea    0xe32(%rip),%rsi
mov    %r15,%rdi
call   1080 <strstr@plt>
test   %rax,%rax
je     122f <decodeftppath+0xcf>
movb   $0x0,(%rax)
test   %r12,%r12
je     122f <decodeftppath+0xcf>
add    $0x2,%rax
lea    0x4(%r12),%rcx
lea    0x8(%r12),%r8
lea    0xc(%r12),%r9
lea    0xe06(%rip),%rsi
mov    %rax,%rdi
mov    %r12,%rdx
call   1060 <sscanf@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%r13
mov    0x8(%rsp),%r15
movb   $0x0,0x0(%r13)
mov    %r14,%rdi
mov    $0x40,%esi
call   1050 <strrchr@plt>
test   %rax,%rax
je     12af <decodeftppath+0x14f>
mov    %rax,%rbx
movb   $0x0,(%rax)
lea    0x20(%rsp),%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
mov    %rax,%rbp
test   %rax,%rax
mov    0x18(%rsp),%rdi
je     1290 <decodeftppath+0x130>
movb   $0x0,0x0(%rbp)
test   %rdi,%rdi
je     1290 <decodeftppath+0x130>
mov    %rbp,%rsi
add    $0x1,%rsi
call   1030 <strcpy@plt>
add    $0x1,%rbx
movb   $0x0,0x0(%rbp)
mov    0x10(%rsp),%rdi
test   %rdi,%rdi
je     12ac <decodeftppath+0x14c>
lea    0x20(%rsp),%rsi
call   1030 <strcpy@plt>
mov    %rbx,%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"decodeftpath: path=%s\0A\00"
@.str.1 = [3 x i8] c"::\00"
@.str.2 = [14 x i8] c"T=%d,%d,%d,%d\00"
define void @decodeftppath(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4, i32* %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32*
%13 = alloca [1024 x i8]
%14 = alloca i8*
%15 = alloca i8*
store i8* %0, i8** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i8* %4, i8** %11
store i32* %5, i32** %12
%16 = load i8*, i8** %7
%17 = call i32 @tracet(i32 4, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i8*, i8** %10
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %22
20: ; preds = %6
%21 = load i8*, i8** %10
store i8 0, i8* %21
br label %22
22: ; preds = %20, %6
%23 = load i8*, i8** %11
%24 = icmp ne i8* %23, null
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = load i8*, i8** %11
store i8 0, i8* %26
br label %27
27: ; preds = %25, %22
%28 = load i32*, i32** %12
%29 = icmp ne i32* %28, null
br i1 %29, label %30, label %39
30: ; preds = %27
%31 = load i32*, i32** %12
%32 = getelementptr inbounds i32, i32* %31, i64 0
store i32 0, i32* %32
%33 = load i32*, i32** %12
%34 = getelementptr inbounds i32, i32* %33, i64 1
store i32 3600, i32* %34
%35 = load i32*, i32** %12
%36 = getelementptr inbounds i32, i32* %35, i64 2
store i32 0, i32* %36
%37 = load i32*, i32** %12
%38 = getelementptr inbounds i32, i32* %37, i64 3
store i32 0, i32* %38
br label %39
39: ; preds = %30, %27
%40 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%41 = load i8*, i8** %7
%42 = call i32 @strcpy(i8* %40, i8* %41)
%43 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%44 = call i8* @strchr(i8* %43, i8 signext 47)
store i8* %44, i8** %14
%45 = icmp ne i8* %44, null
br i1 %45, label %46, label %73
46: ; preds = %39
%47 = load i8*, i8** %14
%48 = getelementptr inbounds i8, i8* %47, i64 1
%49 = call i8* @strstr(i8* %48, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i8* %49, i8** %15
%50 = icmp ne i8* %49, null
br i1 %50, label %51, label %67
51: ; preds = %46
%52 = load i8*, i8** %15
store i8 0, i8* %52
%53 = load i32*, i32** %12
%54 = icmp ne i32* %53, null
br i1 %54, label %55, label %66
55: ; preds = %51
%56 = load i8*, i8** %15
%57 = getelementptr inbounds i8, i8* %56, i64 2
%58 = load i32*, i32** %12
%59 = load i32*, i32** %12
%60 = getelementptr inbounds i32, i32* %59, i64 1
%61 = load i32*, i32** %12
%62 = getelementptr inbounds i32, i32* %61, i64 2
%63 = load i32*, i32** %12
%64 = getelementptr inbounds i32, i32* %63, i64 3
%65 = call i32 @sscanf(i8* %57, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32* %58, i32* %60, i32* %62, i32* %64)
br label %66
66: ; preds = %55, %51
br label %67
67: ; preds = %66, %46
%68 = load i8*, i8** %9
%69 = load i8*, i8** %14
%70 = getelementptr inbounds i8, i8* %69, i64 1
%71 = call i32 @strcpy(i8* %68, i8* %70)
%72 = load i8*, i8** %14
store i8 0, i8* %72
br label %76
73: ; preds = %39
%74 = load i8*, i8** %9
%75 = getelementptr inbounds i8, i8* %74, i64 0
store i8 0, i8* %75
br label %76
76: ; preds = %73, %67
%77 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%78 = call i8* @strrchr(i8* %77, i8 signext 64)
store i8* %78, i8** %14
%79 = icmp ne i8* %78, null
br i1 %79, label %80, label %105
80: ; preds = %76
%81 = load i8*, i8** %14
%82 = getelementptr inbounds i8, i8* %81, i32 1
store i8* %82, i8** %14
store i8 0, i8* %81
%83 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%84 = call i8* @strchr(i8* %83, i8 signext 58)
store i8* %84, i8** %15
%85 = icmp ne i8* %84, null
br i1 %85, label %86, label %96
86: ; preds = %80
%87 = load i8*, i8** %15
store i8 0, i8* %87
%88 = load i8*, i8** %11
%89 = icmp ne i8* %88, null
br i1 %89, label %90, label %95
90: ; preds = %86
%91 = load i8*, i8** %11
%92 = load i8*, i8** %15
%93 = getelementptr inbounds i8, i8* %92, i64 1
%94 = call i32 @strcpy(i8* %91, i8* %93)
br label %95
95: ; preds = %90, %86
br label %96
96: ; preds = %95, %80
%97 = load i8*, i8** %15
store i8 0, i8* %97
%98 = load i8*, i8** %10
%99 = icmp ne i8* %98, null
br i1 %99, label %100, label %104
100: ; preds = %96
%101 = load i8*, i8** %10
%102 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%103 = call i32 @strcpy(i8* %101, i8* %102)
br label %104
104: ; preds = %100, %96
br label %107
105: ; preds = %76
%106 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
store i8* %106, i8** %14
br label %107
107: ; preds = %105, %104
%108 = load i8*, i8** %8
%109 = load i8*, i8** %14
%110 = call i32 @strcpy(i8* %108, i8* %109)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"decodeftpath: path=%s\0A\00"
@.str.1 = [3 x i8] c"::\00"
@.str.2 = [14 x i8] c"T=%d,%d,%d,%d\00"
define void @decodeftppath(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4, i32* %5) {
%7 = alloca [1024 x i8]
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%9 = tail call i32 @tracet(i32 4, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %0)
%10 = icmp eq i8* %3, null
br i1 %10, label %12, label %11
11: ; preds = %6
store i8 0, i8* %3
br label %12
12: ; preds = %11, %6
%13 = icmp eq i8* %4, null
br i1 %13, label %15, label %14
14: ; preds = %12
store i8 0, i8* %4
br label %15
15: ; preds = %14, %12
%16 = icmp eq i32* %5, null
br i1 %16, label %19, label %17
17: ; preds = %15
%18 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> <i32 0, i32 3600, i32 0, i32 0>, <4 x i32>* %18
br label %19
19: ; preds = %17, %15
%20 = call i32 @strcpy(i8* %8, i8* %0)
%21 = call i8* @strchr(i8* %8, i8 signext 47)
%22 = icmp eq i8* %21, null
br i1 %22, label %36, label %23
23: ; preds = %19
%24 = getelementptr inbounds i8, i8* %21, i64 1
%25 = call i8* @strstr(i8* %24, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp eq i8* %25, null
br i1 %26, label %34, label %27
27: ; preds = %23
store i8 0, i8* %25
br i1 %16, label %34, label %28
28: ; preds = %27
%29 = getelementptr inbounds i8, i8* %25, i64 2
%30 = getelementptr inbounds i32, i32* %5, i64 1
%31 = getelementptr inbounds i32, i32* %5, i64 2
%32 = getelementptr inbounds i32, i32* %5, i64 3
%33 = call i32 @sscanf(i8* %29, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32* %5, i32* %30, i32* %31, i32* %32)
br label %34
34: ; preds = %27, %28, %23
%35 = call i32 @strcpy(i8* %2, i8* %24)
br label %36
36: ; preds = %19, %34
%37 = phi i8* [ %21, %34 ], [ %2, %19 ]
store i8 0, i8* %37
%38 = call i8* @strrchr(i8* %8, i8 signext 64)
%39 = icmp eq i8* %38, null
br i1 %39, label %51, label %40
40: ; preds = %36
%41 = getelementptr inbounds i8, i8* %38, i64 1
store i8 0, i8* %38
%42 = call i8* @strchr(i8* %8, i8 signext 58)
%43 = icmp eq i8* %42, null
br i1 %43, label %48, label %44
44: ; preds = %40
store i8 0, i8* %42
br i1 %13, label %48, label %45
45: ; preds = %44
%46 = getelementptr inbounds i8, i8* %42, i64 1
%47 = call i32 @strcpy(i8* %4, i8* %46)
br label %48
48: ; preds = %44, %45, %40
store i8 0, i8* %42
br i1 %10, label %51, label %49
49: ; preds = %48
%50 = call i32 @strcpy(i8* %3, i8* %8)
br label %51
51: ; preds = %36, %48, %49
%52 = phi i8* [ %41, %49 ], [ %41, %48 ], [ %8, %36 ]
%53 = call i32 @strcpy(i8* %1, i8* %52)
ret void
}