#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 strlen(char *);
char toupper(char);
char *wPopString();
int /*<<< orphan*/ wPushString(char *);
void wBasUCase() {
  int len, i;
  char *string;
  string = wPopString();
  len = strlen(string);
  for (i = 0; i < len; i++) {
    string[i] = toupper(string[i]);
  }
  wPushString(string);
}


x86 assembly (clang, -O0):
<wBasUCase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <wPopString@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    119e <wBasUCase+0x5e>
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <toupper@plt>
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1166 <wBasUCase+0x26>
mov    -0x10(%rbp),%rdi
call   1060 <wPushString@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wBasUCase>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <wPopString@plt>
mov    %rax,%r15
mov    %rax,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jle    1177 <wBasUCase+0x37>
mov    %eax,%r14d
xor    %ebx,%ebx
movsbl (%r15,%rbx,1),%edi
call   1030 <toupper@plt>
mov    %al,(%r15,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1160 <wBasUCase+0x20>
mov    %r15,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1060 <wPushString@plt>

LLVM IR (-O0):
define void @wBasUCase() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = call i8* (...) @wPopString()
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %1
store i32 0, i32* %2
br label %7
7: ; preds = %22, %0
%8 = load i32, i32* %2
%9 = load i32, i32* %1
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %25
11: ; preds = %7
%12 = load i8*, i8** %3
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = call signext i8 @toupper(i8 signext %16)
%18 = load i8*, i8** %3
%19 = load i32, i32* %2
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 %17, i8* %21
br label %22
22: ; preds = %11
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
br label %7
25: ; preds = %7
%26 = load i8*, i8** %3
%27 = call i32 @wPushString(i8* %26)
ret void
}

LLVM IR (-O2):
define void @wBasUCase() {
%1 = tail call i8* (...) @wPopString()
%2 = tail call i32 @strlen(i8* %1)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %13
4: ; preds = %0
%5 = zext i32 %2 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i8, i8* %1, i64 %7
%9 = load i8, i8* %8
%10 = tail call signext i8 @toupper(i8 signext %9)
store i8 %10, i8* %8
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %0
%14 = tail call i32 @wPushString(i8* %1)
ret void
}