#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 *, char *);
int /*<<< orphan*/ write_imatrix(int **, long, long, long, long, char *,
                                 char *);
void save_imatrix(int **m, long nrl, long nrh, long ncl, long nch, char *path,
                  char *filename) {
  static char complete_filename[256];
  sprintf(complete_filename, "%s/%s", path, filename);
  write_imatrix(m, nrl, nrh, ncl, nch, "%10d", complete_filename);
}


x86 assembly (clang, -O0):
<save_imatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
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    -0x30(%rbp),%rdx
mov    0x10(%rbp),%rcx
lea    0x2eed(%rip),%rdi
lea    0xea6(%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
lea    0xe8c(%rip),%r9
lea    0x2ebf(%rip),%rax
mov    %rax,(%rsp)
call   1030 <write_imatrix@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<save_imatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%rbx
mov    0x40(%rsp),%rcx
lea    0x2efa(%rip),%rbp
lea    0xeb3(%rip),%rsi
mov    %rbp,%rdi
mov    %r9,%rdx
call   1040 <sprintf@plt>
mov    %rbp,(%rsp)
lea    0xea3(%rip),%r9
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
call   1030 <write_imatrix@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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