#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*/ BUFSIZ;
int EXIT_SUCCESS;
int /*<<< orphan*/ free(char *);
scalar_t__ gets(char *);
scalar_t__ malloc(int /*<<< orphan*/);
int /*<<< orphan*/ puts(char *);
char *strtoupper(char *);
int main(void) {
  char *b, *s;
  b = (char *)malloc(BUFSIZ);
  while (gets(b)) {
    s = strtoupper(b);
    if (*s != '\0') {
      puts(s);
      free(s);
    }
  }
  free(b);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
call   1070 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <gets@plt>
cmp    $0x0,%rax
je     11b8 <main+0x68>
mov    -0x10(%rbp),%rdi
call   1050 <strtoupper@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11b3 <main+0x63>
mov    -0x18(%rbp),%rdi
call   1040 <puts@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
jmp    1171 <main+0x21>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    0x2e10(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1070 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
jmp    1173 <main+0x23>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1060 <gets@plt>
test   %rax,%rax
je     119f <main+0x4f>
mov    %r14,%rdi
call   1050 <strtoupper@plt>
cmpb   $0x0,(%rax)
je     1170 <main+0x20>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
jmp    1170 <main+0x20>
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x2e2a(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@BUFSIZ = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
%4 = load i32, i32* @BUFSIZ
%5 = call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %2
br label %7
7: ; preds = %23, %0
%8 = load i8*, i8** %2
%9 = call i64 @gets(i8* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %24
11: ; preds = %7
%12 = load i8*, i8** %2
%13 = call i8* @strtoupper(i8* %12)
store i8* %13, i8** %3
%14 = load i8*, i8** %3
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %11
%19 = load i8*, i8** %3
%20 = call i32 @puts(i8* %19)
%21 = load i8*, i8** %3
%22 = call i32 @free(i8* %21)
br label %23
23: ; preds = %18, %11
br label %7
24: ; preds = %7
%25 = load i8*, i8** %2
%26 = call i32 @free(i8* %25)
%27 = load i32, i32* @EXIT_SUCCESS
ret i32 %27
}

LLVM IR (-O2):
@BUFSIZ = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = load i32, i32* @BUFSIZ
%2 = tail call i64 @malloc(i32 %1)
%3 = inttoptr i64 %2 to i8*
%4 = tail call i64 @gets(i8* %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %0, %13
%7 = tail call i8* @strtoupper(i8* %3)
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %6
%11 = tail call i32 @puts(i8* %7)
%12 = tail call i32 @free(i8* %7)
br label %13
13: ; preds = %10, %6
%14 = tail call i64 @gets(i8* %3)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %6
16: ; preds = %13, %0
%17 = tail call i32 @free(i8* %3)
%18 = load i32, i32* @EXIT_SUCCESS
ret i32 %18
}