#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 /*<<< orphan*/ feof(int /*<<< orphan*/);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ show_case_changed(char, char *, char *);
int /*<<< orphan*/ stdin;
int strlen(char *);
int main(void) {
  char line[1024];
  int line_num;
  int len;
  while (!feof(stdin)) {
    if (fgets(line, 1024, stdin) == NULL)
      break;
    len = strlen(line);
    if (line[len - 1] == '\n')
      line[len - 1] = '\0';
    line_num++;
    printf("original_string = %s\n", line);
    show_case_changed('l', "      lowercase = ", line);
    show_case_changed('u', "      uppercase = ", line);
    show_case_changed('t', "     title caps = ", line);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
call   1060 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1185 <main+0x35>
jmp    125e <main+0x10e>
lea    -0x410(%rbp),%rdi
mov    0x2e55(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
jne    11ae <main+0x5e>
jmp    125e <main+0x10e>
lea    -0x410(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x418(%rbp)
mov    -0x418(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    11ef <main+0x9f>
mov    -0x418(%rbp),%eax
sub    $0x1,%eax
cltq
movb   $0x0,-0x410(%rbp,%rax,1)
mov    -0x414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
lea    -0x410(%rbp),%rsi
lea    0xdf4(%rip),%rdi
call   1040 <printf@plt>
lea    -0x410(%rbp),%rdx
mov    $0x6c,%edi
lea    0xdf2(%rip),%rsi
call   1070 <show_case_changed@plt>
lea    -0x410(%rbp),%rdx
mov    $0x75,%edi
lea    0xded(%rip),%rsi
call   1070 <show_case_changed@plt>
lea    -0x410(%rbp),%rdx
mov    $0x74,%edi
lea    0xde8(%rip),%rsi
call   1070 <show_case_changed@plt>
jmp    1162 <main+0x12>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    0x2e80(%rip),%rbp
mov    0x0(%rbp),%edi
call   1060 <feof@plt>
test   %eax,%eax
je     1188 <main+0x38>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsp,%rbx
lea    0xe6e(%rip),%r14
lea    0xe7d(%rip),%r15
lea    0xe89(%rip),%r12
lea    0xe95(%rip),%r13
jmp    11fb <main+0xab>
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    $0x6c,%edi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1070 <show_case_changed@plt>
mov    $0x75,%edi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1070 <show_case_changed@plt>
mov    $0x74,%edi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1070 <show_case_changed@plt>
mov    0x0(%rbp),%edi
call   1060 <feof@plt>
test   %eax,%eax
jne    1174 <main+0x24>
mov    0x0(%rbp),%edx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     1174 <main+0x24>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%rbx,1)
jne    11b0 <main+0x60>
movb   $0x0,-0x1(%rsp,%rax,1)
jmp    11b0 <main+0x60>

LLVM IR (-O0):
@stdin = global i32 0
@.str = [22 x i8] c"original_string = %s\0A\00"
@.str.1 = [19 x i8] c" lowercase = \00"
@.str.2 = [19 x i8] c" uppercase = \00"
@.str.3 = [19 x i8] c" title caps = \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
br label %5
5: ; preds = %31, %0
%6 = load i32, i32* @stdin
%7 = call i32 @feof(i32 %6)
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
br i1 %9, label %10, label %42
10: ; preds = %5
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%12 = load i32, i32* @stdin
%13 = call i32* @fgets(i8* %11, i32 1024, i32 %12)
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %16
15: ; preds = %10
br label %42
16: ; preds = %10
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%18 = call i32 @strlen(i8* %17)
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = sub nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 10
br i1 %25, label %26, label %31
26: ; preds = %16
%27 = load i32, i32* %4
%28 = sub nsw i32 %27, 1
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %29
store i8 0, i8* %30
br label %31
31: ; preds = %26, %16
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
%34 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%35 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %34)
%36 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%37 = call i32 @show_case_changed(i8 signext 108, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %36)
%38 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%39 = call i32 @show_case_changed(i8 signext 117, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %38)
%40 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%41 = call i32 @show_case_changed(i8 signext 116, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %40)
br label %5
42: ; preds = %15, %5
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [22 x i8] c"original_string = %s\0A\00"
@.str.1 = [19 x i8] c" lowercase = \00"
@.str.2 = [19 x i8] c" uppercase = \00"
@.str.3 = [19 x i8] c" title caps = \00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32 @feof(i32 %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %26
6: ; preds = %0, %18
%7 = load i32, i32* @stdin
%8 = call i32* @fgets(i8* %2, i32 1024, i32 %7)
%9 = icmp eq i32* %8, null
br i1 %9, label %26, label %10
10: ; preds = %6
%11 = call i32 @strlen(i8* %2)
%12 = add nsw i32 %11, -1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 10
br i1 %16, label %17, label %18
17: ; preds = %10
store i8 0, i8* %14
br label %18
18: ; preds = %17, %10
%19 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %2)
%20 = call i32 @show_case_changed(i8 signext 108, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%21 = call i32 @show_case_changed(i8 signext 117, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%22 = call i32 @show_case_changed(i8 signext 116, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%23 = load i32, i32* @stdin
%24 = call i32 @feof(i32 %23)
%25 = icmp eq i32 %24, 0
br i1 %25, label %6, label %26
26: ; preds = %18, %6, %0
ret i32 0
}