#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 gett(char *);
int /*<<< orphan*/ lower(char *, int);
int /*<<< orphan*/ printf(char *, char);
void main() {
  char text[1000];
  int i = 0;
  int len = 0;
  for (i = 0; i <= 1000; ++i) {
    text[i] = 0;
  }
  len = gett(text);
  lower(text, len);
  for (i = 0; i <= len; ++i) {
    printf("%c", text[i]);
  };
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x3f4(%rbp)
movl   $0x0,-0x3f8(%rbp)
movl   $0x0,-0x3f4(%rbp)
cmpl   $0x3e8,-0x3f4(%rbp)
jg     118c <main+0x5c>
movslq -0x3f4(%rbp),%rax
movb   $0x0,-0x3f0(%rbp,%rax,1)
mov    -0x3f4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3f4(%rbp)
jmp    1159 <main+0x29>
lea    -0x3f0(%rbp),%rdi
call   1030 <gett@plt>
mov    %eax,-0x3f8(%rbp)
lea    -0x3f0(%rbp),%rdi
mov    -0x3f8(%rbp),%esi
call   1050 <lower@plt>
movl   $0x0,-0x3f4(%rbp)
mov    -0x3f4(%rbp),%eax
cmp    -0x3f8(%rbp),%eax
jg     11fb <main+0xcb>
movslq -0x3f4(%rbp),%rax
lea    0xe26(%rip),%rdi
movsbl -0x3f0(%rbp,%rax,1),%esi
ff
call   1040 <printf@plt>
mov    -0x3f4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3f4(%rbp)
jmp    11ba <main+0x8a>
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x3f0,%rsp
mov    %rsp,%r14
mov    $0x3e9,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
mov    %r14,%rdi
call   1030 <gett@plt>
mov    %eax,%r15d
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <lower@plt>
test   %r15d,%r15d
js     11a5 <main+0x65>
add    $0x1,%r15d
xor    %ebx,%ebx
lea    0xe7b(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
movsbl (%rsp,%rbx,1),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1190 <main+0x50>
add    $0x3f0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%4 = call i32 @gett(i8* %3)
%5 = call i32 @lower(i8* %3, i32 %4)
%6 = icmp slt i32 %4, 0
br i1 %6, label %17, label %7
7: ; preds = %0
%8 = add nuw i32 %4, 1
%9 = zext i32 %8 to i64
br label %10
10: ; preds = %7, %10
%11 = phi i64 [ 0, %7 ], [ %15, %10 ]
%12 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %11
%13 = load i8, i8* %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 %11, 1
%16 = icmp eq i64 %15, %9
br i1 %16, label %17, label %10
17: ; preds = %10, %0
ret void
}