#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 */
scalar_t__ get_line(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdin;
char *up_string(char *);
int main(int argc, char **argv) {
  char buffer[2048];
  if (argc > 1)
    while (--argc)
      printf("%s\n", up_string(*++argv));
  else
    while (get_line(buffer, stdin))
      printf("%s\n", up_string(buffer));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    119b <main+0x6b>
jmp    1158 <main+0x28>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     1196 <main+0x66>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
call   1050 <up_string@plt>
mov    %rax,%rsi
lea    0xe74(%rip),%rdi
call   1040 <printf@plt>
jmp    1158 <main+0x28>
jmp    11e4 <main+0xb4>
jmp    11a0 <main+0x70>
lea    -0x810(%rbp),%rdi
mov    0x2e3a(%rip),%rax
mov    (%rax),%esi
call   1030 <get_line@plt>
cmp    $0x0,%rax
je     11df <main+0xaf>
lea    -0x810(%rbp),%rdi
call   1050 <up_string@plt>
mov    %rax,%rsi
lea    0xe2b(%rip),%rdi
call   1040 <printf@plt>
jmp    11a0 <main+0x70>
jmp    11e4 <main+0xb4>
xor    %eax,%eax
add    $0x810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x808,%rsp
cmp    $0x1,%edi
jle    117f <main+0x4f>
mov    %rsi,%r15
mov    %edi,%r12d
mov    $0x1,%ebx
lea    0xeab(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r15,%rbx,8),%rdi
call   1050 <up_string@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %ebx,%r12d
jne    1160 <main+0x30>
jmp    11c3 <main+0x93>
mov    0x2e62(%rip),%r15
mov    (%r15),%esi
mov    %rsp,%rdi
call   1030 <get_line@plt>
test   %rax,%rax
je     11c3 <main+0x93>
mov    %rsp,%rbx
lea    0xe60(%rip),%r14
mov    %rbx,%rdi
call   1050 <up_string@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    (%r15),%esi
mov    %rbx,%rdi
call   1030 <get_line@plt>
test   %rax,%rax
jne    11a0 <main+0x70>
xor    %eax,%eax
add    $0x808,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2048 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %21
9: ; preds = %2
br label %10
10: ; preds = %14, %9
%11 = load i32, i32* %4
%12 = add nsw i32 %11, -1
store i32 %12, i32* %4
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %10
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i32 1
store i8** %16, i8*** %5
%17 = load i8*, i8** %16
%18 = call i8* @up_string(i8* %17)
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %18)
br label %10
20: ; preds = %10
br label %32
21: ; preds = %2
br label %22
22: ; preds = %27, %21
%23 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 0
%24 = load i32, i32* @stdin
%25 = call i64 @get_line(i8* %23, i32 %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %31
27: ; preds = %22
%28 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 0
%29 = call i8* @up_string(i8* %28)
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %29)
br label %22
31: ; preds = %22
br label %32
32: ; preds = %31, %20
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2048 x i8]
%4 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%5 = icmp sgt i32 %0, 1
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = load i32, i32* @stdin
%8 = call i64 @get_line(i8* %4, i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %27, label %21
10: ; preds = %2
%11 = add nsw i32 %0, -1
br label %12
12: ; preds = %10, %12
%13 = phi i32 [ %19, %12 ], [ %11, %10 ]
%14 = phi i8** [ %15, %12 ], [ %1, %10 ]
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = tail call i8* @up_string(i8* %16)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = add nsw i32 %13, -1
%20 = icmp eq i32 %19, 0
br i1 %20, label %27, label %12
21: ; preds = %6, %21
%22 = call i8* @up_string(i8* %4)
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = load i32, i32* @stdin
%25 = call i64 @get_line(i8* %4, i32 %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %21
27: ; preds = %21, %12, %6
ret i32 0
}