#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 *);
scalar_t__ toupper(char);
char *prname(char *mname, bool upper) {
  static char tbuf[1024];
  *tbuf = '\0';
  if (mname == 0)
    strcpy(tbuf, "you");
  else
    strcpy(tbuf, mname);
  if (upper)
    *tbuf = (char)toupper(*tbuf);
  return tbuf;
}


x86 assembly (clang, -O0):
<prname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movb   $0x0,0x2f0a(%rip)
cmpq   $0x0,-0x8(%rbp)
jne    1159 <prname+0x39>
lea    0x2ef8(%rip),%rdi
lea    0xeb1(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1169 <prname+0x49>
mov    -0x8(%rbp),%rsi
lea    0x2edc(%rip),%rdi
call   1030 <strcpy@plt>
cmpl   $0x0,-0xc(%rbp)
je     1185 <prname+0x65>
movsbl 0x2ec6(%rip),%edi
call   1040 <toupper@plt>
mov    %al,0x2ebb(%rip)
lea    0x2eb4(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prname>:
push   %rbx
mov    %esi,%ebx
movb   $0x0,0x2f16(%rip)
test   %rdi,%rdi
je     113b <prname+0x1b>
mov    %rdi,%rsi
lea    0x2f07(%rip),%rdi
jmp    1149 <prname+0x29>
lea    0x2efe(%rip),%rdi
lea    0xeb7(%rip),%rsi
call   1030 <strcpy@plt>
test   %ebx,%ebx
je     1164 <prname+0x44>
movsbl 0x2ee7(%rip),%edi
call   1040 <toupper@plt>
mov    %al,0x2edc(%rip)
lea    0x2ed5(%rip),%rax
pop    %rbx
ret

LLVM IR (-O0):
@prname.tbuf = internal global [1024 x i8] zeroinitializer
@.str = [4 x i8] c"you\00"
define i8* @prname(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i8 0, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @prname.tbuf, i64 0, i64 0)
%5 = load i8*, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = call i32 @strcpy(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @prname.tbuf, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %12
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = call i32 @strcpy(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @prname.tbuf, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %9, %7
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @prname.tbuf, i64 0, i64 0)
%17 = call i64 @toupper(i8 signext %16)
%18 = trunc i64 %17 to i8
store i8 %18, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @prname.tbuf, i64 0, i64 0)
br label %19
19: ; preds = %15, %12
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @prname.tbuf, i64 0, i64 0)
}

LLVM IR (-O2):
@prname.tbuf = internal global [1024 x i8] zeroinitializer
@.str = [4 x i8] c"you\00"
define i8* @prname(i8* %0, i32 %1) {
store i8 0, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @prname.tbuf, i64 0, i64 0)
%3 = icmp eq i8* %0, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @strcpy(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @prname.tbuf, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %8
6: ; preds = %2
%7 = tail call i32 @strcpy(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @prname.tbuf, i64 0, i64 0), i8* %0)
br label %8
8: ; preds = %6, %4
%9 = icmp eq i32 %1, 0
br i1 %9, label %14, label %10
10: ; preds = %8
%11 = load i8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @prname.tbuf, i64 0, i64 0)
%12 = tail call i64 @toupper(i8 signext %11)
%13 = trunc i64 %12 to i8
store i8 %13, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @prname.tbuf, i64 0, i64 0)
br label %14
14: ; preds = %10, %8
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @prname.tbuf, i64 0, i64 0)
}