#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*/ str_encodeChar(char *, char);
int /*<<< orphan*/ str_encodeNonPrintableChar(char *);
int /*<<< orphan*/ str_replaceChar(char *, char, char);
void str_encode(char *pStr) {
  str_encodeChar(pStr, '%');
  str_encodeChar(pStr, '/');
  str_encodeChar(pStr, '\\');
  str_encodeChar(pStr, '=');
  str_encodeChar(pStr, '?');
  str_encodeChar(pStr, '&');
  str_encodeChar(pStr, ';');
  str_encodeChar(pStr, '+');
  str_encodeChar(pStr, ' ');
  str_encodeNonPrintableChar(pStr);
  str_replaceChar(pStr, ' ', '+');
}


x86 assembly (clang, -O0):
<str_encode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x25,%esi
call   1030 <str_encodeChar@plt>
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <str_encodeChar@plt>
mov    -0x8(%rbp),%rdi
mov    $0x5c,%esi
call   1030 <str_encodeChar@plt>
mov    -0x8(%rbp),%rdi
mov    $0x3d,%esi
call   1030 <str_encodeChar@plt>
mov    -0x8(%rbp),%rdi
mov    $0x3f,%esi
call   1030 <str_encodeChar@plt>
mov    -0x8(%rbp),%rdi
mov    $0x26,%esi
call   1030 <str_encodeChar@plt>
mov    -0x8(%rbp),%rdi
mov    $0x3b,%esi
call   1030 <str_encodeChar@plt>
mov    -0x8(%rbp),%rdi
mov    $0x2b,%esi
call   1030 <str_encodeChar@plt>
mov    -0x8(%rbp),%rdi
mov    $0x20,%esi
call   1030 <str_encodeChar@plt>
mov    -0x8(%rbp),%rdi
call   1040 <str_encodeNonPrintableChar@plt>
mov    -0x8(%rbp),%rdi
mov    $0x20,%esi
mov    $0x2b,%edx
call   1050 <str_replaceChar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_encode>:
push   %rbx
mov    %rdi,%rbx
mov    $0x25,%esi
call   1030 <str_encodeChar@plt>
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1030 <str_encodeChar@plt>
mov    %rbx,%rdi
mov    $0x5c,%esi
call   1030 <str_encodeChar@plt>
mov    %rbx,%rdi
mov    $0x3d,%esi
call   1030 <str_encodeChar@plt>
mov    %rbx,%rdi
mov    $0x3f,%esi
call   1030 <str_encodeChar@plt>
mov    %rbx,%rdi
mov    $0x26,%esi
call   1030 <str_encodeChar@plt>
mov    %rbx,%rdi
mov    $0x3b,%esi
call   1030 <str_encodeChar@plt>
mov    %rbx,%rdi
mov    $0x2b,%esi
call   1030 <str_encodeChar@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
call   1030 <str_encodeChar@plt>
mov    %rbx,%rdi
call   1040 <str_encodeNonPrintableChar@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
mov    $0x2b,%edx
pop    %rbx
jmp    1050 <str_replaceChar@plt>

LLVM IR (-O0):
define void @str_encode(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @str_encodeChar(i8* %3, i8 signext 37)
%5 = load i8*, i8** %2
%6 = call i32 @str_encodeChar(i8* %5, i8 signext 47)
%7 = load i8*, i8** %2
%8 = call i32 @str_encodeChar(i8* %7, i8 signext 92)
%9 = load i8*, i8** %2
%10 = call i32 @str_encodeChar(i8* %9, i8 signext 61)
%11 = load i8*, i8** %2
%12 = call i32 @str_encodeChar(i8* %11, i8 signext 63)
%13 = load i8*, i8** %2
%14 = call i32 @str_encodeChar(i8* %13, i8 signext 38)
%15 = load i8*, i8** %2
%16 = call i32 @str_encodeChar(i8* %15, i8 signext 59)
%17 = load i8*, i8** %2
%18 = call i32 @str_encodeChar(i8* %17, i8 signext 43)
%19 = load i8*, i8** %2
%20 = call i32 @str_encodeChar(i8* %19, i8 signext 32)
%21 = load i8*, i8** %2
%22 = call i32 @str_encodeNonPrintableChar(i8* %21)
%23 = load i8*, i8** %2
%24 = call i32 @str_replaceChar(i8* %23, i8 signext 32, i8 signext 43)
ret void
}

LLVM IR (-O2):
define void @str_encode(i8* %0) {
%2 = tail call i32 @str_encodeChar(i8* %0, i8 signext 37)
%3 = tail call i32 @str_encodeChar(i8* %0, i8 signext 47)
%4 = tail call i32 @str_encodeChar(i8* %0, i8 signext 92)
%5 = tail call i32 @str_encodeChar(i8* %0, i8 signext 61)
%6 = tail call i32 @str_encodeChar(i8* %0, i8 signext 63)
%7 = tail call i32 @str_encodeChar(i8* %0, i8 signext 38)
%8 = tail call i32 @str_encodeChar(i8* %0, i8 signext 59)
%9 = tail call i32 @str_encodeChar(i8* %0, i8 signext 43)
%10 = tail call i32 @str_encodeChar(i8* %0, i8 signext 32)
%11 = tail call i32 @str_encodeNonPrintableChar(i8* %0)
%12 = tail call i32 @str_replaceChar(i8* %0, i8 signext 32, i8 signext 43)
ret void
}