#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*/ strcpy(char *, char const *);
int parse_suffix(char *pnp, char *pns, const char *suffix) {
  int rcod = 0;
  char *p;
  strcpy(pnp, suffix);
  strcpy(pns, "");
  p = pnp;
  if (*p == '\0') {
    strcpy(pns, "");
  } else {
    p++;
    while ((*p) != '\0') {
      if (*p == '/') {
        strcpy(pns, p);
        *p = '\0';
        break;
      }
      p++;
    }
  }
  return rcod;
}


x86 assembly (clang, -O0):
<parse_suffix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
lea    0xebd(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1175 <parse_suffix+0x65>
mov    -0x10(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11d0 <parse_suffix+0xc0>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11cb <parse_suffix+0xbb>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    11ba <parse_suffix+0xaa>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
jmp    11cb <parse_suffix+0xbb>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1181 <parse_suffix+0x71>
jmp    11d0 <parse_suffix+0xc0>
mov    -0x1c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_suffix>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rdx,%rsi
call   1030 <strcpy@plt>
lea    0xed7(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
cmpb   $0x0,(%rbx)
je     1160 <parse_suffix+0x50>
cs nopw 0x0(%rax,%rax,1)
movzbl 0x1(%rbx),%eax
test   %al,%al
je     116f <parse_suffix+0x5f>
add    $0x1,%rbx
cmp    $0x2f,%al
jne    1140 <parse_suffix+0x30>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
movb   $0x0,(%rbx)
jmp    116f <parse_suffix+0x5f>
lea    0xe99(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @parse_suffix(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
store i32 0, i32* %7
%9 = load i8*, i8** %4
%10 = load i8*, i8** %6
%11 = call i32 @strcpy(i8* %9, i8* %10)
%12 = load i8*, i8** %5
%13 = call i32 @strcpy(i8* %12, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%14 = load i8*, i8** %4
store i8* %14, i8** %8
%15 = load i8*, i8** %8
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %3
%20 = load i8*, i8** %5
%21 = call i32 @strcpy(i8* %20, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %44
22: ; preds = %3
%23 = load i8*, i8** %8
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %8
br label %25
25: ; preds = %40, %22
%26 = load i8*, i8** %8
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %43
30: ; preds = %25
%31 = load i8*, i8** %8
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 47
br i1 %34, label %35, label %40
35: ; preds = %30
%36 = load i8*, i8** %5
%37 = load i8*, i8** %8
%38 = call i32 @strcpy(i8* %36, i8* %37)
%39 = load i8*, i8** %8
store i8 0, i8* %39
br label %43
40: ; preds = %30
%41 = load i8*, i8** %8
%42 = getelementptr inbounds i8, i8* %41, i32 1
store i8* %42, i8** %8
br label %25
43: ; preds = %35, %25
br label %44
44: ; preds = %43, %19
%45 = load i32, i32* %7
ret i32 %45
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i32 @parse_suffix(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @strcpy(i8* %0, i8* %2)
%5 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%6 = load i8, i8* %0
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %3
%9 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %16
10: ; preds = %3, %10
%11 = phi i8* [ %12, %10 ], [ %0, %3 ]
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = load i8, i8* %12
switch i8 %13, label %10 [
i8 0, label %16
i8 47, label %14
]
14: ; preds = %10
%15 = tail call i32 @strcpy(i8* %1, i8* %12)
store i8 0, i8* %12
br label %16
16: ; preds = %10, %14, %8
ret i32 0
}