#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*/ printf(char *);
int /*<<< orphan*/ putchar(char);
void print_name_uppercase(char *name) {
  unsigned int i;
  printf("Hello, my uppercase name is ");
  i = 0;
  while (name[i]) {
    if (name[i] >= 'a' && name[i] <= 'z') {
      putchar(name[i] + 'A' - 'a');
    } else {
      putchar(name[i]);
    }
    i++;
  }
}


x86 assembly (clang, -O0):
<print_name_uppercase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
cmpb   $0x0,(%rax,%rcx,1)
je     11b4 <print_name_uppercase+0x94>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x61,%eax
jl     1196 <print_name_uppercase+0x76>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7a,%eax
jg     1196 <print_name_uppercase+0x76>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
add    $0x41,%eax
sub    $0x61,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    11a6 <print_name_uppercase+0x86>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
movsbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113f <print_name_uppercase+0x1f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_name_uppercase>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xed3(%rip),%rdi
call   1040 <printf@plt>
mov    (%rbx),%al
test   %al,%al
je     1167 <print_name_uppercase+0x47>
mov    $0x1,%ebp
nopl   (%rax)
lea    -0x61(%rax),%ecx
lea    -0x20(%rax),%edx
cmp    $0x1a,%cl
movzbl %al,%eax
movzbl %dl,%ecx
cmovae %eax,%ecx
movsbl %cl,%edi
call   1030 <putchar@plt>
mov    %ebp,%eax
movzbl (%rbx,%rax,1),%eax
add    $0x1,%ebp
test   %al,%al
jne    1140 <print_name_uppercase+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Hello, my uppercase name is \00"
define void @print_name_uppercase(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %5
5: ; preds = %46, %1
%6 = load i8*, i8** %2
%7 = load i32, i32* %3
%8 = zext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %49
12: ; preds = %5
%13 = load i8*, i8** %2
%14 = load i32, i32* %3
%15 = zext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp sge i32 %18, 97
br i1 %19, label %20, label %39
20: ; preds = %12
%21 = load i8*, i8** %2
%22 = load i32, i32* %3
%23 = zext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp sle i32 %26, 122
br i1 %27, label %28, label %39
28: ; preds = %20
%29 = load i8*, i8** %2
%30 = load i32, i32* %3
%31 = zext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = add nsw i32 %34, 65
%36 = sub nsw i32 %35, 97
%37 = trunc i32 %36 to i8
%38 = call i32 @putchar(i8 signext %37)
br label %46
39: ; preds = %20, %12
%40 = load i8*, i8** %2
%41 = load i32, i32* %3
%42 = zext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %40, i64 %42
%44 = load i8, i8* %43
%45 = call i32 @putchar(i8 signext %44)
br label %46
46: ; preds = %39, %28
%47 = load i32, i32* %3
%48 = add i32 %47, 1
store i32 %48, i32* %3
br label %5
49: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"Hello, my uppercase name is \00"
define void @print_name_uppercase(i8* nocapture %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %18, label %5
5: ; preds = %1, %5
%6 = phi i8 [ %16, %5 ], [ %3, %1 ]
%7 = phi i32 [ %13, %5 ], [ 0, %1 ]
%8 = add i8 %6, -97
%9 = icmp ult i8 %8, 26
%10 = add nsw i8 %6, -32
%11 = select i1 %9, i8 %10, i8 %6
%12 = tail call i32 @putchar(i8 signext %11)
%13 = add i32 %7, 1
%14 = zext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %0, i64 %14
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %5
18: ; preds = %5, %1
ret void
}