#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*/ memset(char *, char, int);
int strlen(char const *);
char *vectfs_convert_file_name(const char *name, char *outname) {
  memset(outname, ' ', sizeof(char) * 12);
  int i = 0, j = 0;
  while (i < strlen(name) && name[i] != '.' && j < 8) {
    outname[j++] = name[i++];
  }
  j = 8;
  i++;
  while (i < strlen(name) && j < 11) {
    outname[j++] = name[i++];
  }
  outname[11] = '\0';
  return outname;
}


x86 assembly (clang, -O0):
<vectfs_convert_file_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x20,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%ecx
mov    %eax,%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x19(%rbp)
jge    1196 <vectfs_convert_file_name+0x76>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x2e,%ecx
mov    %al,-0x19(%rbp)
je     1196 <vectfs_convert_file_name+0x76>
cmpl   $0x8,-0x18(%rbp)
setl   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    11a6 <vectfs_convert_file_name+0x86>
jmp    11d5 <vectfs_convert_file_name+0xb5>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x18(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1151 <vectfs_convert_file_name+0x31>
movl   $0x8,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%ecx
mov    %eax,%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x21(%rbp)
jge    1210 <vectfs_convert_file_name+0xf0>
cmpl   $0xb,-0x18(%rbp)
setl   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1220 <vectfs_convert_file_name+0x100>
jmp    124f <vectfs_convert_file_name+0x12f>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x18(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    11e5 <vectfs_convert_file_name+0xc5>
mov    -0x10(%rbp),%rax
movb   $0x0,0xb(%rax)
mov    -0x10(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vectfs_convert_file_name>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsi,%rdi
mov    $0x20,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
mov    %r15,%rdi
call   1030 <strlen@plt>
xor    %ebx,%ebx
test   %eax,%eax
jle    1186 <vectfs_convert_file_name+0x66>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%r15,%rbx,1),%eax
cmp    $0x2e,%al
je     1186 <vectfs_convert_file_name+0x66>
cmp    $0x7,%rbx
ja     1186 <vectfs_convert_file_name+0x66>
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
mov    %r15,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1160 <vectfs_convert_file_name+0x40>
lea    0x1(%rbx),%ebp
mov    %r15,%rdi
call   1030 <strlen@plt>
cmp    %eax,%ebp
jge    11db <vectfs_convert_file_name+0xbb>
mov    %ebx,%r13d
lea    (%r15,%r13,1),%r12
add    $0x1,%r12
add    $0x2,%r13
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movzbl (%r12,%rbx,1),%eax
mov    %al,0x8(%r14,%rbx,1)
lea    (%rbx,%r13,1),%rbp
mov    %r15,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbp
jge    11db <vectfs_convert_file_name+0xbb>
lea    0x8(%rbx),%rax
add    $0x1,%rbx
cmp    $0xa,%rax
jb     11b0 <vectfs_convert_file_name+0x90>
movb   $0x0,0xb(%r14)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @vectfs_convert_file_name(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @memset(i8* %7, i8 signext 32, i32 12)
store i32 0, i32* %5
store i32 0, i32* %6
br label %9
9: ; preds = %27, %2
%10 = load i32, i32* %5
%11 = load i8*, i8** %3
%12 = call i32 @strlen(i8* %11)
%13 = icmp slt i32 %10, %12
br i1 %13, label %14, label %25
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 46
br i1 %21, label %22, label %25
22: ; preds = %14
%23 = load i32, i32* %6
%24 = icmp slt i32 %23, 8
br label %25
25: ; preds = %22, %14, %9
%26 = phi i1 [ false, %14 ], [ false, %9 ], [ %24, %22 ]
br i1 %26, label %27, label %39
27: ; preds = %25
%28 = load i8*, i8** %3
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
%31 = sext i32 %29 to i64
%32 = getelementptr inbounds i8, i8* %28, i64 %31
%33 = load i8, i8* %32
%34 = load i8*, i8** %4
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %6
%37 = sext i32 %35 to i64
%38 = getelementptr inbounds i8, i8* %34, i64 %37
store i8 %33, i8* %38
br label %9
39: ; preds = %25
store i32 8, i32* %6
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 1
store i32 %41, i32* %5
br label %42
42: ; preds = %52, %39
%43 = load i32, i32* %5
%44 = load i8*, i8** %3
%45 = call i32 @strlen(i8* %44)
%46 = icmp slt i32 %43, %45
br i1 %46, label %47, label %50
47: ; preds = %42
%48 = load i32, i32* %6
%49 = icmp slt i32 %48, 11
br label %50
50: ; preds = %47, %42
%51 = phi i1 [ false, %42 ], [ %49, %47 ]
br i1 %51, label %52, label %64
52: ; preds = %50
%53 = load i8*, i8** %3
%54 = load i32, i32* %5
%55 = add nsw i32 %54, 1
store i32 %55, i32* %5
%56 = sext i32 %54 to i64
%57 = getelementptr inbounds i8, i8* %53, i64 %56
%58 = load i8, i8* %57
%59 = load i8*, i8** %4
%60 = load i32, i32* %6
%61 = add nsw i32 %60, 1
store i32 %61, i32* %6
%62 = sext i32 %60 to i64
%63 = getelementptr inbounds i8, i8* %59, i64 %62
store i8 %58, i8* %63
br label %42
64: ; preds = %50
%65 = load i8*, i8** %4
%66 = getelementptr inbounds i8, i8* %65, i64 11
store i8 0, i8* %66
%67 = load i8*, i8** %4
ret i8* %67
}

LLVM IR (-O2):
define i8* @vectfs_convert_file_name(i8* %0, i8* returned %1) {
%3 = tail call i32 @memset(i8* %1, i8 signext 32, i32 12)
%4 = tail call i32 @strlen(i8* %0)
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %22
6: ; preds = %2, %13
%7 = phi i64 [ %14, %13 ], [ 0, %2 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 46
%11 = icmp ult i64 %7, 8
%12 = select i1 %10, i1 %11, i1 false
br i1 %12, label %13, label %19
13: ; preds = %6
%14 = add nuw nsw i64 %7, 1
%15 = getelementptr inbounds i8, i8* %1, i64 %7
store i8 %9, i8* %15
%16 = tail call i32 @strlen(i8* %0)
%17 = sext i32 %16 to i64
%18 = icmp slt i64 %14, %17
br i1 %18, label %6, label %19
19: ; preds = %13, %6
%20 = phi i64 [ %7, %6 ], [ %14, %13 ]
%21 = trunc i64 %20 to i32
br label %22
22: ; preds = %19, %2
%23 = phi i32 [ 0, %2 ], [ %21, %19 ]
%24 = add nuw nsw i32 %23, 1
%25 = tail call i32 @strlen(i8* %0)
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %43
27: ; preds = %22
%28 = zext i32 %23 to i64
%29 = add nuw nsw i64 %28, 1
br label %30
30: ; preds = %27, %30
%31 = phi i64 [ 8, %27 ], [ %35, %30 ]
%32 = phi i64 [ %29, %27 ], [ %37, %30 ]
%33 = getelementptr inbounds i8, i8* %0, i64 %32
%34 = load i8, i8* %33
%35 = add nuw nsw i64 %31, 1
%36 = getelementptr inbounds i8, i8* %1, i64 %31
store i8 %34, i8* %36
%37 = add nuw nsw i64 %32, 1
%38 = tail call i32 @strlen(i8* %0)
%39 = sext i32 %38 to i64
%40 = icmp slt i64 %37, %39
%41 = icmp ult i64 %31, 10
%42 = select i1 %40, i1 %41, i1 false
br i1 %42, label %30, label %43
43: ; preds = %30, %22
%44 = getelementptr inbounds i8, i8* %1, i64 11
store i8 0, i8* %44
ret i8* %1
}