#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*/ isurlsafe(char);
int /*<<< orphan*/ isxdigit(char const);
int vlc_UrlIsNotEncoded(const char *psz_url) {
  const char *ptr;
  for (ptr = psz_url; *ptr; ptr++) {
    char c = *ptr;
    if (c == '%') {
      if (!isxdigit(ptr[1]) || !isxdigit(ptr[2]))
        return 1;
      ptr += 2;
    } else if (!isurlsafe(c))
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<vlc_UrlIsNotEncoded>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     11d9 <vlc_UrlIsNotEncoded+0xb9>
mov    -0x18(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x25,%eax
jne    11a0 <vlc_UrlIsNotEncoded+0x80>
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1040 <isxdigit@plt>
cmp    $0x0,%eax
je     1183 <vlc_UrlIsNotEncoded+0x63>
mov    -0x18(%rbp),%rax
movsbl 0x2(%rax),%edi
call   1040 <isxdigit@plt>
cmp    $0x0,%eax
jne    118f <vlc_UrlIsNotEncoded+0x6f>
movl   $0x1,-0x4(%rbp)
jmp    11e0 <vlc_UrlIsNotEncoded+0xc0>
mov    -0x18(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x18(%rbp)
jmp    11c3 <vlc_UrlIsNotEncoded+0xa3>
movsbl -0x19(%rbp),%edi
call   1030 <isurlsafe@plt>
cmp    $0x0,%eax
jne    11be <vlc_UrlIsNotEncoded+0x9e>
movl   $0x1,-0x4(%rbp)
jmp    11e0 <vlc_UrlIsNotEncoded+0xc0>
jmp    11c3 <vlc_UrlIsNotEncoded+0xa3>
jmp    11c8 <vlc_UrlIsNotEncoded+0xa8>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1134 <vlc_UrlIsNotEncoded+0x14>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vlc_UrlIsNotEncoded>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x1,%ebp
jmp    1134 <vlc_UrlIsNotEncoded+0x14>
nopl   (%rax)
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x25,%al
je     1150 <vlc_UrlIsNotEncoded+0x30>
test   %al,%al
je     1170 <vlc_UrlIsNotEncoded+0x50>
movsbl %al,%edi
call   1030 <isurlsafe@plt>
test   %eax,%eax
jne    1130 <vlc_UrlIsNotEncoded+0x10>
jmp    1174 <vlc_UrlIsNotEncoded+0x54>
nopl   (%rax)
movsbl 0x1(%rbx),%edi
call   1040 <isxdigit@plt>
test   %eax,%eax
je     1179 <vlc_UrlIsNotEncoded+0x59>
movsbl 0x2(%rbx),%edi
call   1040 <isxdigit@plt>
test   %eax,%eax
je     1179 <vlc_UrlIsNotEncoded+0x59>
add    $0x2,%rbx
jmp    1130 <vlc_UrlIsNotEncoded+0x10>
xor    %ebp,%ebp
jmp    1179 <vlc_UrlIsNotEncoded+0x59>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @vlc_UrlIsNotEncoded(i8* nocapture %0) {
br label %2
2: ; preds = %18, %1
%3 = phi i8* [ %0, %1 ], [ %20, %18 ]
%4 = load i8, i8* %3
switch i8 %4, label %15 [
i8 0, label %21
i8 37, label %5
]
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
%7 = load i8, i8* %6
%8 = tail call i32 @isxdigit(i8 signext %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %21, label %10
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %3, i64 2
%12 = load i8, i8* %11
%13 = tail call i32 @isxdigit(i8 signext %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %21, label %18
15: ; preds = %2
%16 = tail call i32 @isurlsafe(i8 signext %4)
%17 = icmp eq i32 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %10, %15
%19 = phi i8* [ %3, %15 ], [ %11, %10 ]
%20 = getelementptr inbounds i8, i8* %19, i64 1
br label %2
21: ; preds = %15, %5, %10, %2
%22 = phi i32 [ 0, %2 ], [ 1, %10 ], [ 1, %5 ], [ 1, %15 ]
ret i32 %22
}