#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 *strrchr(char *, char);
char *bn(char *name) {
  static char s[5][250];
  static int bni = 0;
  char *s1;
  bni = (bni + 1) % 5;
  strcpy(s[bni], name);
  if ((s1 = strrchr(s[bni], '.')))
    *s1 = 0;
  return s[bni];
}


x86 assembly (clang, -O0):
<bn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x33f2(%rip),%eax
add    $0x1,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,0x33e1(%rip)
movslq 0x33da(%rip),%rax
lea    0x2eef(%rip),%rdi
imul   $0xfa,%rax,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
movslq 0x33b9(%rip),%rax
lea    0x2ece(%rip),%rdi
imul   $0xfa,%rax,%rax
add    %rax,%rdi
mov    $0x2e,%esi
call   1040 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     119b <bn+0x7b>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
movslq 0x3382(%rip),%rcx
lea    0x2e97(%rip),%rax
imul   $0xfa,%rcx,%rcx
add    %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bn>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rsi
mov    0x33f7(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
imul   $0x66666667,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,0x33cb(%rip)
imul   $0xfa,%rax,%rdi
lea    0x2ed9(%rip),%r14
add    %r14,%rdi
call   1030 <strcpy@plt>
mov    0x33af(%rip),%eax
imul   $0xfa,%rax,%rbx
add    %r14,%rbx
mov    %rbx,%rdi
mov    $0x2e,%esi
call   1040 <strrchr@plt>
test   %rax,%rax
je     1194 <bn+0x74>
movb   $0x0,(%rax)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@bn.s = internal global [5 x [250 x i8]] zeroinitializer
@bn.bni = internal global i32 0
define i8* @bn(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i32, i32* @bn.bni
%5 = add nsw i32 %4, 1
%6 = srem i32 %5, 5
store i32 %6, i32* @bn.bni
%7 = load i32, i32* @bn.bni
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [5 x [250 x i8]], [5 x [250 x i8]]* @bn.s, i64 0, i64 %8
%10 = getelementptr inbounds [250 x i8], [250 x i8]* %9, i64 0, i64 0
%11 = load i8*, i8** %2
%12 = call i32 @strcpy(i8* %10, i8* %11)
%13 = load i32, i32* @bn.bni
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [5 x [250 x i8]], [5 x [250 x i8]]* @bn.s, i64 0, i64 %14
%16 = getelementptr inbounds [250 x i8], [250 x i8]* %15, i64 0, i64 0
%17 = call i8* @strrchr(i8* %16, i8 signext 46)
store i8* %17, i8** %3
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %21
19: ; preds = %1
%20 = load i8*, i8** %3
store i8 0, i8* %20
br label %21
21: ; preds = %19, %1
%22 = load i32, i32* @bn.bni
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [5 x [250 x i8]], [5 x [250 x i8]]* @bn.s, i64 0, i64 %23
%25 = getelementptr inbounds [250 x i8], [250 x i8]* %24, i64 0, i64 0
ret i8* %25
}

LLVM IR (-O2):
@bn.s = internal global [5 x [250 x i8]] zeroinitializer
@bn.bni = internal unnamed_addr global i32 0
define i8* @bn(i8* %0) {
%2 = load i32, i32* @bn.bni
%3 = add nsw i32 %2, 1
%4 = srem i32 %3, 5
store i32 %4, i32* @bn.bni
%5 = zext i32 %4 to i64
%6 = getelementptr inbounds [5 x [250 x i8]], [5 x [250 x i8]]* @bn.s, i64 0, i64 %5, i64 0
%7 = tail call i32 @strcpy(i8* %6, i8* %0)
%8 = load i32, i32* @bn.bni
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds [5 x [250 x i8]], [5 x [250 x i8]]* @bn.s, i64 0, i64 %9, i64 0
%11 = tail call i8* @strrchr(i8* %10, i8 signext 46)
%12 = icmp eq i8* %11, null
br i1 %12, label %14, label %13
13: ; preds = %1
store i8 0, i8* %11
br label %14
14: ; preds = %13, %1
ret i8* %10
}