#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int salvartxt(int **mat, char *nombrea, int fc[]) {
  int c1;
  FILE *text;
  text = fopen(nombrea, "w");
  int f;
  for (f = (fc[0] - 1); f >= 0; f--) {
    int c;
    for (c = 0; c < fc[1]; c++) {
      c1 = mat[f][c];
      fprintf(text, "%d", c1);
      fprintf(text, "%c", '\t');
    }
    fprintf(text, "%c", 10);
  }
  return 1;
}


x86 assembly (clang, -O0):
<salvartxt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec1(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
sub    $0x1,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jl     11e4 <salvartxt+0xc4>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    -0x18(%rbp),%rcx
cmp    0x4(%rcx),%eax
jge    11c1 <salvartxt+0xa1>
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xe69(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xe5c(%rip),%rsi
mov    $0x9,%edx
call   1030 <fprintf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1165 <salvartxt+0x45>
mov    -0x28(%rbp),%rdi
lea    0xe39(%rip),%rsi
mov    $0xa,%edx
call   1030 <fprintf@plt>
mov    -0x2c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2c(%rbp)
jmp    1154 <salvartxt+0x34>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<salvartxt>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rsi,%rax
mov    %rdi,%r14
lea    0xeb5(%rip),%rsi
mov    %rax,%rdi
call   1050 <fopen@plt>
mov    (%r15),%ebp
test   %ebp,%ebp
jle    11cf <salvartxt+0x9f>
mov    %rax,%rbx
lea    0xe9e(%rip),%r12
jmp    1184 <salvartxt+0x54>
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
cmpq   $0x1,(%rsp)
jle    11cf <salvartxt+0x9f>
mov    %rbp,(%rsp)
add    $0xffffffffffffffff,%rbp
cmpl   $0x0,0x4(%r15)
jle    1170 <salvartxt+0x40>
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
mov    (%r14,%rbp,8),%rax
mov    (%rax,%r13,4),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <fprintf@plt>
mov    $0x9,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
add    $0x1,%r13
movslq 0x4(%r15),%rax
cmp    %rax,%r13
jl     11a0 <salvartxt+0x70>
jmp    1170 <salvartxt+0x40>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [3 x i8] c"%c\00"
define i32 @salvartxt(i32** %0, i8* %1, i32* %2) {
%4 = alloca i32**
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
store i32** %0, i32*** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%11 = load i8*, i8** %5
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %12, i32** %8
%13 = load i32*, i32** %6
%14 = getelementptr inbounds i32, i32* %13, i64 0
%15 = load i32, i32* %14
%16 = sub nsw i32 %15, 1
store i32 %16, i32* %9
br label %17
17: ; preds = %48, %3
%18 = load i32, i32* %9
%19 = icmp sge i32 %18, 0
br i1 %19, label %20, label %51
20: ; preds = %17
store i32 0, i32* %10
br label %21
21: ; preds = %42, %20
%22 = load i32, i32* %10
%23 = load i32*, i32** %6
%24 = getelementptr inbounds i32, i32* %23, i64 1
%25 = load i32, i32* %24
%26 = icmp slt i32 %22, %25
br i1 %26, label %27, label %45
27: ; preds = %21
%28 = load i32**, i32*** %4
%29 = load i32, i32* %9
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32*, i32** %28, i64 %30
%32 = load i32*, i32** %31
%33 = load i32, i32* %10
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %32, i64 %34
%36 = load i32, i32* %35
store i32 %36, i32* %7
%37 = load i32*, i32** %8
%38 = load i32, i32* %7
%39 = call i32 @fprintf(i32* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %38)
%40 = load i32*, i32** %8
%41 = call i32 @fprintf(i32* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 9)
br label %42
42: ; preds = %27
%43 = load i32, i32* %10
%44 = add nsw i32 %43, 1
store i32 %44, i32* %10
br label %21
45: ; preds = %21
%46 = load i32*, i32** %8
%47 = call i32 @fprintf(i32* %46, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 10)
br label %48
48: ; preds = %45
%49 = load i32, i32* %9
%50 = add nsw i32 %49, -1
store i32 %50, i32* %9
br label %17
51: ; preds = %17
ret i32 1
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @salvartxt(i32** nocapture %0, i8* nocapture %1, i32* nocapture %2) {
%4 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %31
7: ; preds = %3
%8 = getelementptr inbounds i32, i32* %2, i64 1
%9 = zext i32 %5 to i64
br label %10
10: ; preds = %7, %28
%11 = phi i64 [ %9, %7 ], [ %12, %28 ]
%12 = add nsw i64 %11, -1
%13 = load i32, i32* %8
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %28
15: ; preds = %10
%16 = getelementptr inbounds i32*, i32** %0, i64 %12
br label %17
17: ; preds = %15, %17
%18 = phi i64 [ 0, %15 ], [ %24, %17 ]
%19 = load i32*, i32** %16
%20 = getelementptr inbounds i32, i32* %19, i64 %18
%21 = load i32, i32* %20
%22 = tail call i32 @fprintf(i32* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = tail call i32 @fputc(i32 9, i32* %4)
%24 = add nuw nsw i64 %18, 1
%25 = load i32, i32* %8
%26 = sext i32 %25 to i64
%27 = icmp slt i64 %24, %26
br i1 %27, label %17, label %28
28: ; preds = %17, %10
%29 = tail call i32 @fputc(i32 10, i32* %4)
%30 = icmp sgt i64 %11, 1
br i1 %30, label %10, label %31
31: ; preds = %28, %3
ret i32 1
}