#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*/ read(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ sleep(int);
int strlen(char *);
int /*<<< orphan*/ write(int, char *, int);
int main() {
  char buf[128];
  int i;
  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));
  sleep(1);
  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   1060 <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>
mov    $0x1,%edi
call   1070 <sleep@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %rsp,%rbx
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x80,%edx
call   1060 <read@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jle    11a7 <main+0x57>
xor    %ebx,%ebx
mov    %rsp,%r14
jmp    1193 <main+0x43>
nop
add    $0x1,%rbx
mov    %r14,%rdi
call   1050 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    11a7 <main+0x57>
movsbl (%rsp,%rbx,1),%edi
call   1030 <islower@plt>
test   %rax,%rax
je     1180 <main+0x30>
addb   $0xe0,(%rsp,%rbx,1)
jmp    1180 <main+0x30>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

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

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
%3 = call i32 @read(i32 0, i8* %2, i32 128)
%4 = call i32 @strlen(i8* %2)
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %20
6: ; preds = %0, %15
%7 = phi i64 [ %16, %15 ], [ 0, %0 ]
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 %7
%9 = load i8, i8* %8
%10 = call i64 @islower(i8 signext %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %6
%13 = load i8, i8* %8
%14 = add i8 %13, -32
store i8 %14, i8* %8
br label %15
15: ; preds = %6, %12
%16 = add nuw nsw i64 %7, 1
%17 = call i32 @strlen(i8* %2)
%18 = sext i32 %17 to i64
%19 = icmp slt i64 %16, %18
br i1 %19, label %6, label %20
20: ; preds = %15, %0
%21 = call i32 @strlen(i8* %2)
%22 = call i32 @write(i32 1, i8* %2, i32 %21)
%23 = call i32 @sleep(i32 1)
ret i32 0
}