#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*/ assert(int);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ urlize(char *);
int main() {
  char str1[] = "a a a\0   ";
  char str1_expected[] = "a%20a%20a";
  urlize(str1);
  assert(strcmp(str1, str1_expected) == 0);
  char str2[] = "  \0    ";
  char str2_expected[] = "%20%20";
  urlize(str2);
  assert(strcmp(str2, str2_expected) == 0);
  char str3[] = "asdf";
  char str3_expected[] = "asdf";
  urlize(str3);
  assert(strcmp(str3, str3_expected) == 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0xe(%rbp)
mov    0xeb7(%rip),%ax
mov    %ax,-0x6(%rbp)
mov    0xeae(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeab(%rip),%ax
mov    %ax,-0x10(%rbp)
lea    -0xe(%rbp),%rdi
call   1050 <urlize@plt>
lea    -0xe(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    0xe87(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe71(%rip),%eax
mov    %eax,-0x27(%rbp)
mov    0xe6b(%rip),%ax
mov    %ax,-0x23(%rbp)
mov    0xe63(%rip),%al
mov    %al,-0x21(%rbp)
lea    -0x20(%rbp),%rdi
call   1050 <urlize@plt>
lea    -0x20(%rbp),%rdi
lea    -0x27(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    0xe34(%rip),%eax
mov    %eax,-0x2c(%rbp)
mov    0xe2f(%rip),%al
mov    %al,-0x28(%rbp)
mov    0xe22(%rip),%eax
mov    %eax,-0x31(%rbp)
mov    0xe1d(%rip),%al
mov    %al,-0x2d(%rbp)
lea    -0x2c(%rbp),%rdi
call   1050 <urlize@plt>
lea    -0x2c(%rbp),%rdi
lea    -0x31(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
movabs $0x2020006120612061,%rax
mov    %rax,0x28(%rsp)
movw   $0x20,0x30(%rsp)
movabs $0x3032256130322561,%rax
25 32 30
mov    %rax,0x18(%rsp)
movw   $0x61,0x20(%rsp)
lea    0x28(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <urlize@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
movabs $0x20202020002020,%rax
mov    %rax,0x38(%rsp)
movl   $0x303225,0x13(%rsp)
movl   $0x25303225,0x10(%rsp)
25
lea    0x38(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <urlize@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
movb   $0x0,0xc(%rsp)
movl   $0x66647361,0x8(%rsp)
66
movb   $0x0,0x4(%rsp)
movl   $0x66647361,(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <urlize@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.str1 = [10 x i8] c"a a a\00 \00"
@__const.main.str1_expected = [10 x i8] c"a%20a%20a\00"
@__const.main.str2 = [8 x i8] c" \00 \00"
@__const.main.str2_expected = [7 x i8] c"%20%20\00"
@__const.main.str3 = [5 x i8] c"asdf\00"
@__const.main.str3_expected = [5 x i8] c"asdf\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca [10 x i8]
%4 = alloca [8 x i8]
%5 = alloca [7 x i8]
%6 = alloca [5 x i8]
%7 = alloca [5 x i8]
store i32 0, i32* %1
%8 = bitcast [10 x i8]* %2 to i8*
%9 = bitcast [10 x i8]* %3 to i8*
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%11 = call i32 @urlize(i8* %10)
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%14 = call i64 @strcmp(i8* %12, i8* %13)
%15 = icmp eq i64 %14, 0
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = bitcast [8 x i8]* %4 to i8*
%19 = bitcast [7 x i8]* %5 to i8*
%20 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%21 = call i32 @urlize(i8* %20)
%22 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%23 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%24 = call i64 @strcmp(i8* %22, i8* %23)
%25 = icmp eq i64 %24, 0
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = bitcast [5 x i8]* %6 to i8*
%29 = bitcast [5 x i8]* %7 to i8*
%30 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%31 = call i32 @urlize(i8* %30)
%32 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%33 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%34 = call i64 @strcmp(i8* %32, i8* %33)
%35 = icmp eq i64 %34, 0
%36 = zext i1 %35 to i32
%37 = call i32 @assert(i32 %36)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str1 = [10 x i8] c"a a a\00 \00"
@__const.main.str1_expected = [10 x i8] c"a%20a%20a\00"
@__const.main.str2_expected = [7 x i8] c"%20%20\00"
@__const.main.str3_expected = [5 x i8] c"asdf\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca [10 x i8]
%3 = alloca i64
%4 = alloca [7 x i8]
%5 = alloca [5 x i8]
%6 = alloca [5 x i8]
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%9 = call i32 @urlize(i8* %7)
%10 = call i64 @strcmp(i8* %7, i8* %8)
%11 = icmp eq i64 %10, 0
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = bitcast i64* %3 to i8*
store i64 9042521602662432, i64* %3
%15 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 0
%16 = call i32 @urlize(i8* %14)
%17 = call i64 @strcmp(i8* %14, i8* %15)
%18 = icmp eq i64 %17, 0
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%22 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%23 = call i32 @urlize(i8* %21)
%24 = call i64 @strcmp(i8* %21, i8* %22)
%25 = icmp eq i64 %24, 0
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
ret i32 0
}