#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 */
scalar_t__ clean_iso8859_1_basic(unsigned char *, int /*<<< orphan*/ *);
scalar_t__ clean_max_length(unsigned char *, int /*<<< orphan*/ *);
scalar_t__ clean_safe_basic(unsigned char *, int /*<<< orphan*/ *);
scalar_t__ clean_uncgi(unsigned char *, int /*<<< orphan*/ *);
scalar_t__ clean_wipeup(unsigned char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
char *clean_string(char *string) {
  char *fnameptr, *fnameptrbak;
  fnameptr = (char *)clean_uncgi((unsigned char *)string, NULL);
  fnameptrbak = fnameptr;
  fnameptr = (char *)clean_safe_basic((unsigned char *)fnameptr, NULL);
  free(fnameptrbak);
  fnameptrbak = fnameptr;
  fnameptr = (char *)clean_iso8859_1_basic((unsigned char *)fnameptr, NULL);
  free(fnameptrbak);
  fnameptrbak = fnameptr;
  fnameptr = (char *)clean_max_length((unsigned char *)fnameptr, NULL);
  free(fnameptrbak);
  fnameptrbak = fnameptr;
  fnameptr = (char *)clean_wipeup((unsigned char *)fnameptr, NULL);
  free(fnameptrbak);
  return fnameptr;
}


x86 assembly (clang, -O0):
<clean_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <clean_uncgi@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1070 <clean_safe_basic@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1080 <clean_iso8859_1_basic@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <clean_max_length@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <clean_wipeup@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clean_string>:
push   %r14
push   %rbx
push   %rax
xor    %esi,%esi
call   1050 <clean_uncgi@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
call   1070 <clean_safe_basic@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
xor    %esi,%esi
call   1080 <clean_iso8859_1_basic@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1060 <clean_max_length@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <clean_wipeup@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @clean_string(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @clean_uncgi(i8* %5, i32* null)
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** %3
%8 = load i8*, i8** %3
store i8* %8, i8** %4
%9 = load i8*, i8** %3
%10 = call i64 @clean_safe_basic(i8* %9, i32* null)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %3
%12 = load i8*, i8** %4
%13 = call i32 @free(i8* %12)
%14 = load i8*, i8** %3
store i8* %14, i8** %4
%15 = load i8*, i8** %3
%16 = call i64 @clean_iso8859_1_basic(i8* %15, i32* null)
%17 = inttoptr i64 %16 to i8*
store i8* %17, i8** %3
%18 = load i8*, i8** %4
%19 = call i32 @free(i8* %18)
%20 = load i8*, i8** %3
store i8* %20, i8** %4
%21 = load i8*, i8** %3
%22 = call i64 @clean_max_length(i8* %21, i32* null)
%23 = inttoptr i64 %22 to i8*
store i8* %23, i8** %3
%24 = load i8*, i8** %4
%25 = call i32 @free(i8* %24)
%26 = load i8*, i8** %3
store i8* %26, i8** %4
%27 = load i8*, i8** %3
%28 = call i64 @clean_wipeup(i8* %27, i32* null)
%29 = inttoptr i64 %28 to i8*
store i8* %29, i8** %3
%30 = load i8*, i8** %4
%31 = call i32 @free(i8* %30)
%32 = load i8*, i8** %3
ret i8* %32
}

LLVM IR (-O2):
define i8* @clean_string(i8* %0) {
%2 = tail call i64 @clean_uncgi(i8* %0, i32* null)
%3 = inttoptr i64 %2 to i8*
%4 = tail call i64 @clean_safe_basic(i8* %3, i32* null)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @free(i8* %3)
%7 = tail call i64 @clean_iso8859_1_basic(i8* %5, i32* null)
%8 = inttoptr i64 %7 to i8*
%9 = tail call i32 @free(i8* %5)
%10 = tail call i64 @clean_max_length(i8* %8, i32* null)
%11 = inttoptr i64 %10 to i8*
%12 = tail call i32 @free(i8* %8)
%13 = tail call i64 @clean_wipeup(i8* %11, i32* null)
%14 = inttoptr i64 %13 to i8*
%15 = tail call i32 @free(i8* %11)
ret i8* %14
}