#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 clean(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char str1[10] = "a";
  int x = clean(str1, 10);
  printf("%s\n", str1);
  char str2[10] = "aB";
  int x2 = clean(str2, 10);
  printf("%s\n", str2);
  char str3[10] = "aaaBaBaB";
  int x3 = clean(str3, 10);
  printf("%s\n", str3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0xe(%rbp)
mov    0xec7(%rip),%ax
mov    %ax,-0x6(%rbp)
lea    -0xe(%rbp),%rdi
mov    $0xa,%esi
call   1040 <clean@plt>
mov    %eax,-0x14(%rbp)
lea    -0xe(%rbp),%rsi
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
mov    0xe9d(%rip),%rax
mov    %rax,-0x1e(%rbp)
mov    0xe9a(%rip),%ax
mov    %ax,-0x16(%rbp)
lea    -0x1e(%rbp),%rdi
mov    $0xa,%esi
call   1040 <clean@plt>
mov    %eax,-0x24(%rbp)
lea    -0x1e(%rbp),%rsi
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
mov    0xe70(%rip),%rax
mov    %rax,-0x2e(%rbp)
mov    0xe6d(%rip),%ax
mov    %ax,-0x26(%rbp)
lea    -0x2e(%rbp),%rdi
mov    $0xa,%esi
call   1040 <clean@plt>
mov    %eax,-0x34(%rbp)
lea    -0x2e(%rbp),%rsi
lea    0xe4f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movw   $0x0,0x30(%rsp)
movq   $0x61,0x28(%rsp)
lea    0x28(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <clean@plt>
lea    0xece(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
movw   $0x0,0x20(%rsp)
movq   $0x4261,0x18(%rsp)
lea    0x18(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <clean@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
movabs $0x4261426142616161,%rax
42 61 42
mov    %rax,0x8(%rsp)
movw   $0x0,0x10(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <clean@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.str1 = [10 x i8] c"a\00\00\00\00\00\00\00\00\00"
@.str = [4 x i8] c"%s\0A\00"
@__const.main.str2 = [10 x i8] c"aB\00\00\00\00\00\00\00\00"
@__const.main.str3 = [10 x i8] c"aaaBaBaB\00\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca i32
%4 = alloca [10 x i8]
%5 = alloca i32
%6 = alloca [10 x i8]
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [10 x i8]* %2 to i8*
%9 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%10 = call i32 @clean(i8* %9, i32 10)
store i32 %10, i32* %3
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = bitcast [10 x i8]* %4 to i8*
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%15 = call i32 @clean(i8* %14, i32 10)
store i32 %15, i32* %5
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = bitcast [10 x i8]* %6 to i8*
%19 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%20 = call i32 @clean(i8* %19, i32 10)
store i32 %20, i32* %7
%21 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %21)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str1 = [10 x i8] c"a\00\00\00\00\00\00\00\00\00"
@.str = [4 x i8] c"%s\0A\00"
@__const.main.str2 = [10 x i8] c"aB\00\00\00\00\00\00\00\00"
@__const.main.str3 = [10 x i8] c"aaaBaBaB\00\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca [10 x i8]
%3 = alloca [10 x i8]
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%5 = call i32 @clean(i8* %4, i32 10)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%8 = call i32 @clean(i8* %7, i32 10)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%11 = call i32 @clean(i8* %10, i32 10)
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %10)
ret i32 0
}