#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 length(char *);
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ read_into_array(char *);
char transform(char);
int main() {
  char a[100];
  read_into_array(a);
  int l = length(a);
  char c[100];
  for (int i = 0; i <= l - 1; i++) {
    c[i] = transform(a[i]);
    printf("%c", c[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
call   1050 <read_into_array@plt>
lea    -0x70(%rbp),%rdi
call   1030 <length@plt>
mov    %eax,-0x74(%rbp)
movl   $0x0,-0xe4(%rbp)
mov    -0xe4(%rbp),%eax
mov    -0x74(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11d5 <main+0x95>
movslq -0xe4(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%edi
call   1040 <transform@plt>
mov    %al,%cl
movslq -0xe4(%rbp),%rax
mov    %cl,-0xe0(%rbp,%rax,1)
movslq -0xe4(%rbp),%rax
lea    0xe4c(%rip),%rdi
movsbl -0xe0(%rbp,%rax,1),%esi
ff
call   1060 <printf@plt>
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    1171 <main+0x31>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x70,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <read_into_array@plt>
mov    %rbx,%rdi
call   1030 <length@plt>
test   %eax,%eax
jle    118d <main+0x4d>
mov    %eax,%r15d
xor    %ebx,%ebx
lea    0xe94(%rip),%r14
nopl   0x0(%rax)
movsbl (%rsp,%rbx,1),%edi
call   1040 <transform@plt>
movsbl %al,%esi
mov    %r14,%rdi
call   1060 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1170 <main+0x30>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i32
%4 = alloca [100 x i8]
%5 = alloca i32
store i32 0, i32* %1
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%7 = call i32 @read_into_array(i8* %6)
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%9 = call i32 @length(i8* %8)
store i32 %9, i32* %3
store i32 0, i32* %5
br label %10
10: ; preds = %29, %0
%11 = load i32, i32* %5
%12 = load i32, i32* %3
%13 = sub nsw i32 %12, 1
%14 = icmp sle i32 %11, %13
br i1 %14, label %15, label %32
15: ; preds = %10
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = call signext i8 @transform(i8 signext %19)
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %22
store i8 %20, i8* %23
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %27)
br label %29
29: ; preds = %15
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %10
32: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @read_into_array(i8* %2)
%4 = call i32 @length(i8* %2)
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = zext i32 %4 to i64
br label %9
8: ; preds = %9, %0
ret i32 0
9: ; preds = %6, %9
%10 = phi i64 [ 0, %6 ], [ %15, %9 ]
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = call signext i8 @transform(i8 signext %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %13)
%15 = add nuw nsw i64 %10, 1
%16 = icmp eq i64 %15, %7
br i1 %16, label %8, label %9
}