#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 *, ...);
int /*<<< orphan*/ test_encode_url(char *, char *);
long test_time();
int main(void) {
  printf("test url module\n");
  long est = 0;
  est = test_time();
  test_encode_url("http://www.example.com/", "http://www.example.com/");
  test_encode_url("http://www.example.com/side on",
                  "http://www.example.com/side%20on");
  test_encode_url("http://www.example.com/новый",
                  "http://www.example.com/%D0%BD%D0%BE%D0%B2%D1%8B%D0%B9");
  test_encode_url("http://www.example.com/новый/старый",
                  "http://www.example.com/%D0%BD%D0%BE%D0%B2%D1%8B%D0%B9/"
                  "%D1%81%D1%82%D0%B0%D1%80%D1%8B%D0%B9");
  est = test_time() - est;
  printf("[\033[1;32mpassed\033[0m] total %lu ms\n", est);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movq   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1050 <test_time@plt>
mov    %rax,-0x10(%rbp)
lea    0xeaa(%rip),%rsi
mov    %rsi,%rdi
call   1030 <test_encode_url@plt>
lea    0xeb3(%rip),%rdi
lea    0xecb(%rip),%rsi
call   1030 <test_encode_url@plt>
lea    0xee0(%rip),%rdi
lea    0xefb(%rip),%rsi
call   1030 <test_encode_url@plt>
lea    0xf25(%rip),%rdi
lea    0xf4d(%rip),%rsi
call   1030 <test_encode_url@plt>
mov    $0x0,%al
call   1050 <test_time@plt>
sub    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xf89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0x1014(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1060 <test_time@plt>
mov    %rax,%rbx
lea    0xea2(%rip),%rdi
mov    %rdi,%rsi
call   1030 <test_encode_url@plt>
lea    0xeab(%rip),%rdi
lea    0xec3(%rip),%rsi
call   1030 <test_encode_url@plt>
lea    0xed8(%rip),%rdi
lea    0xef3(%rip),%rsi
call   1030 <test_encode_url@plt>
lea    0xf1d(%rip),%rdi
lea    0xf45(%rip),%rsi
call   1030 <test_encode_url@plt>
xor    %eax,%eax
call   1060 <test_time@plt>
sub    %rbx,%rax
lea    0xf8a(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"test url module\0A\00"
@.str.1 = [24 x i8] c"http://www.example.com/\00"
@.str.2 = [31 x i8] c"http://www.example.com/side on\00"
@.str.3 = [33 x i8] c"http://www.example.com/side%20on\00"
@.str.4 = [34 x i8] c"http://www.example.com/\D0\BD\D0\BE\D0\B2\D1\8B\D0\B9\00"
@.str.5 = [54 x i8] c"http://www.example.com/%D0%BD%D0%BE%D0%B2%D1%8B%D0%B9\00"
@.str.6 = [47 x i8] c"http://www.example.com/\D0\BD\D0\BE\D0\B2\D1\8B\D0\B9/\D1\81\D1\82\D0\B0\D1\80\D1\8B\D0\B9\00"
@.str.7 = [91 x i8] c"http://www.example.com/%D0%BD%D0%BE%D0%B2%D1%8B%D0%B9/%D1%81%D1%82%D0%B0%D1%80%D1%8B%D0%B9\00"
@.str.8 = [34 x i8] c"[\1B[1;32mpassed\1B[0m] total %lu ms\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i64 0, i64* %2
%4 = call i64 (...) @test_time()
store i64 %4, i64* %2
%5 = call i32 @test_encode_url(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @test_encode_url(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @test_encode_url(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0))
%8 = call i32 @test_encode_url(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.7, i64 0, i64 0))
%9 = call i64 (...) @test_time()
%10 = load i64, i64* %2
%11 = sub nsw i64 %9, %10
store i64 %11, i64* %2
%12 = load i64, i64* %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), i64 %12)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [24 x i8] c"http://www.example.com/\00"
@.str.2 = [31 x i8] c"http://www.example.com/side on\00"
@.str.3 = [33 x i8] c"http://www.example.com/side%20on\00"
@.str.4 = [34 x i8] c"http://www.example.com/\D0\BD\D0\BE\D0\B2\D1\8B\D0\B9\00"
@.str.5 = [54 x i8] c"http://www.example.com/%D0%BD%D0%BE%D0%B2%D1%8B%D0%B9\00"
@.str.6 = [47 x i8] c"http://www.example.com/\D0\BD\D0\BE\D0\B2\D1\8B\D0\B9/\D1\81\D1\82\D0\B0\D1\80\D1\8B\D0\B9\00"
@.str.7 = [91 x i8] c"http://www.example.com/%D0%BD%D0%BE%D0%B2%D1%8B%D0%B9/%D1%81%D1%82%D0%B0%D1%80%D1%8B%D0%B9\00"
@.str.8 = [34 x i8] c"[\1B[1;32mpassed\1B[0m] total %lu ms\0A\00"
@str = [16 x i8] c"test url module\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%2 = tail call i64 (...) @test_time()
%3 = tail call i32 @test_encode_url(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @test_encode_url(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 @test_encode_url(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0))
%6 = tail call i32 @test_encode_url(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.7, i64 0, i64 0))
%7 = tail call i64 (...) @test_time()
%8 = sub nsw i64 %7, %2
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), i64 %8)
ret i32 0
}