#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 *prune;
char *prune1;
char *prune2;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int urlncmp(char *url1, char *url2, int n) {
  char *urlprune(), *prune = NULL, prune1[4096], prune2[4096];
  int ismatch = 0;
  if (((url1) == NULL ? 1 : (*(url1) == '\000' ? 1 : 0)) ||
      ((url2) == NULL ? 1 : (*(url2) == '\000' ? 1 : 0)))
    goto end_of_job;
  prune = urlprune(url1, n);
  if (((prune) == NULL ? 1 : (*(prune) == '\000' ? 1 : 0)))
    goto end_of_job;
  if ((prune1) != NULL && (4064) >= 0) {
    char *thissource = (prune);
    (prune1)[0] = '\000';
    if ((4064) > 0 && thissource != NULL) {
      strncpy((prune1), thissource, (4064));
      (prune1)[(4064)] = '\000';
    }
  };
  prune = urlprune(url2, n);
  if (((prune) == NULL ? 1 : (*(prune) == '\000' ? 1 : 0)))
    goto end_of_job;
  if ((prune2) != NULL && (4064) >= 0) {
    char *thissource = (prune);
    (prune2)[0] = '\000';
    if ((4064) > 0 && thissource != NULL) {
      strncpy((prune2), thissource, (4064));
      (prune2)[(4064)] = '\000';
    }
  };
  if (strcmp(prune1, prune2) == 0)
    ismatch = 1;
end_of_job:
  return (ismatch);
}


x86 assembly (clang, -O0):
<urlncmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2040,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x2024(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1172 <urlncmp+0x42>
mov    $0x1,%al
test   $0x1,%al
jne    11e8 <urlncmp+0xb8>
jmp    11a0 <urlncmp+0x70>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1191 <urlncmp+0x61>
mov    $0x1,%al
test   $0x1,%al
jne    11e8 <urlncmp+0xb8>
jmp    11a0 <urlncmp+0x70>
xor    %eax,%eax
test   $0x1,%al
jne    11e8 <urlncmp+0xb8>
jmp    11a0 <urlncmp+0x70>
cmpq   $0x0,-0x10(%rbp)
jne    11ba <urlncmp+0x8a>
mov    $0x1,%al
test   $0x1,%al
jne    11e8 <urlncmp+0xb8>
jmp    11ed <urlncmp+0xbd>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11d9 <urlncmp+0xa9>
mov    $0x1,%al
test   $0x1,%al
jne    11e8 <urlncmp+0xb8>
jmp    11ed <urlncmp+0xbd>
xor    %eax,%eax
test   $0x1,%al
jne    11e8 <urlncmp+0xb8>
jmp    11ed <urlncmp+0xbd>
jmp    1352 <urlncmp+0x222>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x0,%al
call   1050 <urlprune@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1219 <urlncmp+0xe9>
mov    $0x1,%al
test   $0x1,%al
jne    1247 <urlncmp+0x117>
jmp    124c <urlncmp+0x11c>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1238 <urlncmp+0x108>
mov    $0x1,%al
test   $0x1,%al
jne    1247 <urlncmp+0x117>
jmp    124c <urlncmp+0x11c>
xor    %eax,%eax
test   $0x1,%al
jne    1247 <urlncmp+0x117>
jmp    124c <urlncmp+0x11c>
jmp    1352 <urlncmp+0x222>
mov    -0x20(%rbp),%rax
mov    %rax,-0x2030(%rbp)
movb   $0x0,-0x1020(%rbp)
cmpq   $0x0,-0x2030(%rbp)
je     1288 <urlncmp+0x158>
lea    -0x1020(%rbp),%rdi
mov    -0x2030(%rbp),%rsi
mov    $0xfe0,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x0,%al
call   1050 <urlprune@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    12b4 <urlncmp+0x184>
mov    $0x1,%al
test   $0x1,%al
jne    12e2 <urlncmp+0x1b2>
jmp    12e7 <urlncmp+0x1b7>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    12d3 <urlncmp+0x1a3>
mov    $0x1,%al
test   $0x1,%al
jne    12e2 <urlncmp+0x1b2>
jmp    12e7 <urlncmp+0x1b7>
xor    %eax,%eax
test   $0x1,%al
jne    12e2 <urlncmp+0x1b2>
jmp    12e7 <urlncmp+0x1b7>
jmp    1352 <urlncmp+0x222>
mov    -0x20(%rbp),%rax
mov    %rax,-0x2038(%rbp)
movb   $0x0,-0x2020(%rbp)
cmpq   $0x0,-0x2038(%rbp)
je     1326 <urlncmp+0x1f6>
lea    -0x2020(%rbp),%rdi
mov    -0x2038(%rbp),%rsi
mov    $0xfe0,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x1040(%rbp)
lea    -0x1020(%rbp),%rdi
lea    -0x2020(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    134d <urlncmp+0x21d>
movl   $0x1,-0x2024(%rbp)
jmp    1352 <urlncmp+0x222>
mov    -0x2024(%rbp),%eax
add    $0x2040,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<urlncmp>:
push   %rbp
push   %r14
push   %rbx
sub    $0x2000,%rsp
xor    %ebx,%ebx
test   %rdi,%rdi
je     11ed <urlncmp+0xbd>
mov    %rsi,%rbp
test   %rsi,%rsi
je     11ed <urlncmp+0xbd>
cmpb   $0x0,(%rdi)
je     11ed <urlncmp+0xbd>
cmpb   $0x0,0x0(%rbp)
je     11ed <urlncmp+0xbd>
mov    %edx,%r14d
xor    %ebx,%ebx
mov    %edx,%esi
xor    %eax,%eax
call   1050 <urlprune@plt>
test   %rax,%rax
je     11ed <urlncmp+0xbd>
cmpb   $0x0,(%rax)
je     11ed <urlncmp+0xbd>
movb   $0x0,(%rsp)
mov    %rsp,%rdi
mov    %rax,%rsi
mov    $0xfe0,%edx
call   1030 <strncpy@plt>
movb   $0x0,0xfe0(%rsp)
xor    %ebx,%ebx
mov    %rbp,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <urlprune@plt>
test   %rax,%rax
je     11ed <urlncmp+0xbd>
cmpb   $0x0,(%rax)
je     11ed <urlncmp+0xbd>
movb   $0x0,0x1000(%rsp)
lea    0x1000(%rsp),%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
mov    $0xfe0,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x1fe0(%rsp)
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
xor    %ebx,%ebx
test   %rax,%rax
sete   %bl
mov    %ebx,%eax
add    $0x2000,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@prune = global i8* null
@prune1 = global i8* null
@prune2 = global i8* null
define i32 @urlncmp(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca [4096 x i8]
%9 = alloca [4096 x i8]
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store i8* null, i8** %7
store i32 0, i32* %10
%13 = load i8*, i8** %4
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %16
15: ; preds = %3
br i1 true, label %34, label %23
16: ; preds = %3
%17 = load i8*, i8** %4
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %16
br i1 true, label %34, label %23
22: ; preds = %16
br i1 false, label %34, label %23
23: ; preds = %22, %21, %15
%24 = load i8*, i8** %5
%25 = icmp eq i8* %24, null
br i1 %25, label %26, label %27
26: ; preds = %23
br i1 true, label %34, label %35
27: ; preds = %23
%28 = load i8*, i8** %5
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %27
br i1 true, label %34, label %35
33: ; preds = %27
br i1 false, label %34, label %35
34: ; preds = %33, %32, %26, %22, %21, %15
br label %92
35: ; preds = %33, %32, %26
%36 = load i8*, i8** %4
%37 = load i32, i32* %6
%38 = call i8* (i8*, i32, ...) bitcast (i8* (...)* @urlprune to i8* (i8*, i32, ...)*)(i8* %36, i32 %37)
store i8* %38, i8** %7
%39 = load i8*, i8** %7
%40 = icmp eq i8* %39, null
br i1 %40, label %41, label %42
41: ; preds = %35
br i1 true, label %49, label %50
42: ; preds = %35
%43 = load i8*, i8** %7
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %48
47: ; preds = %42
br i1 true, label %49, label %50
48: ; preds = %42
br i1 false, label %49, label %50
49: ; preds = %48, %47, %41
br label %92
50: ; preds = %48, %47, %41
%51 = load i8*, i8** %7
store i8* %51, i8** %11
%52 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
store i8 0, i8* %52
%53 = load i8*, i8** %11
%54 = icmp ne i8* %53, null
br i1 %54, label %55, label %60
55: ; preds = %50
%56 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
%57 = load i8*, i8** %11
%58 = call i32 @strncpy(i8* %56, i8* %57, i32 4064)
%59 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 4064
store i8 0, i8* %59
br label %60
60: ; preds = %55, %50
%61 = load i8*, i8** %5
%62 = load i32, i32* %6
%63 = call i8* (i8*, i32, ...) bitcast (i8* (...)* @urlprune to i8* (i8*, i32, ...)*)(i8* %61, i32 %62)
store i8* %63, i8** %7
%64 = load i8*, i8** %7
%65 = icmp eq i8* %64, null
br i1 %65, label %66, label %67
66: ; preds = %60
br i1 true, label %74, label %75
67: ; preds = %60
%68 = load i8*, i8** %7
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = icmp eq i32 %70, 0
br i1 %71, label %72, label %73
72: ; preds = %67
br i1 true, label %74, label %75
73: ; preds = %67
br i1 false, label %74, label %75
74: ; preds = %73, %72, %66
br label %92
75: ; preds = %73, %72, %66
%76 = load i8*, i8** %7
store i8* %76, i8** %12
%77 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
store i8 0, i8* %77
%78 = load i8*, i8** %12
%79 = icmp ne i8* %78, null
br i1 %79, label %80, label %85
80: ; preds = %75
%81 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%82 = load i8*, i8** %12
%83 = call i32 @strncpy(i8* %81, i8* %82, i32 4064)
%84 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 4064
store i8 0, i8* %84
br label %85
85: ; preds = %80, %75
%86 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
%87 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%88 = call i64 @strcmp(i8* %86, i8* %87)
%89 = icmp eq i64 %88, 0
br i1 %89, label %90, label %91
90: ; preds = %85
store i32 1, i32* %10
br label %91
91: ; preds = %90, %85
br label %92
92: ; preds = %91, %74, %49, %34
%93 = load i32, i32* %10
ret i32 %93
}

LLVM IR (-O2):
@prune = global i8* null
@prune1 = global i8* null
@prune2 = global i8* null
define i32 @urlncmp(i8* %0, i8* %1, i32 %2) {
%4 = alloca [4096 x i8]
%5 = alloca [4096 x i8]
%6 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%8 = icmp eq i8* %0, null
br i1 %8, label %37, label %9
9: ; preds = %3
%10 = load i8, i8* %0
%11 = icmp eq i8 %10, 0
%12 = icmp eq i8* %1, null
%13 = or i1 %12, %11
br i1 %13, label %37, label %14
14: ; preds = %9
%15 = load i8, i8* %1
%16 = icmp eq i8 %15, 0
br i1 %16, label %37, label %17
17: ; preds = %14
%18 = tail call i8* (i8*, i32, ...) bitcast (i8* (...)* @urlprune to i8* (i8*, i32, ...)*)(i8* %0, i32 %2)
%19 = icmp eq i8* %18, null
br i1 %19, label %37, label %20
20: ; preds = %17
%21 = load i8, i8* %18
%22 = icmp eq i8 %21, 0
br i1 %22, label %37, label %23
23: ; preds = %20
store i8 0, i8* %6
%24 = call i32 @strncpy(i8* %6, i8* %18, i32 4064)
%25 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 4064
store i8 0, i8* %25
%26 = call i8* (i8*, i32, ...) bitcast (i8* (...)* @urlprune to i8* (i8*, i32, ...)*)(i8* %1, i32 %2)
%27 = icmp eq i8* %26, null
br i1 %27, label %37, label %28
28: ; preds = %23
%29 = load i8, i8* %26
%30 = icmp eq i8 %29, 0
br i1 %30, label %37, label %31
31: ; preds = %28
store i8 0, i8* %7
%32 = call i32 @strncpy(i8* %7, i8* %26, i32 4064)
%33 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 4064
store i8 0, i8* %33
%34 = call i64 @strcmp(i8* %6, i8* %7)
%35 = icmp eq i64 %34, 0
%36 = zext i1 %35 to i32
br label %37
37: ; preds = %31, %23, %28, %17, %20, %3, %9, %14
%38 = phi i32 [ 0, %3 ], [ 0, %9 ], [ 0, %14 ], [ 0, %17 ], [ 0, %20 ], [ 0, %23 ], [ 0, %28 ], [ %36, %31 ]
ret i32 %38
}