#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*/ sprintf(char *, char *, char *, int);
int /*<<< orphan*/ write_imatrix_number(int **, long, long, long, long, char *,
                                        char *);
void write_imatrix_number_k(int **m, long nrl, long nrh, long ncl, long nch,
                            char *format, char *filename, int k) {
  static char filename_k[256];
  sprintf(filename_k, "%s%02d.txt", filename, k);
  write_imatrix_number(m, nrl, nrh, ncl, nch, format, filename_k);
}


x86 assembly (clang, -O0):
<write_imatrix_number_k>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    0x10(%rbp),%rdx
mov    0x18(%rbp),%ecx
lea    0x2eeb(%rip),%rdi
lea    0xea4(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
lea    0x2ec0(%rip),%rax
mov    %rax,(%rsp)
call   1030 <write_imatrix_number@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_imatrix_number_k>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,0x10(%rsp)
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    0x50(%rsp),%rdx
mov    0x58(%rsp),%ecx
lea    0x2eee(%rip),%r14
lea    0xea7(%rip),%rsi
mov    %r14,%rdi
call   1040 <sprintf@plt>
mov    %r14,(%rsp)
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    %r12,%rcx
mov    %r15,%r8
mov    0x10(%rsp),%r9
call   1030 <write_imatrix_number@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@write_imatrix_number_k.filename_k = internal global [256 x i8] zeroinitializer
@.str = [11 x i8] c"%s%02d.txt\00"
define void @write_imatrix_number_k(i32** %0, i64 %1, i64 %2, i64 %3, i64 %4, i8* %5, i8* %6, i32 %7) {
%9 = alloca i32**
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i32
store i32** %0, i32*** %9
store i64 %1, i64* %10
store i64 %2, i64* %11
store i64 %3, i64* %12
store i64 %4, i64* %13
store i8* %5, i8** %14
store i8* %6, i8** %15
store i32 %7, i32* %16
%17 = load i8*, i8** %15
%18 = load i32, i32* %16
%19 = call i32 @sprintf(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @write_imatrix_number_k.filename_k, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %17, i32 %18)
%20 = load i32**, i32*** %9
%21 = load i64, i64* %10
%22 = load i64, i64* %11
%23 = load i64, i64* %12
%24 = load i64, i64* %13
%25 = load i8*, i8** %14
%26 = call i32 @write_imatrix_number(i32** %20, i64 %21, i64 %22, i64 %23, i64 %24, i8* %25, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @write_imatrix_number_k.filename_k, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@write_imatrix_number_k.filename_k = internal global [256 x i8] zeroinitializer
@.str = [11 x i8] c"%s%02d.txt\00"
define void @write_imatrix_number_k(i32** %0, i64 %1, i64 %2, i64 %3, i64 %4, i8* %5, i8* %6, i32 %7) {
%9 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([256 x i8], [256 x i8]* @write_imatrix_number_k.filename_k, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %6, i32 %7)
%10 = tail call i32 @write_imatrix_number(i32** %0, i64 %1, i64 %2, i64 %3, i64 %4, i8* %5, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @write_imatrix_number_k.filename_k, i64 0, i64 0))
ret void
}