#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*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
char *strrev(char *);
char *strupr(char *);
int main() {
  char *s;
  printf("Enter a string: ");
  gets(s);
  printf("The string in UPPERCASE is %s\n", strupr(s));
  printf("Enter a string: ");
  gets(s);
  printf("The string in reverse is %s\n", strrev(s));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <gets@plt>
mov    -0x8(%rbp),%rdi
call   1050 <strupr@plt>
mov    %rax,%rsi
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <gets@plt>
mov    -0x8(%rbp),%rdi
call   1060 <strrev@plt>
mov    %rax,%rsi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xeb8(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
call   1040 <gets@plt>
call   1050 <strupr@plt>
lea    0xeae(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
call   1040 <gets@plt>
call   1060 <strrev@plt>
lea    0xea8(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Enter a string: \00"
@.str.1 = [31 x i8] c"The string in UPPERCASE is %s\0A\00"
@.str.2 = [29 x i8] c"The string in reverse is %s\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = load i8*, i8** %1
%4 = call i32 @gets(i8* %3)
%5 = load i8*, i8** %1
%6 = call i8* @strupr(i8* %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%9 = load i8*, i8** %1
%10 = call i32 @gets(i8* %9)
%11 = load i8*, i8** %1
%12 = call i8* @strrev(i8* %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter a string: \00"
@.str.1 = [31 x i8] c"The string in UPPERCASE is %s\0A\00"
@.str.2 = [29 x i8] c"The string in reverse is %s\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @gets(i8* undef)
%3 = tail call i8* @strupr(i8* undef)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @gets(i8* undef)
%7 = tail call i8* @strrev(i8* undef)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %7)
ret i32 0
}