void FMT1_FillIndexedVarName(varname, varnum) char *varname;
int varnum;
{
  char locbuf[10];
  if (varnum < 0)
    return;
  strcpy(varname, "autoSAVE_diskio");
  if (varnum != 0) {
    strcat(varname, "-_");
    sprintf(locbuf, "%d", varnum);
    strcat(varname, locbuf);
  }
}


x86 assembly (clang, -O0):
<FMT1_FillIndexedVarName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    114e <FMT1_FillIndexedVarName+0x1e>
jmp    119a <FMT1_FillIndexedVarName+0x6a>
mov    -0x8(%rbp),%rdi
lea    0xea7(%rip),%rsi
call   1030 <strcpy@plt>
cmpl   $0x0,-0xc(%rbp)
je     119a <FMT1_FillIndexedVarName+0x6a>
mov    -0x8(%rbp),%rdi
lea    0xe9d(%rip),%rsi
call   1040 <strcat@plt>
lea    -0x16(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xe8d(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x16(%rbp),%rsi
call   1040 <strcat@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FMT1_FillIndexedVarName>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
test   %esi,%esi
js     1183 <FMT1_FillIndexedVarName+0x53>
mov    %rdi,%rbx
movups 0xeba(%rip),%xmm0
movups %xmm0,(%rdi)
je     1183 <FMT1_FillIndexedVarName+0x53>
mov    %esi,%ebp
mov    %rbx,%rdi
call   1030 <strlen@plt>
movw   $0x5f2d,(%rbx,%rax,1)
movb   $0x0,0x2(%rbx,%rax,1)
lea    0xeac(%rip),%rsi
lea    0x6(%rsp),%r14
mov    %r14,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcat@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"autoSAVE_diskio\00"
@.str.1 = [3 x i8] c"-_\00"
@.str.2 = [3 x i8] c"%d\00"
define void @FMT1_FillIndexedVarName(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [10 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %2
br label %23
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = call i8* @strcpy(i8* %10, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %23
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = call i8* @strcat(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%18 = load i32, i32* %4
%19 = call i32 (i8*, i8*, ...) @sprintf(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = load i8*, i8** %3
%21 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%22 = call i8* @strcat(i8* %20, i8* %21)
br label %23
23: ; preds = %8, %14, %9
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"autoSAVE_diskio\00"
@.str.1 = [3 x i8] c"-_\00"
@.str.2 = [3 x i8] c"%d\00"
define void @FMT1_FillIndexedVarName(i8* %0, i32 %1) {
%3 = alloca [10 x i8]
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %1, 0
br i1 %5, label %13, label %6
6: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(16) %0, i8* align 1 dereferenceable(16) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64 16, i1 false)
%7 = icmp eq i32 %1, 0
br i1 %7, label %13, label %8
8: ; preds = %6
%9 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%10 = getelementptr i8, i8* %0, i64 %9
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(3) %10, i8* align 1 dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64 3, i1 false)
%11 = call i32 (i8*, i8*, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %1)
%12 = call i8* @strcat(i8* dereferenceable(1) %0, i8* %4)
br label %13
13: ; preds = %6, %8, %2
ret void
}