#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 */
unsigned int Strings_Length(char *, unsigned int);
char toupper(char);
void Strings_Capitalize(char *stringVar, unsigned int _stringVar_high) {
  unsigned int i;
  unsigned int h;
  i = 0;
  h = Strings_Length((char *)stringVar, _stringVar_high);
  while (i < h) {
    stringVar[i] = toupper(stringVar[i]);
    i += 1;
  }
}


x86 assembly (clang, -O0):
<Strings_Capitalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <Strings_Length@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    117b <Strings_Capitalize+0x5b>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
movsbl (%rax,%rcx,1),%edi
call   1030 <toupper@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1145 <Strings_Capitalize+0x25>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Strings_Capitalize>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
call   1040 <Strings_Length@plt>
test   %eax,%eax
je     1157 <Strings_Capitalize+0x37>
mov    %eax,%r14d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movsbl (%r15,%rbx,1),%edi
call   1030 <toupper@plt>
mov    %al,(%r15,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1140 <Strings_Capitalize+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

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