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


x86 assembly (clang, -O0):
<write_imatrix_k>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%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)
lea    -0x130(%rbp),%rdi
mov    0x10(%rbp),%rdx
mov    0x18(%rbp),%ecx
lea    0xea1(%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    -0x130(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <write_imatrix@plt>
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_imatrix_k>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    %r9,0x8(%rsp)
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    0x150(%rsp),%rdx
mov    0x158(%rsp),%ecx
lea    0xea5(%rip),%rsi
lea    0x10(%rsp),%r14
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    0x8(%rsp),%r9
call   1030 <write_imatrix@plt>
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"%s%02d.txt\00"
define void @write_imatrix_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
%17 = alloca [256 x i8]
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
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%19 = load i8*, i8** %15
%20 = load i32, i32* %16
%21 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %19, i32 %20)
%22 = load i32**, i32*** %9
%23 = load i64, i64* %10
%24 = load i64, i64* %11
%25 = load i64, i64* %12
%26 = load i64, i64* %13
%27 = load i8*, i8** %14
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%29 = call i32 @write_imatrix(i32** %22, i64 %23, i64 %24, i64 %25, i64 %26, i8* %27, i8* %28)
ret void
}

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