#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 _getline(char *);
int /*<<< orphan*/ lower(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ upper(char *);
int main() {
  char line[1024];
  int len;
  while ((len = _getline(line)) > 0) {
    printf("Input line: %s\n", line);
    lower(line);
    printf("Lower line: %s\n", line);
    upper(line);
    printf("Upper line: %s\n\n", line);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x410(%rbp),%rdi
call   1040 <_getline@plt>
mov    %eax,-0x414(%rbp)
cmp    $0x0,%eax
jle    11c3 <main+0x83>
lea    -0x410(%rbp),%rsi
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
lea    -0x410(%rbp),%rdi
call   1060 <lower@plt>
lea    -0x410(%rbp),%rsi
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
lea    -0x410(%rbp),%rdi
call   1050 <upper@plt>
lea    -0x410(%rbp),%rsi
lea    0xe67(%rip),%rdi
call   1030 <printf@plt>
jmp    1152 <main+0x12>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %rsp,%rdi
call   1040 <_getline@plt>
test   %eax,%eax
jle    11bd <main+0x7d>
lea    0xe9f(%rip),%r14
mov    %rsp,%rbx
lea    0xea5(%rip),%r15
lea    0xeae(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1060 <lower@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1050 <upper@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <_getline@plt>
test   %eax,%eax
jg     1180 <main+0x40>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Input line: %s\0A\00"
@.str.1 = [16 x i8] c"Lower line: %s\0A\00"
@.str.2 = [17 x i8] c"Upper line: %s\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %8, %0
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%6 = call i32 @_getline(i8* %5)
store i32 %6, i32* %3
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %19
8: ; preds = %4
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%12 = call i32 @lower(i8* %11)
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%14 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%16 = call i32 @upper(i8* %15)
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%18 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %17)
br label %4
19: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"Input line: %s\0A\00"
@.str.1 = [16 x i8] c"Lower line: %s\0A\00"
@.str.2 = [17 x i8] c"Upper line: %s\0A\0A\00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = call i32 @_getline(i8* %2)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %13
5: ; preds = %0, %5
%6 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %2)
%7 = call i32 @lower(i8* %2)
%8 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%9 = call i32 @upper(i8* %2)
%10 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%11 = call i32 @_getline(i8* %2)
%12 = icmp sgt i32 %11, 0
br i1 %12, label %5, label %13
13: ; preds = %5, %0
ret i32 0
}