#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*/ puts(char *);
char toupper(char);
int main() {
  char string[] = "You don't have to shout!";
  char c;
  int x = 0;
  puts(string);
  do {
    c = string[x];
    c = toupper(c);
    string[x] = c;
    x++;
  } while (c);
  puts(string);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec2(%rip),%al
mov    %al,-0x8(%rbp)
movl   $0x0,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <puts@plt>
movslq -0x28(%rbp),%rax
mov    -0x20(%rbp,%rax,1),%al
mov    %al,-0x21(%rbp)
movsbl -0x21(%rbp),%edi
call   1030 <toupper@plt>
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%cl
movslq -0x28(%rbp),%rax
mov    %cl,-0x20(%rbp,%rax,1)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
cmpb   $0x0,-0x21(%rbp)
jne    1169 <main+0x49>
lea    -0x20(%rbp),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movups 0xedd(%rip),%xmm0
movups %xmm0,0x9(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
call   1040 <puts@plt>
mov    $0x59,%edi
call   1030 <toupper@plt>
mov    %al,(%rsp)
test   %al,%al
je     1172 <main+0x52>
lea    0x1(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
movsbl (%rbx),%edi
call   1030 <toupper@plt>
mov    %al,(%rbx)
add    $0x1,%rbx
test   %al,%al
jne    1160 <main+0x40>
mov    %rsp,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.string = [25 x i8] c"You don't have to shout!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [25 x i8]
%3 = alloca i8
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [25 x i8]* %2 to i8*
store i32 0, i32* %4
%6 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 0
%7 = call i32 @puts(i8* %6)
br label %8
8: ; preds = %21, %0
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 %10
%12 = load i8, i8* %11
store i8 %12, i8* %3
%13 = load i8, i8* %3
%14 = call signext i8 @toupper(i8 signext %13)
store i8 %14, i8* %3
%15 = load i8, i8* %3
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 %17
store i8 %15, i8* %18
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %21
21: ; preds = %8
%22 = load i8, i8* %3
%23 = icmp ne i8 %22, 0
br i1 %23, label %8, label %24
24: ; preds = %21
%25 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 0
%26 = call i32 @puts(i8* %25)
ret i32 0
}

LLVM IR (-O2):
@__const.main.string = [25 x i8] c"You don't have to shout!\00"
define i32 @main() {
%1 = alloca [25 x i8]
%2 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 0
%3 = call i32 @puts(i8* %2)
%4 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 0
%5 = tail call signext i8 @toupper(i8 signext 89)
store i8 %5, i8* %4
%6 = icmp eq i8 %5, 0
br i1 %6, label %15, label %7
7: ; preds = %0, %7
%8 = phi i64 [ %13, %7 ], [ 1, %0 ]
%9 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 %8
%12 = tail call signext i8 @toupper(i8 signext %10)
store i8 %12, i8* %11
%13 = add nuw i64 %8, 1
%14 = icmp eq i8 %12, 0
br i1 %14, label %15, label %7
15: ; preds = %7, %0
%16 = call i32 @puts(i8* %2)
ret i32 0
}