#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__ isspace(char);
scalar_t__ strlen(char *);
char toupper(char);
void SU_Capitalize(char *The_String) {
  int i;
  for (i = ((int)strlen(The_String) - 1); i > 0; i--) {
    if ((isspace(The_String[i - 1])) || (The_String[i - 1] == '_')) {
      The_String[i] = toupper(The_String[i]);
    }
  }
}


x86 assembly (clang, -O0):
<SU_Capitalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    11c0 <SU_Capitalize+0x90>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1050 <isspace@plt>
cmp    $0x0,%rax
jne    118f <SU_Capitalize+0x5f>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5f,%eax
jne    11ad <SU_Capitalize+0x7d>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <toupper@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    11b2 <SU_Capitalize+0x82>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    114b <SU_Capitalize+0x1b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SU_Capitalize>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
cmp    $0x2,%eax
jl     11a1 <SU_Capitalize+0x71>
mov    %eax,%ebx
mov    $0xfffffffe,%r15d
add    %rbx,%r15
add    $0xffffffffffffffff,%rbx
jmp    1186 <SU_Capitalize+0x56>
cs nopw 0x0(%rax,%rax,1)
mov    %ebx,%r12d
movsbl (%r14,%r12,1),%edi
call   1030 <toupper@plt>
mov    %al,(%r14,%r12,1)
add    $0xffffffffffffffff,%r15
lea    -0x1(%rbx),%rax
add    $0x1,%rbx
cmp    $0x2,%rbx
mov    %rax,%rbx
jbe    11a1 <SU_Capitalize+0x71>
mov    %r15d,%r12d
movsbl (%r14,%r12,1),%edi
call   1050 <isspace@plt>
test   %rax,%rax
jne    1160 <SU_Capitalize+0x30>
cmpb   $0x5f,(%r14,%r12,1)
je     1160 <SU_Capitalize+0x30>
jmp    1171 <SU_Capitalize+0x41>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @SU_Capitalize(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = trunc i64 %5 to i32
%7 = sub nsw i32 %6, 1
store i32 %7, i32* %3
br label %8
8: ; preds = %41, %1
%9 = load i32, i32* %3
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %44
11: ; preds = %8
%12 = load i8*, i8** %2
%13 = load i32, i32* %3
%14 = sub nsw i32 %13, 1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %12, i64 %15
%17 = load i8, i8* %16
%18 = call i64 @isspace(i8 signext %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %29, label %20
20: ; preds = %11
%21 = load i8*, i8** %2
%22 = load i32, i32* %3
%23 = sub nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %21, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 95
br i1 %28, label %29, label %40
29: ; preds = %20, %11
%30 = load i8*, i8** %2
%31 = load i32, i32* %3
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = load i8, i8* %33
%35 = call signext i8 @toupper(i8 signext %34)
%36 = load i8*, i8** %2
%37 = load i32, i32* %3
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %36, i64 %38
store i8 %35, i8* %39
br label %40
40: ; preds = %29, %20
br label %41
41: ; preds = %40
%42 = load i32, i32* %3
%43 = add nsw i32 %42, -1
store i32 %43, i32* %3
br label %8
44: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @SU_Capitalize(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = trunc i64 %2 to i32
%4 = icmp sgt i32 %3, 1
br i1 %4, label %5, label %26
5: ; preds = %1
%6 = and i64 %2, 4294967295
br label %7
7: ; preds = %5, %24
%8 = phi i64 [ %6, %5 ], [ %9, %24 ]
%9 = add nsw i64 %8, -1
%10 = add nuw i64 %8, 4294967294
%11 = and i64 %10, 4294967295
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = tail call i64 @isspace(i8 signext %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %7
%17 = load i8, i8* %12
%18 = icmp eq i8 %17, 95
br i1 %18, label %19, label %24
19: ; preds = %16, %7
%20 = and i64 %9, 4294967295
%21 = getelementptr inbounds i8, i8* %0, i64 %20
%22 = load i8, i8* %21
%23 = tail call signext i8 @toupper(i8 signext %22)
store i8 %23, i8* %21
br label %24
24: ; preds = %16, %19
%25 = icmp ugt i64 %8, 2
br i1 %25, label %7, label %26
26: ; preds = %24, %1
ret void
}