#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*/ UpperCase(char *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main() {
  char UserString[20];
  fputs("Enter a string: ", stdout);
  fgets(UserString, 19, stdin);
  fputs("\nYou entered: ", stdout);
  fputs(UserString, stdout);
  fputs("\nAfter call to UpperCase this becomes: ", stdout);
  UpperCase(UserString);
  fputs(UserString, stdout);
  fputs("\n", stdout);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
lea    0xeb8(%rip),%rdi
call   1030 <fputs@plt>
lea    -0x20(%rbp),%rdi
mov    0x2e90(%rip),%rax
mov    (%rax),%edx
mov    $0x13,%esi
call   1040 <fgets@plt>
mov    0x2e6d(%rip),%rax
mov    (%rax),%esi
lea    0xe9d(%rip),%rdi
call   1030 <fputs@plt>
lea    -0x20(%rbp),%rdi
mov    0x2e54(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
mov    0x2e46(%rip),%rax
mov    (%rax),%esi
lea    0xe85(%rip),%rdi
call   1030 <fputs@plt>
lea    -0x20(%rbp),%rdi
call   1050 <UpperCase@plt>
lea    -0x20(%rbp),%rdi
mov    0x2e24(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
mov    0x2e16(%rip),%rax
mov    (%rax),%esi
lea    0xe7d(%rip),%rdi
call   1030 <fputs@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0x2e9a(%rip),%rbx
mov    (%rbx),%esi
lea    0xeb9(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2e95(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x13,%esi
call   1040 <fgets@plt>
mov    (%rbx),%esi
lea    0xea3(%rip),%rdi
call   1030 <fputs@plt>
mov    (%rbx),%esi
mov    %r14,%rdi
call   1030 <fputs@plt>
mov    (%rbx),%esi
lea    0xe9a(%rip),%rdi
call   1030 <fputs@plt>
mov    %r14,%rdi
call   1050 <UpperCase@plt>
mov    (%rbx),%esi
mov    %r14,%rdi
call   1030 <fputs@plt>
mov    (%rbx),%esi
lea    0xea2(%rip),%rdi
call   1030 <fputs@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Enter a string: \00"
@stdout = global i32 0
@stdin = global i32 0
@.str.1 = [15 x i8] c"\0AYou entered: \00"
@.str.2 = [40 x i8] c"\0AAfter call to UpperCase this becomes: \00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = load i32, i32* @stdout
%3 = call i32 @fputs(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %4, i32 19, i32 %5)
%7 = load i32, i32* @stdout
%8 = call i32 @fputs(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%10 = load i32, i32* @stdout
%11 = call i32 @fputs(i8* %9, i32 %10)
%12 = load i32, i32* @stdout
%13 = call i32 @fputs(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%15 = call i32 @UpperCase(i8* %14)
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%17 = load i32, i32* @stdout
%18 = call i32 @fputs(i8* %16, i32 %17)
%19 = load i32, i32* @stdout
%20 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter a string: \00"
@stdout = global i32 0
@stdin = global i32 0
@.str.1 = [15 x i8] c"\0AYou entered: \00"
@.str.2 = [40 x i8] c"\0AAfter call to UpperCase this becomes: \00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdout
%4 = tail call i32 @fputs(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %2, i32 19, i32 %5)
%7 = load i32, i32* @stdout
%8 = call i32 @fputs(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = load i32, i32* @stdout
%10 = call i32 @fputs(i8* %2, i32 %9)
%11 = load i32, i32* @stdout
%12 = call i32 @fputs(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%13 = call i32 @UpperCase(i8* %2)
%14 = load i32, i32* @stdout
%15 = call i32 @fputs(i8* %2, i32 %14)
%16 = load i32, i32* @stdout
%17 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 %16)
ret i32 0
}