#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*/ isupper(char);
char toupper(unsigned char);
void strToUpper(char *str) {
  register char *ptr = str;
  for (ptr = str; *ptr; ptr++)
    if (!isupper(*ptr))
      *ptr = toupper((unsigned char)*ptr);
}


x86 assembly (clang, -O0):
<strToUpper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1188 <strToUpper+0x68>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isupper@plt>
cmp    $0x0,%eax
jne    1172 <strToUpper+0x52>
mov    -0x10(%rbp),%rax
movzbl (%rax),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
jmp    1177 <strToUpper+0x57>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    113c <strToUpper+0x1c>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strToUpper>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1154 <strToUpper+0x34>
mov    %rdi,%rbx
jmp    113c <strToUpper+0x1c>
nopl   0x0(%rax)
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1154 <strToUpper+0x34>
movsbl %al,%edi
call   1040 <isupper@plt>
test   %eax,%eax
jne    1130 <strToUpper+0x10>
movzbl (%rbx),%edi
call   1030 <toupper@plt>
mov    %al,(%rbx)
jmp    1130 <strToUpper+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @strToUpper(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
%5 = load i8*, i8** %2
store i8* %5, i8** %3
br label %6
6: ; preds = %21, %1
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %24
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = call i32 @isupper(i8 signext %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %20, label %15
15: ; preds = %10
%16 = load i8*, i8** %3
%17 = load i8, i8* %16
%18 = call signext i8 @toupper(i8 zeroext %17)
%19 = load i8*, i8** %3
store i8 %18, i8* %19
br label %20
20: ; preds = %15, %10
br label %21
21: ; preds = %20
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %3
br label %6
24: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @strToUpper(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %12
%5 = phi i8 [ %14, %12 ], [ %2, %1 ]
%6 = phi i8* [ %13, %12 ], [ %0, %1 ]
%7 = tail call i32 @isupper(i8 signext %5)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = load i8, i8* %6
%11 = tail call signext i8 @toupper(i8 zeroext %10)
store i8 %11, i8* %6
br label %12
12: ; preds = %4, %9
%13 = getelementptr inbounds i8, i8* %6, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %4
16: ; preds = %12, %1
ret void
}