#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 */
typedef int /*<<< orphan*/ mpfr_t;
typedef char *mpfr_prec_t;

/* Variables and functions */
int /*<<< orphan*/ eraseFile(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *const, char *);
int writeMatrix(size_t const, size_t const, int /*<<< orphan*/ **, char *);
writeMatrixInFile(const size_t n, const size_t m, mpfr_t matrix[m][n],
                  const mpfr_prec_t precision) {
  char fileName[20];
  sprintf(fileName, "%s%ld%s", "output/matrix", precision, ".dat");
  eraseFile(fileName);
  return writeMatrix(n, m, matrix, fileName);
}


x86 assembly (clang, -O0):
<writeMatrixInFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x20(%rbp),%rcx
lea    0xea9(%rip),%rsi
lea    0xeaa(%rip),%rdx
lea    0xeb1(%rip),%r8
call   1050 <sprintf@plt>
lea    -0x40(%rbp),%rdi
call   1030 <eraseFile@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    -0x40(%rbp),%rcx
call   1040 <writeMatrix@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeMatrixInFile>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
lea    0xeb5(%rip),%rsi
lea    0xeb6(%rip),%rdx
lea    0xebd(%rip),%r8
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <eraseFile@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    %rbx,%rcx
call   1040 <writeMatrix@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%s%ld%s\00"
@.str.1 = [14 x i8] c"output/matrix\00"
@.str.2 = [5 x i8] c".dat\00"
define i32 @writeMatrixInFile(i64 %0, i64 %1, i32* %2, i8* %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca [20 x i8]
store i64 %0, i64* %5
store i64 %1, i64* %6
store i32* %2, i32** %7
store i8* %3, i8** %8
%10 = load i64, i64* %6
%11 = load i64, i64* %5
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%13 = load i8*, i8** %8
%14 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%16 = call i32 @eraseFile(i8* %15)
%17 = load i64, i64* %5
%18 = load i64, i64* %6
%19 = load i32*, i32** %7
%20 = bitcast i32* %19 to i32**
%21 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%22 = call i32 @writeMatrix(i64 %17, i64 %18, i32** %20, i8* %21)
ret i32 %22
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s%ld%s\00"
@.str.1 = [14 x i8] c"output/matrix\00"
@.str.2 = [5 x i8] c".dat\00"
define i32 @writeMatrixInFile(i64 %0, i64 %1, i32* %2, i8* %3) {
%5 = alloca [20 x i8]
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%7 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @eraseFile(i8* %6)
%9 = bitcast i32* %2 to i32**
%10 = call i32 @writeMatrix(i64 %0, i64 %1, i32** %9, i8* %6)
ret i32 %10
}