#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*/ test_url_encode(char *, char *);
int tests_url_encode(void) {
  int failures;
  failures = 0;
  if (!test_url_encode("abcdef12345", "abcdef12345"))
    failures++;
  if (!test_url_encode("a b", "a%20b"))
    failures++;
  if (!test_url_encode("ab-_.~", "ab-_.~"))
    failures++;
  return failures;
}


x86 assembly (clang, -O0):
<tests_url_encode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rsi
mov    %rsi,%rdi
call   1030 <test_url_encode@plt>
cmp    $0x0,%eax
jne    1140 <tests_url_encode+0x30>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
lea    0xec5(%rip),%rdi
lea    0xec2(%rip),%rsi
call   1030 <test_url_encode@plt>
cmp    $0x0,%eax
jne    1165 <tests_url_encode+0x55>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
lea    0xeaa(%rip),%rsi
mov    %rsi,%rdi
call   1030 <test_url_encode@plt>
cmp    $0x0,%eax
jne    1186 <tests_url_encode+0x76>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tests_url_encode>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%rdi
mov    %rdi,%rsi
call   1030 <test_url_encode@plt>
xor    %r14d,%r14d
test   %eax,%eax
sete   %r14b
lea    0xed9(%rip),%rdi
lea    0xed6(%rip),%rsi
call   1030 <test_url_encode@plt>
lea    0x1(%r14),%ebx
test   %eax,%eax
cmovne %r14d,%ebx
lea    0xec6(%rip),%rdi
mov    %rdi,%rsi
call   1030 <test_url_encode@plt>
cmp    $0x1,%eax
adc    $0x0,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [12 x i8] c"abcdef12345\00"
@.str.1 = [4 x i8] c"a b\00"
@.str.2 = [6 x i8] c"a%20b\00"
@.str.3 = [7 x i8] c"ab-_.~\00"
define i32 @tests_url_encode() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @test_url_encode(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = icmp ne i32 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %0
%5 = load i32, i32* %1
%6 = add nsw i32 %5, 1
store i32 %6, i32* %1
br label %7
7: ; preds = %4, %0
%8 = call i32 @test_url_encode(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp ne i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = load i32, i32* %1
%12 = add nsw i32 %11, 1
store i32 %12, i32* %1
br label %13
13: ; preds = %10, %7
%14 = call i32 @test_url_encode(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%15 = icmp ne i32 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = load i32, i32* %1
%18 = add nsw i32 %17, 1
store i32 %18, i32* %1
br label %19
19: ; preds = %16, %13
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
@.str = [12 x i8] c"abcdef12345\00"
@.str.1 = [4 x i8] c"a b\00"
@.str.2 = [6 x i8] c"a%20b\00"
@.str.3 = [7 x i8] c"ab-_.~\00"
define i32 @tests_url_encode() {
%1 = tail call i32 @test_url_encode(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @test_url_encode(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
%6 = select i1 %2, i32 2, i32 1
%7 = select i1 %5, i32 %6, i32 %3
%8 = tail call i32 @test_url_encode(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
%11 = add nuw nsw i32 %7, %10
ret i32 %11
}