#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*/ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *NormalizeFilename(char *SourceName) {
  static char HtmlFilename[1025];
  int n;
  strcpy(HtmlFilename, SourceName);
  n = strlen(HtmlFilename);
  if (!strcmp(&HtmlFilename[n - 2], ".s"))
    n -= 2;
  strcpy(&HtmlFilename[n], ".html");
  return (HtmlFilename);
}


x86 assembly (clang, -O0):
<NormalizeFilename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0x2f09(%rip),%rdi
call   1030 <strcpy@plt>
lea    0x2efd(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
cltq
lea    0x2ee6(%rip),%rdi
add    %rax,%rdi
lea    0xe8c(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    118b <NormalizeFilename+0x5b>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rax
lea    0x2eba(%rip),%rdi
add    %rax,%rdi
lea    0xe63(%rip),%rsi
call   1030 <strcpy@plt>
lea    0x2ea4(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NormalizeFilename>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rsi
lea    0x2f12(%rip),%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
movslq %eax,%rbx
add    $0xfffffffe,%ebp
lea    (%rbx,%r14,1),%rdi
add    $0xfffffffffffffffe,%rdi
lea    0xe9b(%rip),%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
cmove  %ebp,%ebx
movslq %ebx,%rdi
add    %r14,%rdi
lea    0xe87(%rip),%rsi
call   1030 <strcpy@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@NormalizeFilename.HtmlFilename = internal global [1025 x i8] zeroinitializer
@.str = [3 x i8] c".s\00"
@.str.1 = [6 x i8] c".html\00"
define i8* @NormalizeFilename(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strcpy(i8* getelementptr inbounds ([1025 x i8], [1025 x i8]* @NormalizeFilename.HtmlFilename, i64 0, i64 0), i8* %4)
%6 = call i32 @strlen(i8* getelementptr inbounds ([1025 x i8], [1025 x i8]* @NormalizeFilename.HtmlFilename, i64 0, i64 0))
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = sub nsw i32 %7, 2
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [1025 x i8], [1025 x i8]* @NormalizeFilename.HtmlFilename, i64 0, i64 %9
%11 = call i32 @strcmp(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%12 = icmp ne i32 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %1
%14 = load i32, i32* %3
%15 = sub nsw i32 %14, 2
store i32 %15, i32* %3
br label %16
16: ; preds = %13, %1
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [1025 x i8], [1025 x i8]* @NormalizeFilename.HtmlFilename, i64 0, i64 %18
%20 = call i32 @strcpy(i8* %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i8* getelementptr inbounds ([1025 x i8], [1025 x i8]* @NormalizeFilename.HtmlFilename, i64 0, i64 0)
}

LLVM IR (-O2):
@NormalizeFilename.HtmlFilename = internal global [1025 x i8] zeroinitializer
@.str = [3 x i8] c".s\00"
@.str.1 = [6 x i8] c".html\00"
define i8* @NormalizeFilename(i8* %0) {
%2 = tail call i32 @strcpy(i8* getelementptr inbounds ([1025 x i8], [1025 x i8]* @NormalizeFilename.HtmlFilename, i64 0, i64 0), i8* %0)
%3 = tail call i32 @strlen(i8* getelementptr inbounds ([1025 x i8], [1025 x i8]* @NormalizeFilename.HtmlFilename, i64 0, i64 0))
%4 = add nsw i32 %3, -2
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds [1025 x i8], [1025 x i8]* @NormalizeFilename.HtmlFilename, i64 0, i64 %5
%7 = tail call i32 @strcmp(i8* %6, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
%9 = select i1 %8, i32 %4, i32 %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [1025 x i8], [1025 x i8]* @NormalizeFilename.HtmlFilename, i64 0, i64 %10
%12 = tail call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i8* getelementptr inbounds ([1025 x i8], [1025 x i8]* @NormalizeFilename.HtmlFilename, i64 0, i64 0)
}