#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__ islower(char);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ read(int /*<<< orphan*/, char *, int);
int strlen(char *);
int /*<<< orphan*/ write(int, char *, int);
int main() {
  char buf[128];
  int i;
  while (1) {
    read(0, buf, 128);
    for (i = 0; i < strlen(buf); ++i) {
      if (islower(buf[i]))
        buf[i] = buf[i] - 32;
    }
    write(1, buf, strlen(buf));
    memset(buf, 0, 128);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x90(%rbp),%rsi
xor    %edi,%edi
mov    $0x80,%edx
call   1070 <read@plt>
movl   $0x0,-0x94(%rbp)
mov    -0x94(%rbp),%eax
mov    %eax,-0x98(%rbp)
lea    -0x90(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x98(%rbp),%eax
cmp    %ecx,%eax
jge    1200 <main+0xb0>
movslq -0x94(%rbp),%rax
movsbl -0x90(%rbp,%rax,1),%edi
ff
call   1030 <islower@plt>
cmp    $0x0,%rax
je     11e7 <main+0x97>
movslq -0x94(%rbp),%rax
movsbl -0x90(%rbp,%rax,1),%eax
ff
sub    $0x20,%eax
mov    %al,%cl
movslq -0x94(%rbp),%rax
mov    %cl,-0x90(%rbp,%rax,1)
jmp    11ec <main+0x9c>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    117f <main+0x2f>
lea    -0x90(%rbp),%rax
mov    %rax,-0xa0(%rbp)
lea    -0x90(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0xa0(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1040 <write@plt>
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1060 <memset@plt>
jmp    1162 <main+0x12>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %rsp,%r14
jmp    1186 <main+0x36>
nop
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1060 <memset@plt>
xor    %edi,%edi
mov    %r14,%rsi
mov    $0x80,%edx
call   1070 <read@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jle    1160 <main+0x10>
xor    %ebx,%ebx
jmp    11c3 <main+0x73>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rbx
mov    %r14,%rdi
call   1050 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    1160 <main+0x10>
movsbl (%rsp,%rbx,1),%edi
call   1030 <islower@plt>
test   %rax,%rax
je     11b0 <main+0x60>
addb   $0xe0,(%rsp,%rbx,1)
jmp    11b0 <main+0x60>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [128 x i8]
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %0, %34
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%6 = call i32 @read(i32 0, i8* %5, i32 128)
store i32 0, i32* %3
br label %7
7: ; preds = %31, %4
%8 = load i32, i32* %3
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%10 = call i32 @strlen(i8* %9)
%11 = icmp slt i32 %8, %10
br i1 %11, label %12, label %34
12: ; preds = %7
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = call i64 @islower(i8 signext %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %30
19: ; preds = %12
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = sub nsw i32 %24, 32
%26 = trunc i32 %25 to i8
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 %28
store i8 %26, i8* %29
br label %30
30: ; preds = %19, %12
br label %31
31: ; preds = %30
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %7
34: ; preds = %7
%35 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%36 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%37 = call i32 @strlen(i8* %36)
%38 = call i32 @write(i32 1, i8* %35, i32 %37)
%39 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%40 = call i32 @memset(i8* %39, i32 0, i32 128)
br label %4
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %21, %0
%4 = call i32 @read(i32 0, i8* %2, i32 128)
%5 = call i32 @strlen(i8* %2)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %21
7: ; preds = %3, %16
%8 = phi i64 [ %17, %16 ], [ 0, %3 ]
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = call i64 @islower(i8 signext %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %7
%14 = load i8, i8* %9
%15 = add i8 %14, -32
store i8 %15, i8* %9
br label %16
16: ; preds = %7, %13
%17 = add nuw nsw i64 %8, 1
%18 = call i32 @strlen(i8* %2)
%19 = sext i32 %18 to i64
%20 = icmp slt i64 %17, %19
br i1 %20, label %7, label %21
21: ; preds = %16, %3
%22 = call i32 @strlen(i8* %2)
%23 = call i32 @write(i32 1, i8* %2, i32 %22)
%24 = call i32 @memset(i8* %2, i32 0, i32 128)
br label %3
}