#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*/ outbyte(int /*<<< orphan*/);
int /*<<< orphan*/ outstr(char *);
int strlen(char *);
int /*<<< orphan*/ toupper(int /*<<< orphan*/);
void outname(char *sname, char pref) {
  int i;
  if (pref) {
    outstr("_");
  }
  if (strlen(sname) > 32) {
    i = 32;
    while (i--)
      outbyte(toupper(*sname++));
  } else
    outstr(sname);
}


x86 assembly (clang, -O0):
<outname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
cmpb   $0x0,-0x9(%rbp)
je     1168 <outname+0x28>
lea    0xe9d(%rip),%rdi
call   1050 <outstr@plt>
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x20,%eax
jle    11bd <outname+0x7d>
movl   $0x20,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x10(%rbp)
cmp    $0x0,%eax
je     11b8 <outname+0x78>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %eax,%edi
call   1060 <outbyte@plt>
jmp    1181 <outname+0x41>
jmp    11c6 <outname+0x86>
mov    -0x8(%rbp),%rdi
call   1050 <outstr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outname>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
test   %sil,%sil
je     1158 <outname+0x18>
lea    0xead(%rip),%rdi
call   1050 <outstr@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
cmp    $0x21,%eax
jl     1192 <outname+0x52>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movsbl (%r14,%rbx,1),%edi
call   1030 <toupper@plt>
mov    %eax,%edi
call   1060 <outbyte@plt>
add    $0x1,%rbx
cmp    $0x20,%ebx
jne    1170 <outname+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <outstr@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"_\00"
define void @outname(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i32
store i8* %0, i8** %3
store i8 %1, i8* %4
%6 = load i8, i8* %4
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @outstr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = load i8*, i8** %3
%12 = call i32 @strlen(i8* %11)
%13 = icmp sgt i32 %12, 32
br i1 %13, label %14, label %27
14: ; preds = %10
store i32 32, i32* %5
br label %15
15: ; preds = %19, %14
%16 = load i32, i32* %5
%17 = add nsw i32 %16, -1
store i32 %17, i32* %5
%18 = icmp ne i32 %16, 0
br i1 %18, label %19, label %26
19: ; preds = %15
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %3
%22 = load i8, i8* %20
%23 = sext i8 %22 to i32
%24 = call i32 @toupper(i32 %23)
%25 = call i32 @outbyte(i32 %24)
br label %15
26: ; preds = %15
br label %30
27: ; preds = %10
%28 = load i8*, i8** %3
%29 = call i32 @outstr(i8* %28)
br label %30
30: ; preds = %27, %26
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"_\00"
define void @outname(i8* %0, i8 signext %1) {
%3 = icmp eq i8 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @outstr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %2
%7 = tail call i32 @strlen(i8* %0)
%8 = icmp sgt i32 %7, 32
br i1 %8, label %9, label %19
9: ; preds = %6, %9
%10 = phi i32 [ %12, %9 ], [ 32, %6 ]
%11 = phi i8* [ %13, %9 ], [ %0, %6 ]
%12 = add nsw i32 %10, -1
%13 = getelementptr inbounds i8, i8* %11, i64 1
%14 = load i8, i8* %11
%15 = sext i8 %14 to i32
%16 = tail call i32 @toupper(i32 %15)
%17 = tail call i32 @outbyte(i32 %16)
%18 = icmp eq i32 %12, 0
br i1 %18, label %21, label %9
19: ; preds = %6
%20 = tail call i32 @outstr(i8* %0)
br label %21
21: ; preds = %9, %19
ret void
}