#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*/ strcpy(char *, char *);
char *QC_ucase(char *str) {
  static char s[1024];
  strcpy(s, str);
  str = s;
  while (*str) {
    if (*str >= 'a' && *str <= 'z')
      *str = *str - 'a' + 'A';
    str++;
  }
  return s;
}


x86 assembly (clang, -O0):
<QC_ucase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0x2f19(%rip),%rdi
call   1030 <strcpy@plt>
lea    0x2f0d(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     118a <QC_ucase+0x7a>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
jl     1179 <QC_ucase+0x69>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7a,%eax
jg     1179 <QC_ucase+0x69>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
sub    $0x61,%eax
add    $0x41,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1137 <QC_ucase+0x27>
lea    0x2eaf(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<QC_ucase>:
push   %rax
mov    %rdi,%rsi
lea    0x2f25(%rip),%rdi
call   1030 <strcpy@plt>
mov    0x2f1a(%rip),%al
test   %al,%al
je     115a <QC_ucase+0x4a>
lea    0x2f10(%rip),%rcx
jmp    114b <QC_ucase+0x3b>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rcx),%eax
add    $0x1,%rcx
test   %al,%al
je     115a <QC_ucase+0x4a>
lea    -0x61(%rax),%edx
cmp    $0x19,%dl
ja     1140 <QC_ucase+0x30>
add    $0xe0,%al
mov    %al,-0x1(%rcx)
jmp    1140 <QC_ucase+0x30>
lea    0x2edf(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@QC_ucase.s = internal global [1024 x i8] zeroinitializer
define i8* @QC_ucase(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @strcpy(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @QC_ucase.s, i64 0, i64 0), i8* %3)
store i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @QC_ucase.s, i64 0, i64 0), i8** %2
br label %5
5: ; preds = %27, %1
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %30
9: ; preds = %5
%10 = load i8*, i8** %2
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp sge i32 %12, 97
br i1 %13, label %14, label %27
14: ; preds = %9
%15 = load i8*, i8** %2
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp sle i32 %17, 122
br i1 %18, label %19, label %27
19: ; preds = %14
%20 = load i8*, i8** %2
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = sub nsw i32 %22, 97
%24 = add nsw i32 %23, 65
%25 = trunc i32 %24 to i8
%26 = load i8*, i8** %2
store i8 %25, i8* %26
br label %27
27: ; preds = %19, %14, %9
%28 = load i8*, i8** %2
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %2
br label %5
30: ; preds = %5
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @QC_ucase.s, i64 0, i64 0)
}

LLVM IR (-O2):
@QC_ucase.s = internal global [1024 x i8] zeroinitializer
define i8* @QC_ucase(i8* %0) {
%2 = tail call i32 @strcpy(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @QC_ucase.s, i64 0, i64 0), i8* %0)
%3 = load i8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @QC_ucase.s, i64 0, i64 0)
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %1, %12
%6 = phi i8 [ %14, %12 ], [ %3, %1 ]
%7 = phi i8* [ %13, %12 ], [ getelementptr inbounds ([1024 x i8], [1024 x i8]* @QC_ucase.s, i64 0, i64 0), %1 ]
%8 = add i8 %6, -97
%9 = icmp ult i8 %8, 26
br i1 %9, label %10, label %12
10: ; preds = %5
%11 = add nsw i8 %6, -32
store i8 %11, i8* %7
br label %12
12: ; preds = %10, %5
%13 = getelementptr inbounds i8, i8* %7, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %12, %1
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @QC_ucase.s, i64 0, i64 0)
}