char *cntname(src)
register const char *src;
{
  register char *dst, c;
  static char buf[100];
  dst = buf;
  *dst++ = 'N';
  while ((c = *src++) != 0)
    *dst++ = islower(c) ? toupper(c) : c;
  *dst = 0;
  return (buf);
}


x86 assembly (clang, -O0):
<cntname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0x2f0d(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x4e,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
je     11ae <cntname+0x8e>
movsbl -0x11(%rbp),%edi
call   1030 <islower@plt>
cmp    $0x0,%eax
je     118c <cntname+0x6c>
movsbl -0x11(%rbp),%edi
call   1040 <toupper@plt>
mov    %eax,-0x18(%rbp)
jmp    1193 <cntname+0x73>
movsbl -0x11(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    1149 <cntname+0x29>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
lea    0x2e84(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cntname>:
push   %rbp
push   %r14
push   %rbx
movb   $0x4e,0x2f15(%rip)
mov    (%rdi),%al
test   %al,%al
je     117c <cntname+0x5c>
mov    %rdi,%r14
add    $0x1,%r14
lea    0x2f02(%rip),%rbx
jmp    1163 <cntname+0x43>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %bpl,(%rbx)
add    $0x1,%rbx
movzbl (%r14),%eax
add    $0x1,%r14
test   %al,%al
je     1183 <cntname+0x63>
movsbl %al,%ebp
mov    %ebp,%edi
call   1030 <islower@plt>
test   %eax,%eax
je     1150 <cntname+0x30>
mov    %ebp,%edi
call   1040 <toupper@plt>
mov    %eax,%ebp
jmp    1150 <cntname+0x30>
lea    0x2ebe(%rip),%rbx
movb   $0x0,(%rbx)
lea    0x2eb3(%rip),%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@cntname.buf = internal global [100 x i8] zeroinitializer
define i8* @cntname(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %2
store i8* getelementptr inbounds ([100 x i8], [100 x i8]* @cntname.buf, i64 0, i64 0), i8** %3
%5 = load i8*, i8** %3
%6 = getelementptr inbounds i8, i8* %5, i32 1
store i8* %6, i8** %3
store i8 78, i8* %5
br label %7
7: ; preds = %25, %1
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %2
%10 = load i8, i8* %8
store i8 %10, i8* %4
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %30
13: ; preds = %7
%14 = load i8, i8* %4
%15 = sext i8 %14 to i32
%16 = call i32 @islower(i32 %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %13
%19 = load i8, i8* %4
%20 = sext i8 %19 to i32
%21 = call i32 @toupper(i32 %20)
br label %25
22: ; preds = %13
%23 = load i8, i8* %4
%24 = sext i8 %23 to i32
br label %25
25: ; preds = %22, %18
%26 = phi i32 [ %21, %18 ], [ %24, %22 ]
%27 = trunc i32 %26 to i8
%28 = load i8*, i8** %3
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %3
store i8 %27, i8* %28
br label %7
30: ; preds = %7
%31 = load i8*, i8** %3
store i8 0, i8* %31
ret i8* getelementptr inbounds ([100 x i8], [100 x i8]* @cntname.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@cntname.buf = internal global [100 x i8] zeroinitializer
define i8* @cntname(i8* nocapture %0) {
store i8 78, i8* getelementptr inbounds ([100 x i8], [100 x i8]* @cntname.buf, i64 0, i64 0)
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %20, label %4
4: ; preds = %1, %14
%5 = phi i8 [ %18, %14 ], [ %2, %1 ]
%6 = phi i8* [ %8, %14 ], [ %0, %1 ]
%7 = phi i8* [ %17, %14 ], [ getelementptr inbounds ([100 x i8], [100 x i8]* @cntname.buf, i64 0, i64 1), %1 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = sext i8 %5 to i32
%10 = tail call i32 @islower(i32 %9)
%11 = icmp eq i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %4
%13 = tail call i32 @toupper(i32 %9)
br label %14
14: ; preds = %4, %12
%15 = phi i32 [ %13, %12 ], [ %9, %4 ]
%16 = trunc i32 %15 to i8
%17 = getelementptr inbounds i8, i8* %7, i64 1
store i8 %16, i8* %7
%18 = load i8, i8* %8
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %4
20: ; preds = %14, %1
%21 = phi i8* [ getelementptr inbounds ([100 x i8], [100 x i8]* @cntname.buf, i64 0, i64 1), %1 ], [ %17, %14 ]
store i8 0, i8* %21
ret i8* getelementptr inbounds ([100 x i8], [100 x i8]* @cntname.buf, i64 0, i64 0)
}