#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*/ strcat(char *, char *);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
void f90name(char *oldname) {
  char *p = strchr(oldname, '.');
  if (p && (*(p + 1) | 0x20) == 'f')
    strcpy(p, ".f90");
  else
    strcat(oldname, "90");
}


x86 assembly (clang, -O0):
<f90name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2e,%esi
call   1040 <strchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1182 <f90name+0x52>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
or     $0x20,%eax
cmp    $0x66,%eax
jne    1182 <f90name+0x52>
mov    -0x10(%rbp),%rdi
lea    0xe88(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1192 <f90name+0x62>
mov    -0x8(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1050 <strcat@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f90name>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2e,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     115e <f90name+0x2e>
mov    0x1(%rax),%cl
and    $0xdf,%cl
cmp    $0x46,%cl
jne    115e <f90name+0x2e>
lea    0xeab(%rip),%rsi
mov    %rax,%rdi
pop    %rbx
jmp    1030 <strcpy@plt>
lea    0xe9d(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <strcat@plt>

LLVM IR (-O0):
@.str = [5 x i8] c".f90\00"
@.str.1 = [3 x i8] c"90\00"
define void @f90name(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strchr(i8* %4, i8 signext 46)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %18
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = or i32 %12, 32
%14 = icmp eq i32 %13, 102
br i1 %14, label %15, label %18
15: ; preds = %8
%16 = load i8*, i8** %3
%17 = call i32 @strcpy(i8* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %21
18: ; preds = %8, %1
%19 = load i8*, i8** %2
%20 = call i32 @strcat(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %21
21: ; preds = %18, %15
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c".f90\00"
@.str.1 = [3 x i8] c"90\00"
define void @f90name(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 46)
%3 = icmp eq i8* %2, null
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %2, i64 1
%6 = load i8, i8* %5
%7 = and i8 %6, -33
%8 = icmp eq i8 %7, 70
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = tail call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %13
11: ; preds = %4, %1
%12 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %11, %9
ret void
}