#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*/ changeCase(char, char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main(void) {
  char original[100];
  char updated[100];
  char choice;
  printf("Change Case\n");
  printf("==============\n");
  printf("Case (U for upper, L for lower) : ");
  scanf(" %c", &choice);
  printf("Name of the original file       : ");
  scanf("%s", original);
  printf("Name of the updated file        : ");
  scanf("%s", updated);
  changeCase(choice, original, updated);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    -0xe1(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xed7(%rip),%rdi
call   1050 <scanf@plt>
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
lea    -0xe0(%rbp),%rsi
lea    0xeb8(%rip),%rdi
call   1050 <scanf@plt>
mov    -0xe1(%rbp),%al
lea    -0x70(%rbp),%rsi
lea    -0xe0(%rbp),%rdx
movsbl %al,%edi
call   1040 <changeCase@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xf0,%rsp
lea    0xf1d(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1d(%rip),%rdi
call   1030 <puts@plt>
lea    0xe95(%rip),%rdi
call   1040 <printf@plt>
lea    0xeac(%rip),%rdi
lea    0xf(%rsp),%rsi
call   1060 <scanf@plt>
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb6(%rip),%r15
lea    0x80(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1060 <scanf@plt>
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
lea    0x10(%rsp),%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
movsbl 0xf(%rsp),%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <changeCase@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Change Case\0A\00"
@.str.1 = [16 x i8] c"==============\0A\00"
@.str.2 = [35 x i8] c"Case (U for upper, L for lower) : \00"
@.str.3 = [4 x i8] c" %c\00"
@.str.4 = [35 x i8] c"Name of the original file : \00"
@.str.5 = [3 x i8] c"%s\00"
@.str.6 = [35 x i8] c"Name of the updated file : \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = alloca i8
store i32 0, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%9 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0))
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %13)
%15 = load i8, i8* %4
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%18 = call i32 @changeCase(i8 signext %15, i8* %16, i8* %17)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [35 x i8] c"Case (U for upper, L for lower) : \00"
@.str.3 = [4 x i8] c" %c\00"
@.str.4 = [35 x i8] c"Name of the original file : \00"
@.str.5 = [3 x i8] c"%s\00"
@.str.6 = [35 x i8] c"Name of the updated file : \00"
@str = [12 x i8] c"Change Case\00"
@str.7 = [15 x i8] c"==============\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = alloca i8
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.7, i64 0, i64 0))
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %3)
%10 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%12 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %5)
%14 = load i8, i8* %3
%15 = call i32 @changeCase(i8 signext %14, i8* %4, i8* %5)
ret i32 0
}