#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 */
typedef int /*<<< orphan*/ cpmname;

/* Variables and functions */
int /*<<< orphan*/ memmove(char *, char *, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *strrchr(char *, char);
char toupper(char);
char *make83(char *filename) {
  static char cpmname[1024];
  int f, namelen;
  char *ptr, *ptr2;
  memset(cpmname, 0, sizeof(cpmname));
  if ((ptr = strrchr(filename, '/')) == NULL)
    ptr = filename;
  else
    ptr++;
  if ((*ptr) == '.') {
    *cpmname = 'x';
    strcpy(cpmname + 1, ptr);
  } else
    strcpy(cpmname, ptr);
  if ((ptr = strchr(cpmname, '.')) == NULL)
    namelen = strlen(cpmname);
  else
    namelen = (ptr - cpmname);
  if (namelen > 8)
    namelen = 8;
  cpmname[namelen] = 0;
  if (ptr != NULL) {
    ptr++;
    if ((ptr2 = strchr(ptr, '.')) != NULL)
      *ptr2 = 0;
    if (strlen(ptr) > 3)
      ptr[3] = 0;
    memmove(cpmname + 8, ptr, strlen(ptr) + 1);
  }
  for (f = namelen; f <= 7; f++)
    cpmname[f] = 32;
  for (f = strlen(cpmname + 8); f <= 2; f++)
    cpmname[8 + f] = 32;
  cpmname[11] = 0;
  for (f = 0; f < strlen(cpmname); f++)
    cpmname[f] = toupper(cpmname[f]);
  return (cpmname);
}


x86 assembly (clang, -O0):
<make83>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
lea    0x2eed(%rip),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1070 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11b8 <make83+0x48>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    11c4 <make83+0x54>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    11f0 <make83+0x80>
movb   $0x78,0x2e95(%rip)
mov    -0x18(%rbp),%rsi
lea    0x2e8b(%rip),%rdi
call   1030 <strcpy@plt>
jmp    1200 <make83+0x90>
mov    -0x18(%rbp),%rsi
lea    0x2e75(%rip),%rdi
call   1030 <strcpy@plt>
lea    0x2e69(%rip),%rdi
mov    $0x2e,%esi
call   1060 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1233 <make83+0xc3>
lea    0x2e4a(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x10(%rbp)
jmp    1244 <make83+0xd4>
mov    -0x18(%rbp),%rax
lea    0x2e32(%rip),%rcx
sub    %rcx,%rax
mov    %eax,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jle    1255 <make83+0xe5>
movl   $0x8,-0x10(%rbp)
movslq -0x10(%rbp),%rcx
lea    0x2e10(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
cmpq   $0x0,-0x18(%rbp)
je     12de <make83+0x16e>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x2e,%esi
call   1060 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     129e <make83+0x12e>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x3,%eax
jle    12b8 <make83+0x148>
mov    -0x18(%rbp),%rax
movb   $0x0,0x3(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
add    $0x1,%edx
lea    0x2d9f(%rip),%rdi
call   1090 <memmove@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x7,-0xc(%rbp)
jg     130b <make83+0x19b>
movslq -0xc(%rbp),%rcx
lea    0x2d77(%rip),%rax
movb   $0x20,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    12e4 <make83+0x174>
lea    0x2d66(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jg     1346 <make83+0x1d6>
mov    -0xc(%rbp),%eax
add    $0x8,%eax
movslq %eax,%rcx
lea    0x2d3c(%rip),%rax
movb   $0x20,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    131a <make83+0x1aa>
movb   $0x0,0x2d2e(%rip)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x2c(%rbp)
lea    0x2d0f(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
cmp    %ecx,%eax
jge    13a5 <make83+0x235>
movslq -0xc(%rbp),%rcx
lea    0x2cf2(%rip),%rax
movsbl (%rax,%rcx,1),%edi
call   1040 <toupper@plt>
mov    %al,%dl
movslq -0xc(%rbp),%rcx
lea    0x2cdc(%rip),%rax
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1354 <make83+0x1e4>
lea    0x2cc4(%rip),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make83>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0x2eef(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1070 <strrchr@plt>
lea    0x1(%rax),%rsi
test   %rax,%rax
cmove  %rbx,%rsi
cmpb   $0x2e,(%rsi)
jne    11bb <make83+0x4b>
movb   $0x78,0x2ebc(%rip)
lea    0x2eb6(%rip),%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
lea    0x2ea6(%rip),%r14
mov    %r14,%rdi
mov    $0x2e,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     12e3 <make83+0x173>
mov    %rax,%r15
sub    %r14d,%eax
cmp    $0x8,%eax
mov    $0x8,%ebp
cmovl  %eax,%ebp
movslq %ebp,%rax
movb   $0x0,(%rax,%r14,1)
mov    %r15,%rbx
add    $0x1,%rbx
mov    %rbx,%rdi
mov    $0x2e,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     1215 <make83+0xa5>
movb   $0x0,(%rax)
mov    %rbx,%rdi
call   1050 <strlen@plt>
cmp    $0x4,%eax
jl     1227 <make83+0xb7>
movb   $0x0,0x4(%r15)
mov    %rbx,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%edx
lea    0x2e3f(%rip),%rdi
mov    %rbx,%rsi
call   1090 <memmove@plt>
cmp    $0x7,%ebp
jg     1261 <make83+0xf1>
movslq %ebp,%rdi
add    %r14,%rdi
mov    $0x7,%edx
sub    %ebp,%edx
add    $0x1,%rdx
mov    $0x20,%esi
call   1080 <memset@plt>
lea    0x2e10(%rip),%rdi
call   1050 <strlen@plt>
cmp    $0x2,%eax
jg     1292 <make83+0x122>
movslq %eax,%rcx
lea    (%rcx,%r14,1),%rdi
add    $0x8,%rdi
mov    $0x2,%edx
sub    %eax,%edx
add    $0x1,%rdx
mov    $0x20,%esi
call   1080 <memset@plt>
movb   $0x0,0x2de2(%rip)
lea    0x2dd0(%rip),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jle    12d1 <make83+0x161>
xor    %ebp,%ebp
xchg   %ax,%ax
movsbl 0x0(%rbp,%rbx,1),%edi
call   1040 <toupper@plt>
mov    %al,0x0(%rbp,%rbx,1)
add    $0x1,%rbp
mov    %rbx,%rdi
call   1050 <strlen@plt>
cltq
cmp    %rax,%rbp
jl     12b0 <make83+0x140>
lea    0x2d98(%rip),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r14,%rdi
call   1050 <strlen@plt>
cmp    $0x8,%eax
mov    $0x8,%ebp
cmovl  %eax,%ebp
movslq %ebp,%rax
movb   $0x0,(%rax,%r14,1)
cmp    $0x7,%ebp
jle    1246 <make83+0xd6>
jmp    1261 <make83+0xf1>

LLVM IR (-O0):
@make83.cpmname = internal global [1024 x i8] zeroinitializer
define i8* @make83(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %2
%7 = call i32 @memset(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 0), i32 0, i32 1024)
%8 = load i8*, i8** %2
%9 = call i8* @strrchr(i8* %8, i8 signext 47)
store i8* %9, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = load i8*, i8** %2
store i8* %12, i8** %5
br label %16
13: ; preds = %1
%14 = load i8*, i8** %5
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %5
br label %16
16: ; preds = %13, %11
%17 = load i8*, i8** %5
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 46
br i1 %20, label %21, label %24
21: ; preds = %16
store i8 120, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 0)
%22 = load i8*, i8** %5
%23 = call i32 @strcpy(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 1), i8* %22)
br label %27
24: ; preds = %16
%25 = load i8*, i8** %5
%26 = call i32 @strcpy(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 0), i8* %25)
br label %27
27: ; preds = %24, %21
%28 = call i8* @strchr(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 0), i8 signext 46)
store i8* %28, i8** %5
%29 = icmp eq i8* %28, null
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = call i32 @strlen(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 0))
store i32 %31, i32* %4
br label %37
32: ; preds = %27
%33 = load i8*, i8** %5
%34 = ptrtoint i8* %33 to i64
%35 = sub i64 %34, ptrtoint ([1024 x i8]* @make83.cpmname to i64)
%36 = trunc i64 %35 to i32
store i32 %36, i32* %4
br label %37
37: ; preds = %32, %30
%38 = load i32, i32* %4
%39 = icmp sgt i32 %38, 8
br i1 %39, label %40, label %41
40: ; preds = %37
store i32 8, i32* %4
br label %41
41: ; preds = %40, %37
%42 = load i32, i32* %4
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 %43
store i8 0, i8* %44
%45 = load i8*, i8** %5
%46 = icmp ne i8* %45, null
br i1 %46, label %47, label %68
47: ; preds = %41
%48 = load i8*, i8** %5
%49 = getelementptr inbounds i8, i8* %48, i32 1
store i8* %49, i8** %5
%50 = load i8*, i8** %5
%51 = call i8* @strchr(i8* %50, i8 signext 46)
store i8* %51, i8** %6
%52 = icmp ne i8* %51, null
br i1 %52, label %53, label %55
53: ; preds = %47
%54 = load i8*, i8** %6
store i8 0, i8* %54
br label %55
55: ; preds = %53, %47
%56 = load i8*, i8** %5
%57 = call i32 @strlen(i8* %56)
%58 = icmp sgt i32 %57, 3
br i1 %58, label %59, label %62
59: ; preds = %55
%60 = load i8*, i8** %5
%61 = getelementptr inbounds i8, i8* %60, i64 3
store i8 0, i8* %61
br label %62
62: ; preds = %59, %55
%63 = load i8*, i8** %5
%64 = load i8*, i8** %5
%65 = call i32 @strlen(i8* %64)
%66 = add nsw i32 %65, 1
%67 = call i32 @memmove(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 8), i8* %63, i32 %66)
br label %68
68: ; preds = %62, %41
%69 = load i32, i32* %4
store i32 %69, i32* %3
br label %70
70: ; preds = %77, %68
%71 = load i32, i32* %3
%72 = icmp sle i32 %71, 7
br i1 %72, label %73, label %80
73: ; preds = %70
%74 = load i32, i32* %3
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 %75
store i8 32, i8* %76
br label %77
77: ; preds = %73
%78 = load i32, i32* %3
%79 = add nsw i32 %78, 1
store i32 %79, i32* %3
br label %70
80: ; preds = %70
%81 = call i32 @strlen(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 8))
store i32 %81, i32* %3
br label %82
82: ; preds = %90, %80
%83 = load i32, i32* %3
%84 = icmp sle i32 %83, 2
br i1 %84, label %85, label %93
85: ; preds = %82
%86 = load i32, i32* %3
%87 = add nsw i32 8, %86
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds [1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 %88
store i8 32, i8* %89
br label %90
90: ; preds = %85
%91 = load i32, i32* %3
%92 = add nsw i32 %91, 1
store i32 %92, i32* %3
br label %82
93: ; preds = %82
store i8 0, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 11)
store i32 0, i32* %3
br label %94
94: ; preds = %107, %93
%95 = load i32, i32* %3
%96 = call i32 @strlen(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 0))
%97 = icmp slt i32 %95, %96
br i1 %97, label %98, label %110
98: ; preds = %94
%99 = load i32, i32* %3
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds [1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 %100
%102 = load i8, i8* %101
%103 = call signext i8 @toupper(i8 signext %102)
%104 = load i32, i32* %3
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds [1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 %105
store i8 %103, i8* %106
br label %107
107: ; preds = %98
%108 = load i32, i32* %3
%109 = add nsw i32 %108, 1
store i32 %109, i32* %3
br label %94
110: ; preds = %94
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 0)
}

LLVM IR (-O2):
@make83.cpmname = internal global [1024 x i8] zeroinitializer
define i8* @make83(i8* %0) {
%2 = tail call i32 @memset(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 0), i32 0, i32 1024)
%3 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%4 = icmp eq i8* %3, null
%5 = getelementptr inbounds i8, i8* %3, i64 1
%6 = select i1 %4, i8* %0, i8* %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 46
br i1 %8, label %9, label %10
9: ; preds = %1
store i8 120, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 0)
br label %10
10: ; preds = %1, %9
%11 = phi i8* [ getelementptr inbounds ([1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 1), %9 ], [ getelementptr inbounds ([1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 0), %1 ]
%12 = tail call i32 @strcpy(i8* %11, i8* %6)
%13 = tail call i8* @strchr(i8* dereferenceable(1) getelementptr inbounds ([1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 0), i8 signext 46)
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %21
15: ; preds = %10
%16 = tail call i32 @strlen(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 0))
%17 = icmp slt i32 %16, 8
%18 = select i1 %17, i32 %16, i32 8
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 %19
store i8 0, i8* %20
br label %42
21: ; preds = %10
%22 = ptrtoint i8* %13 to i64
%23 = trunc i64 %22 to i32
%24 = sub i32 %23, ptrtoint ([1024 x i8]* @make83.cpmname to i32)
%25 = icmp slt i32 %24, 8
%26 = select i1 %25, i32 %24, i32 8
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 %27
store i8 0, i8* %28
%29 = getelementptr inbounds i8, i8* %13, i64 1
%30 = tail call i8* @strchr(i8* %29, i8 signext 46)
%31 = icmp eq i8* %30, null
br i1 %31, label %33, label %32
32: ; preds = %21
store i8 0, i8* %30
br label %33
33: ; preds = %32, %21
%34 = tail call i32 @strlen(i8* %29)
%35 = icmp sgt i32 %34, 3
br i1 %35, label %36, label %38
36: ; preds = %33
%37 = getelementptr inbounds i8, i8* %13, i64 4
store i8 0, i8* %37
br label %38
38: ; preds = %36, %33
%39 = tail call i32 @strlen(i8* %29)
%40 = add nsw i32 %39, 1
%41 = tail call i32 @memmove(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 8), i8* %29, i32 %40)
br label %42
42: ; preds = %15, %38
%43 = phi i32 [ %18, %15 ], [ %26, %38 ]
%44 = icmp slt i32 %43, 8
br i1 %44, label %45, label %51
45: ; preds = %42
%46 = sext i32 %43 to i64
%47 = getelementptr [1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 %46
%48 = sub i32 7, %43
%49 = zext i32 %48 to i64
%50 = add nuw nsw i64 %49, 1
br label %51
51: ; preds = %45, %42
%52 = tail call i32 @strlen(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 8))
%53 = icmp slt i32 %52, 3
br i1 %53, label %54, label %61
54: ; preds = %51
%55 = add nsw i32 %52, 8
%56 = sext i32 %55 to i64
%57 = getelementptr [1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 %56
%58 = sub i32 2, %52
%59 = zext i32 %58 to i64
%60 = add nuw nsw i64 %59, 1
br label %61
61: ; preds = %54, %51
store i8 0, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 11)
%62 = tail call i32 @strlen(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 0))
%63 = icmp sgt i32 %62, 0
br i1 %63, label %64, label %73
64: ; preds = %61, %64
%65 = phi i64 [ %69, %64 ], [ 0, %61 ]
%66 = getelementptr inbounds [1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 %65
%67 = load i8, i8* %66
%68 = tail call signext i8 @toupper(i8 signext %67)
store i8 %68, i8* %66
%69 = add nuw nsw i64 %65, 1
%70 = tail call i32 @strlen(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 0))
%71 = sext i32 %70 to i64
%72 = icmp slt i64 %69, %71
br i1 %72, label %64, label %73
73: ; preds = %64, %61
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @make83.cpmname, i64 0, i64 0)
}