#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*/ printf(char *, char const *, ...);
char *strchr(char const *, char);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strncpy(char *, char const *, int);
char *strstr(char const *, char *);
int urlMayBeRecursive(const char url[]) {
  const char *p, *last;
  char directories[10][50];
  int i, y, z, len;
  p = url;
  if ((p = strstr(p, "//")) == NULL) {
    printf("urlMayBeRecursive: bad formated url \"%s\".\n", url);
    return 1;
  }
  ++p;
  ++p;
  if ((p = strchr(p, '/')) == NULL) {
    printf("urlMayBeRecursive: bad formated url \"%s\".\n", url);
    return 1;
  }
  ++p;
  i = 0;
  last = p;
  while (((p = strchr(p, '/')) != NULL) && (i < 10)) {
    len = p - last;
    if (len > 50) {
      len = 50;
    }
    strncpy(directories[i], last, len);
    directories[i][len] = '\0';
    ++p;
    ++i;
    last = p;
  }
  for (y = 0; y < i; y++) {
    for (z = 0; z < i; z++) {
      if (y != z) {
        if (strcmp(directories[y], directories[z]) == 0) {
          printf("urlMayBeRecursive: url \"%s\" have recursive folder \"%s\", "
                 "nr %i == \"%s\", nr %i\n",
                 url, directories[y], y, directories[z], z);
          return 1;
        }
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<urlMayBeRecursive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x240,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe8e(%rip),%rsi
call   1070 <strstr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11a3 <urlMayBeRecursive+0x53>
mov    -0x10(%rbp),%rsi
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1407 <urlMayBeRecursive+0x2b7>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x2f,%esi
call   1040 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11f5 <urlMayBeRecursive+0xa5>
mov    -0x10(%rbp),%rsi
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1407 <urlMayBeRecursive+0x2b7>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x224(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x2f,%esi
call   1040 <strchr@plt>
mov    %rax,%rcx
mov    %rcx,-0x18(%rbp)
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x231(%rbp)
je     124a <urlMayBeRecursive+0xfa>
cmpl   $0xa,-0x224(%rbp)
setl   %al
mov    %al,-0x231(%rbp)
mov    -0x231(%rbp),%al
test   $0x1,%al
jne    125d <urlMayBeRecursive+0x10d>
jmp    12f1 <urlMayBeRecursive+0x1a1>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x230(%rbp)
cmpl   $0x32,-0x230(%rbp)
jle    1285 <urlMayBeRecursive+0x135>
movl   $0x32,-0x230(%rbp)
movslq -0x224(%rbp),%rax
lea    -0x220(%rbp),%rdi
imul   $0x32,%rax,%rax
add    %rax,%rdi
mov    -0x20(%rbp),%rsi
mov    -0x230(%rbp),%edx
call   1030 <strncpy@plt>
movslq -0x224(%rbp),%rcx
lea    -0x220(%rbp),%rax
imul   $0x32,%rcx,%rcx
add    %rcx,%rax
movslq -0x230(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x224(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x224(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1213 <urlMayBeRecursive+0xc3>
movl   $0x0,-0x228(%rbp)
mov    -0x228(%rbp),%eax
cmp    -0x224(%rbp),%eax
jge    1400 <urlMayBeRecursive+0x2b0>
movl   $0x0,-0x22c(%rbp)
mov    -0x22c(%rbp),%eax
cmp    -0x224(%rbp),%eax
jge    13e7 <urlMayBeRecursive+0x297>
mov    -0x228(%rbp),%eax
cmp    -0x22c(%rbp),%eax
je     13ce <urlMayBeRecursive+0x27e>
movslq -0x228(%rbp),%rax
lea    -0x220(%rbp),%rdi
imul   $0x32,%rax,%rax
add    %rax,%rdi
movslq -0x22c(%rbp),%rax
lea    -0x220(%rbp),%rsi
imul   $0x32,%rax,%rax
add    %rax,%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    13c9 <urlMayBeRecursive+0x279>
mov    -0x10(%rbp),%rsi
movslq -0x228(%rbp),%rax
lea    -0x220(%rbp),%rdx
imul   $0x32,%rax,%rax
add    %rax,%rdx
mov    -0x228(%rbp),%ecx
movslq -0x22c(%rbp),%rax
lea    -0x220(%rbp),%r8
imul   $0x32,%rax,%rax
add    %rax,%r8
mov    -0x22c(%rbp),%r9d
lea    0xc78(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1407 <urlMayBeRecursive+0x2b7>
jmp    13ce <urlMayBeRecursive+0x27e>
jmp    13d3 <urlMayBeRecursive+0x283>
mov    -0x22c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x22c(%rbp)
jmp    1317 <urlMayBeRecursive+0x1c7>
jmp    13ec <urlMayBeRecursive+0x29c>
mov    -0x228(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x228(%rbp)
jmp    12fb <urlMayBeRecursive+0x1ab>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x240,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<urlMayBeRecursive>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x208,%rsp
mov    %rdi,%rbp
lea    0xe95(%rip),%rsi
call   1070 <strstr@plt>
test   %rax,%rax
je     1228 <urlMayBeRecursive+0xd8>
add    $0x2,%rax
mov    %rax,%rdi
mov    $0x2f,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1228 <urlMayBeRecursive+0xd8>
mov    %rax,%rbx
add    $0x1,%rbx
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     12a8 <urlMayBeRecursive+0x158>
mov    %rax,%r12
mov    %rbp,0x8(%rsp)
lea    0x10(%rsp),%r15
xor    %r14d,%r14d
mov    $0x32,%r13d
cs nopw 0x0(%rax,%rax,1)
mov    %r12d,%ebp
sub    %ebx,%ebp
cmp    $0x32,%ebp
cmovge %r13d,%ebp
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1030 <strncpy@plt>
movslq %ebp,%rax
movb   $0x0,(%r15,%rax,1)
lea    0x1(%r14),%rbp
mov    %r12,%rbx
add    $0x1,%rbx
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     121e <urlMayBeRecursive+0xce>
mov    %rax,%r12
add    $0x32,%r15
cmp    $0x9,%r14
mov    %rbp,%r14
jb     11d0 <urlMayBeRecursive+0x80>
xor    %r12d,%r12d
lea    0x10(%rsp),%r14
jmp    124b <urlMayBeRecursive+0xfb>
lea    0xdd4(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%eax
jmp    12aa <urlMayBeRecursive+0x15a>
add    $0x1,%r12
xor    %eax,%eax
cmp    %r12,%rbp
je     12aa <urlMayBeRecursive+0x15a>
imul   $0x32,%r12,%rax
lea    (%rsp,%rax,1),%r15
add    $0x10,%r15
mov    %r14,%r13
xor    %ebx,%ebx
jmp    126d <urlMayBeRecursive+0x11d>
xchg   %ax,%ax
add    $0x1,%rbx
add    $0x32,%r13
cmp    %rbx,%rbp
je     1240 <urlMayBeRecursive+0xf0>
cmp    %rbx,%r12
je     1260 <urlMayBeRecursive+0x110>
mov    %r15,%rdi
mov    %r13,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    1260 <urlMayBeRecursive+0x110>
lea    0xda5(%rip),%rdi
mov    0x8(%rsp),%rsi
mov    %r15,%rdx
mov    %r12d,%ecx
mov    %r13,%r8
mov    %ebx,%r9d
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%eax
jmp    12aa <urlMayBeRecursive+0x15a>
xor    %eax,%eax
add    $0x208,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"//\00"
@.str.1 = [43 x i8] c"urlMayBeRecursive: bad formated url \22%s\22.\0A\00"
@.str.2 = [78 x i8] c"urlMayBeRecursive: url \22%s\22 have recursive folder \22%s\22, nr %i == \22%s\22, nr %i\0A\00"
define i32 @urlMayBeRecursive(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [10 x [50 x i8]]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %3
%11 = load i8*, i8** %3
store i8* %11, i8** %4
%12 = load i8*, i8** %4
%13 = call i8* @strstr(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %13, i8** %4
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %18
15: ; preds = %1
%16 = load i8*, i8** %3
%17 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %16)
store i32 1, i32* %2
br label %119
18: ; preds = %1
%19 = load i8*, i8** %4
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %4
%21 = load i8*, i8** %4
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %4
%23 = load i8*, i8** %4
%24 = call i8* @strchr(i8* %23, i8 signext 47)
store i8* %24, i8** %4
%25 = icmp eq i8* %24, null
br i1 %25, label %26, label %29
26: ; preds = %18
%27 = load i8*, i8** %3
%28 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %27)
store i32 1, i32* %2
br label %119
29: ; preds = %18
%30 = load i8*, i8** %4
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %4
store i32 0, i32* %7
%32 = load i8*, i8** %4
store i8* %32, i8** %5
br label %33
33: ; preds = %52, %29
%34 = load i8*, i8** %4
%35 = call i8* @strchr(i8* %34, i8 signext 47)
store i8* %35, i8** %4
%36 = icmp ne i8* %35, null
br i1 %36, label %37, label %40
37: ; preds = %33
%38 = load i32, i32* %7
%39 = icmp slt i32 %38, 10
br label %40
40: ; preds = %37, %33
%41 = phi i1 [ false, %33 ], [ %39, %37 ]
br i1 %41, label %42, label %71
42: ; preds = %40
%43 = load i8*, i8** %4
%44 = load i8*, i8** %5
%45 = ptrtoint i8* %43 to i64
%46 = ptrtoint i8* %44 to i64
%47 = sub i64 %45, %46
%48 = trunc i64 %47 to i32
store i32 %48, i32* %10
%49 = load i32, i32* %10
%50 = icmp sgt i32 %49, 50
br i1 %50, label %51, label %52
51: ; preds = %42
store i32 50, i32* %10
br label %52
52: ; preds = %51, %42
%53 = load i32, i32* %7
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [10 x [50 x i8]], [10 x [50 x i8]]* %6, i64 0, i64 %54
%56 = getelementptr inbounds [50 x i8], [50 x i8]* %55, i64 0, i64 0
%57 = load i8*, i8** %5
%58 = load i32, i32* %10
%59 = call i32 @strncpy(i8* %56, i8* %57, i32 %58)
%60 = load i32, i32* %7
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [10 x [50 x i8]], [10 x [50 x i8]]* %6, i64 0, i64 %61
%63 = load i32, i32* %10
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [50 x i8], [50 x i8]* %62, i64 0, i64 %64
store i8 0, i8* %65
%66 = load i8*, i8** %4
%67 = getelementptr inbounds i8, i8* %66, i32 1
store i8* %67, i8** %4
%68 = load i32, i32* %7
%69 = add nsw i32 %68, 1
store i32 %69, i32* %7
%70 = load i8*, i8** %4
store i8* %70, i8** %5
br label %33
71: ; preds = %40
store i32 0, i32* %8
br label %72
72: ; preds = %115, %71
%73 = load i32, i32* %8
%74 = load i32, i32* %7
%75 = icmp slt i32 %73, %74
br i1 %75, label %76, label %118
76: ; preds = %72
store i32 0, i32* %9
br label %77
77: ; preds = %111, %76
%78 = load i32, i32* %9
%79 = load i32, i32* %7
%80 = icmp slt i32 %78, %79
br i1 %80, label %81, label %114
81: ; preds = %77
%82 = load i32, i32* %8
%83 = load i32, i32* %9
%84 = icmp ne i32 %82, %83
br i1 %84, label %85, label %110
85: ; preds = %81
%86 = load i32, i32* %8
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [10 x [50 x i8]], [10 x [50 x i8]]* %6, i64 0, i64 %87
%89 = getelementptr inbounds [50 x i8], [50 x i8]* %88, i64 0, i64 0
%90 = load i32, i32* %9
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [10 x [50 x i8]], [10 x [50 x i8]]* %6, i64 0, i64 %91
%93 = getelementptr inbounds [50 x i8], [50 x i8]* %92, i64 0, i64 0
%94 = call i64 @strcmp(i8* %89, i8* %93)
%95 = icmp eq i64 %94, 0
br i1 %95, label %96, label %109
96: ; preds = %85
%97 = load i8*, i8** %3
%98 = load i32, i32* %8
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds [10 x [50 x i8]], [10 x [50 x i8]]* %6, i64 0, i64 %99
%101 = getelementptr inbounds [50 x i8], [50 x i8]* %100, i64 0, i64 0
%102 = load i32, i32* %8
%103 = load i32, i32* %9
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [10 x [50 x i8]], [10 x [50 x i8]]* %6, i64 0, i64 %104
%106 = getelementptr inbounds [50 x i8], [50 x i8]* %105, i64 0, i64 0
%107 = load i32, i32* %9
%108 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.2, i64 0, i64 0), i8* %97, i8* %101, i32 %102, i8* %106, i32 %107)
store i32 1, i32* %2
br label %119
109: ; preds = %85
br label %110
110: ; preds = %109, %81
br label %111
111: ; preds = %110
%112 = load i32, i32* %9
%113 = add nsw i32 %112, 1
store i32 %113, i32* %9
br label %77
114: ; preds = %77
br label %115
115: ; preds = %114
%116 = load i32, i32* %8
%117 = add nsw i32 %116, 1
store i32 %117, i32* %8
br label %72
118: ; preds = %72
store i32 0, i32* %2
br label %119
119: ; preds = %118, %96, %26, %15
%120 = load i32, i32* %2
ret i32 %120
}

LLVM IR (-O2):
@.str = [3 x i8] c"//\00"
@.str.1 = [43 x i8] c"urlMayBeRecursive: bad formated url \22%s\22.\0A\00"
@.str.2 = [78 x i8] c"urlMayBeRecursive: url \22%s\22 have recursive folder \22%s\22, nr %i == \22%s\22, nr %i\0A\00"
define i32 @urlMayBeRecursive(i8* %0) {
%2 = alloca [10 x [50 x i8]]
%3 = getelementptr inbounds [10 x [50 x i8]], [10 x [50 x i8]]* %2, i64 0, i64 0, i64 0
%4 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %60
8: ; preds = %1
%9 = getelementptr inbounds i8, i8* %4, i64 2
%10 = tail call i8* @strchr(i8* %9, i8 signext 47)
%11 = icmp eq i8* %10, null
br i1 %11, label %16, label %12
12: ; preds = %8
%13 = getelementptr inbounds i8, i8* %10, i64 1
%14 = call i8* @strchr(i8* %13, i8 signext 47)
%15 = icmp eq i8* %14, null
br i1 %15, label %60, label %20
16: ; preds = %8
%17 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %60
18: ; preds = %20
%19 = and i64 %34, 4294967295
br label %40
20: ; preds = %12, %20
%21 = phi i64 [ %34, %20 ], [ 0, %12 ]
%22 = phi i8* [ %36, %20 ], [ %14, %12 ]
%23 = phi i8* [ %35, %20 ], [ %13, %12 ]
%24 = ptrtoint i8* %22 to i64
%25 = ptrtoint i8* %23 to i64
%26 = sub i64 %24, %25
%27 = trunc i64 %26 to i32
%28 = icmp slt i32 %27, 50
%29 = select i1 %28, i32 %27, i32 50
%30 = getelementptr inbounds [10 x [50 x i8]], [10 x [50 x i8]]* %2, i64 0, i64 %21, i64 0
%31 = call i32 @strncpy(i8* %30, i8* %23, i32 %29)
%32 = sext i32 %29 to i64
%33 = getelementptr inbounds [10 x [50 x i8]], [10 x [50 x i8]]* %2, i64 0, i64 %21, i64 %32
store i8 0, i8* %33
%34 = add nuw nsw i64 %21, 1
%35 = getelementptr inbounds i8, i8* %22, i64 1
%36 = call i8* @strchr(i8* %35, i8 signext 47)
%37 = icmp ne i8* %36, null
%38 = icmp ult i64 %21, 9
%39 = select i1 %37, i1 %38, i1 false
br i1 %39, label %20, label %18
40: ; preds = %18, %57
%41 = phi i64 [ 0, %18 ], [ %58, %57 ]
%42 = getelementptr inbounds [10 x [50 x i8]], [10 x [50 x i8]]* %2, i64 0, i64 %41, i64 0
br label %43
43: ; preds = %40, %54
%44 = phi i64 [ 0, %40 ], [ %55, %54 ]
%45 = icmp eq i64 %41, %44
br i1 %45, label %54, label %46
46: ; preds = %43
%47 = getelementptr inbounds [10 x [50 x i8]], [10 x [50 x i8]]* %2, i64 0, i64 %44, i64 0
%48 = call i64 @strcmp(i8* %42, i8* %47)
%49 = icmp eq i64 %48, 0
br i1 %49, label %50, label %54
50: ; preds = %46
%51 = trunc i64 %41 to i32
%52 = trunc i64 %44 to i32
%53 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* %42, i32 %51, i8* %47, i32 %52)
br label %60
54: ; preds = %43, %46
%55 = add nuw nsw i64 %44, 1
%56 = icmp eq i64 %55, %19
br i1 %56, label %57, label %43
57: ; preds = %54
%58 = add nuw nsw i64 %41, 1
%59 = icmp eq i64 %58, %19
br i1 %59, label %60, label %40
60: ; preds = %57, %12, %50, %16, %6
%61 = phi i32 [ 1, %6 ], [ 1, %16 ], [ 1, %50 ], [ 0, %12 ], [ 0, %57 ]
ret i32 %61
}