#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 EINVAL;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int envia(int, char *, int);
int errno;
scalar_t__ ferror(int /*<<< orphan*/ *);
int fileno(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ fread(void *, unsigned long, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, unsigned long,
                         int /*<<< orphan*/);
unsigned long ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ memcpy(void *, void *, unsigned long);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ sprintf(char *, char *, unsigned long);
int /*<<< orphan*/ sscanf(char *, char *, unsigned long *);
int /*<<< orphan*/ stderr;
int strlen(char *);
int petic_rread(int sockCliente, FILE *pFich, char *argLong) {
  int error;
  char cadena[300] = "";
  char datos[5120] = "";
  char respuesta[300 + 5120];
  int longCabecera;
  unsigned long actual = 0, maxLongitud = 0, longitud = 0;
  if (fileno(pFich) == -1) {
    fprintf(stderr, "petic_rread(): no hay fichero abierto!\n");
    return -1;
  } else if ((argLong == NULL) || (!sscanf(argLong, "%lu", &longitud))) {
    error = EINVAL;
    fprintf(stderr, "petic_rread(): esperaba 1 argumento: bytes que leer\n");
    sprintf(cadena, "%d\n", error);
    envia(sockCliente, cadena, strlen(cadena));
    return -1;
  }
  actual = ftell(pFich);
  fseek(pFich, 0L, SEEK_END);
  maxLongitud = ftell(pFich) - actual;
  fseek(pFich, actual, SEEK_SET);
  if (longitud > maxLongitud)
    longitud = maxLongitud;
  if (fread((void *)datos, longitud, 1, pFich) == 0) {
    if (ferror(pFich)) {
      error = errno;
      perror("petic_rread(): fread()");
      sprintf(cadena, "%d 0\n", error);
      envia(sockCliente, cadena, strlen(cadena));
      return -1;
    }
  }
  sprintf(respuesta, "0 %lu ", longitud);
  longCabecera = strlen(respuesta);
  memcpy((void *)(respuesta + longCabecera), (void *)datos, longitud);
  if (envia(sockCliente, respuesta, longCabecera + longitud) == -1) {
    fprintf(stderr, "Error al enviar datos\n");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<petic_rread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2ac0,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x150(%rbp),%rdi
xor    %esi,%esi
mov    $0x12c,%edx
call   1070 <memset@plt>
lea    -0x1550(%rbp),%rdi
xor    %esi,%esi
mov    $0x1400,%edx
call   1070 <memset@plt>
movq   $0x0,-0x2a90(%rbp)
movq   $0x0,-0x2a98(%rbp)
movq   $0x0,-0x2aa0(%rbp)
mov    -0x10(%rbp),%rdi
call   10b0 <fileno@plt>
cmp    $0xffffffff,%eax
jne    1260 <petic_rread+0x90>
mov    0x2d92(%rip),%rax
mov    (%rax),%edi
lea    0xdb1(%rip),%rsi
call   1080 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14d3 <petic_rread+0x303>
cmpq   $0x0,-0x18(%rbp)
je     128b <petic_rread+0xbb>
mov    -0x18(%rbp),%rdi
lea    0xdb2(%rip),%rsi
lea    -0x2aa0(%rbp),%rdx
call   10c0 <sscanf@plt>
cmp    $0x0,%eax
jne    1306 <petic_rread+0x136>
mov    0x2d2e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2d3a(%rip),%rax
mov    (%rax),%edi
lea    0xd85(%rip),%rsi
call   1080 <fprintf@plt>
lea    -0x150(%rbp),%rdi
movslq -0x1c(%rbp),%rdx
lea    0xda3(%rip),%rsi
call   10f0 <sprintf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x2aac(%rbp)
lea    -0x150(%rbp),%rax
mov    %rax,-0x2aa8(%rbp)
lea    -0x150(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x2aac(%rbp),%edi
mov    -0x2aa8(%rbp),%rsi
mov    %eax,%edx
call   1050 <envia@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14d3 <petic_rread+0x303>
jmp    130b <petic_rread+0x13b>
mov    -0x10(%rbp),%rdi
call   1090 <ftell@plt>
mov    %rax,-0x2a90(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2cc2(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   10d0 <fseek@plt>
mov    -0x10(%rbp),%rdi
call   1090 <ftell@plt>
sub    -0x2a90(%rbp),%rax
mov    %rax,-0x2a98(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x2a90(%rbp),%rsi
mov    0x2c6e(%rip),%rax
mov    (%rax),%edx
call   10d0 <fseek@plt>
mov    -0x2aa0(%rbp),%rax
cmp    -0x2a98(%rbp),%rax
jbe    1383 <petic_rread+0x1b3>
mov    -0x2a98(%rbp),%rax
mov    %rax,-0x2aa0(%rbp)
lea    -0x1550(%rbp),%rdi
mov    -0x2aa0(%rbp),%rsi
mov    -0x10(%rbp),%rcx
mov    $0x1,%edx
call   1040 <fread@plt>
cmp    $0x0,%rax
jne    1433 <petic_rread+0x263>
mov    -0x10(%rbp),%rdi
call   1030 <ferror@plt>
cmp    $0x0,%rax
je     142e <petic_rread+0x25e>
mov    0x2c0d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
lea    0xc96(%rip),%rdi
call   10e0 <perror@plt>
lea    -0x150(%rbp),%rdi
movslq -0x1c(%rbp),%rdx
lea    0xc96(%rip),%rsi
call   10f0 <sprintf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x2abc(%rbp)
lea    -0x150(%rbp),%rax
mov    %rax,-0x2ab8(%rbp)
lea    -0x150(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x2abc(%rbp),%edi
mov    -0x2ab8(%rbp),%rsi
mov    %eax,%edx
call   1050 <envia@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14d3 <petic_rread+0x303>
jmp    1433 <petic_rread+0x263>
lea    -0x2a80(%rbp),%rdi
mov    -0x2aa0(%rbp),%rdx
lea    0xc3a(%rip),%rsi
call   10f0 <sprintf@plt>
lea    -0x2a80(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x2a84(%rbp)
lea    -0x2a80(%rbp),%rdi
movslq -0x2a84(%rbp),%rax
add    %rax,%rdi
lea    -0x1550(%rbp),%rsi
mov    -0x2aa0(%rbp),%rdx
call   10a0 <memcpy@plt>
mov    -0x8(%rbp),%edi
lea    -0x2a80(%rbp),%rsi
movslq -0x2a84(%rbp),%rax
add    -0x2aa0(%rbp),%rax
mov    %eax,%edx
call   1050 <envia@plt>
cmp    $0xffffffff,%eax
jne    14cc <petic_rread+0x2fc>
mov    0x2b26(%rip),%rax
mov    (%rax),%edi
lea    0xbce(%rip),%rsi
call   1080 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14d3 <petic_rread+0x303>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2ac0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<petic_rread>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x2a78,%rsp
mov    %rdx,%rbp
mov    %rsi,%rbx
mov    %edi,%r14d
lea    0x10(%rsp),%rdi
mov    $0x12c,%edx
xor    %esi,%esi
call   1070 <memset@plt>
lea    0x140(%rsp),%rdi
mov    $0x1400,%edx
xor    %esi,%esi
call   1070 <memset@plt>
movq   $0x0,0x8(%rsp)
mov    %rbx,%rdi
call   10b0 <fileno@plt>
cmp    $0xffffffff,%eax
je     1384 <petic_rread+0x1b4>
test   %rbp,%rbp
je     1337 <petic_rread+0x167>
lea    0xdf3(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %rbp,%rdi
call   10c0 <sscanf@plt>
test   %eax,%eax
je     1337 <petic_rread+0x167>
mov    %rbx,%rdi
call   1090 <ftell@plt>
mov    %rax,%r15
mov    0x2d8c(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   10d0 <fseek@plt>
mov    %rbx,%rdi
call   1090 <ftell@plt>
mov    %rax,%rbp
sub    %r15,%rbp
mov    0x2d4b(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   10d0 <fseek@plt>
mov    0x8(%rsp),%rsi
cmp    %rbp,%rsi
jbe    129c <petic_rread+0xcc>
mov    %rbp,0x8(%rsp)
mov    %rbp,%rsi
lea    0x140(%rsp),%rdi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
test   %rax,%rax
jne    12c7 <petic_rread+0xf7>
mov    %rbx,%rdi
call   1030 <ferror@plt>
test   %rax,%rax
jne    13ac <petic_rread+0x1dc>
mov    0x8(%rsp),%rdx
lea    0xdaf(%rip),%rsi
lea    0x1540(%rsp),%rbx
mov    %rbx,%rdi
call   10f0 <sprintf@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
movslq %eax,%rbp
lea    (%rsp,%rbp,1),%rdi
add    $0x1540,%rdi
mov    0x8(%rsp),%rdx
lea    0x140(%rsp),%rsi
call   10a0 <memcpy@plt>
add    0x8(%rsp),%ebp
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1050 <envia@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
jne    139e <petic_rread+0x1ce>
mov    0x2cac(%rip),%rax
mov    (%rax),%edi
lea    0xd54(%rip),%rsi
jmp    1394 <petic_rread+0x1c4>
mov    0x2c82(%rip),%rax
movslq (%rax),%rbx
mov    0x2c90(%rip),%rax
mov    (%rax),%edi
lea    0xcdb(%rip),%rsi
call   1080 <fprintf@plt>
lea    0xd04(%rip),%rsi
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rdx
call   10f0 <sprintf@plt>
mov    %rbp,%rdi
call   1060 <strlen@plt>
mov    %r14d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
call   1050 <envia@plt>
jmp    1399 <petic_rread+0x1c9>
mov    0x2c4d(%rip),%rax
mov    (%rax),%edi
lea    0xc6c(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x2a78,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c1d(%rip),%rax
movslq (%rax),%rbx
lea    0xca8(%rip),%rdi
call   10e0 <perror@plt>
lea    0xcb3(%rip),%rsi
jmp    135d <petic_rread+0x18d>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [40 x i8] c"petic_rread(): no hay fichero abierto!\0A\00"
@.str.1 = [4 x i8] c"%lu\00"
@EINVAL = global i32 0
@.str.2 = [53 x i8] c"petic_rread(): esperaba 1 argumento: bytes que leer\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@errno = global i32 0
@.str.4 = [23 x i8] c"petic_rread(): fread()\00"
@.str.5 = [6 x i8] c"%d 0\0A\00"
@.str.6 = [7 x i8] c"0 %lu \00"
@.str.7 = [23 x i8] c"Error al enviar datos\0A\00"
define i32 @petic_rread(i32 %0, i32* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [300 x i8]
%10 = alloca [5120 x i8]
%11 = alloca [5420 x i8]
%12 = alloca i32
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
store i32 %0, i32* %5
store i32* %1, i32** %6
store i8* %2, i8** %7
%16 = bitcast [300 x i8]* %9 to i8*
%17 = bitcast [5120 x i8]* %10 to i8*
store i64 0, i64* %13
store i64 0, i64* %14
store i64 0, i64* %15
%18 = load i32*, i32** %6
%19 = call i32 @fileno(i32* %18)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %24
21: ; preds = %3
%22 = load i32, i32* @stderr
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %4
br label %113
24: ; preds = %3
%25 = load i8*, i8** %7
%26 = icmp eq i8* %25, null
br i1 %26, label %31, label %27
27: ; preds = %24
%28 = load i8*, i8** %7
%29 = call i32 @sscanf(i8* %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %15)
%30 = icmp ne i32 %29, 0
br i1 %30, label %44, label %31
31: ; preds = %27, %24
%32 = load i32, i32* @EINVAL
store i32 %32, i32* %8
%33 = load i32, i32* @stderr
%34 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
%35 = getelementptr inbounds [300 x i8], [300 x i8]* %9, i64 0, i64 0
%36 = load i32, i32* %8
%37 = sext i32 %36 to i64
%38 = call i32 @sprintf(i8* %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i64 %37)
%39 = load i32, i32* %5
%40 = getelementptr inbounds [300 x i8], [300 x i8]* %9, i64 0, i64 0
%41 = getelementptr inbounds [300 x i8], [300 x i8]* %9, i64 0, i64 0
%42 = call i32 @strlen(i8* %41)
%43 = call i32 @envia(i32 %39, i8* %40, i32 %42)
store i32 -1, i32* %4
br label %113
44: ; preds = %27
br label %45
45: ; preds = %44
%46 = load i32*, i32** %6
%47 = call i64 @ftell(i32* %46)
store i64 %47, i64* %13
%48 = load i32*, i32** %6
%49 = load i32, i32* @SEEK_END
%50 = call i32 @fseek(i32* %48, i64 0, i32 %49)
%51 = load i32*, i32** %6
%52 = call i64 @ftell(i32* %51)
%53 = load i64, i64* %13
%54 = sub i64 %52, %53
store i64 %54, i64* %14
%55 = load i32*, i32** %6
%56 = load i64, i64* %13
%57 = load i32, i32* @SEEK_SET
%58 = call i32 @fseek(i32* %55, i64 %56, i32 %57)
%59 = load i64, i64* %15
%60 = load i64, i64* %14
%61 = icmp ugt i64 %59, %60
br i1 %61, label %62, label %64
62: ; preds = %45
%63 = load i64, i64* %14
store i64 %63, i64* %15
br label %64
64: ; preds = %62, %45
%65 = getelementptr inbounds [5120 x i8], [5120 x i8]* %10, i64 0, i64 0
%66 = load i64, i64* %15
%67 = load i32*, i32** %6
%68 = call i64 @fread(i8* %65, i64 %66, i32 1, i32* %67)
%69 = icmp eq i64 %68, 0
br i1 %69, label %70, label %87
70: ; preds = %64
%71 = load i32*, i32** %6
%72 = call i64 @ferror(i32* %71)
%73 = icmp ne i64 %72, 0
br i1 %73, label %74, label %86
74: ; preds = %70
%75 = load i32, i32* @errno
store i32 %75, i32* %8
%76 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%77 = getelementptr inbounds [300 x i8], [300 x i8]* %9, i64 0, i64 0
%78 = load i32, i32* %8
%79 = sext i32 %78 to i64
%80 = call i32 @sprintf(i8* %77, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i64 %79)
%81 = load i32, i32* %5
%82 = getelementptr inbounds [300 x i8], [300 x i8]* %9, i64 0, i64 0
%83 = getelementptr inbounds [300 x i8], [300 x i8]* %9, i64 0, i64 0
%84 = call i32 @strlen(i8* %83)
%85 = call i32 @envia(i32 %81, i8* %82, i32 %84)
store i32 -1, i32* %4
br label %113
86: ; preds = %70
br label %87
87: ; preds = %86, %64
%88 = getelementptr inbounds [5420 x i8], [5420 x i8]* %11, i64 0, i64 0
%89 = load i64, i64* %15
%90 = call i32 @sprintf(i8* %88, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i64 %89)
%91 = getelementptr inbounds [5420 x i8], [5420 x i8]* %11, i64 0, i64 0
%92 = call i32 @strlen(i8* %91)
store i32 %92, i32* %12
%93 = getelementptr inbounds [5420 x i8], [5420 x i8]* %11, i64 0, i64 0
%94 = load i32, i32* %12
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds i8, i8* %93, i64 %95
%97 = getelementptr inbounds [5120 x i8], [5120 x i8]* %10, i64 0, i64 0
%98 = load i64, i64* %15
%99 = call i32 @memcpy(i8* %96, i8* %97, i64 %98)
%100 = load i32, i32* %5
%101 = getelementptr inbounds [5420 x i8], [5420 x i8]* %11, i64 0, i64 0
%102 = load i32, i32* %12
%103 = sext i32 %102 to i64
%104 = load i64, i64* %15
%105 = add i64 %103, %104
%106 = trunc i64 %105 to i32
%107 = call i32 @envia(i32 %100, i8* %101, i32 %106)
%108 = icmp eq i32 %107, -1
br i1 %108, label %109, label %112
109: ; preds = %87
%110 = load i32, i32* @stderr
%111 = call i32 @fprintf(i32 %110, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0))
store i32 -1, i32* %4
br label %113
112: ; preds = %87
store i32 0, i32* %4
br label %113
113: ; preds = %112, %109, %74, %31, %21
%114 = load i32, i32* %4
ret i32 %114
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [40 x i8] c"petic_rread(): no hay fichero abierto!\0A\00"
@.str.1 = [4 x i8] c"%lu\00"
@EINVAL = global i32 0
@.str.2 = [53 x i8] c"petic_rread(): esperaba 1 argumento: bytes que leer\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@errno = global i32 0
@.str.4 = [23 x i8] c"petic_rread(): fread()\00"
@.str.5 = [6 x i8] c"%d 0\0A\00"
@.str.6 = [7 x i8] c"0 %lu \00"
@.str.7 = [23 x i8] c"Error al enviar datos\0A\00"
define i32 @petic_rread(i32 %0, i32* nocapture %1, i8* %2) {
%4 = alloca [300 x i8]
%5 = alloca [5120 x i8]
%6 = alloca [5420 x i8]
%7 = alloca i64
%8 = getelementptr inbounds [300 x i8], [300 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [5120 x i8], [5120 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [5420 x i8], [5420 x i8]* %6, i64 0, i64 0
%11 = bitcast i64* %7 to i8*
store i64 0, i64* %7
%12 = tail call i32 @fileno(i32* %1)
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %17
14: ; preds = %3
%15 = load i32, i32* @stderr
%16 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %71
17: ; preds = %3
%18 = icmp eq i8* %2, null
br i1 %18, label %22, label %19
19: ; preds = %17
%20 = call i32 @sscanf(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %7)
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %30
22: ; preds = %19, %17
%23 = load i32, i32* @EINVAL
%24 = load i32, i32* @stderr
%25 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
%26 = sext i32 %23 to i64
%27 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i64 %26)
%28 = call i32 @strlen(i8* %8)
%29 = call i32 @envia(i32 %0, i8* %8, i32 %28)
br label %71
30: ; preds = %19
%31 = call i64 @ftell(i32* %1)
%32 = load i32, i32* @SEEK_END
%33 = call i32 @fseek(i32* %1, i64 0, i32 %32)
%34 = call i64 @ftell(i32* %1)
%35 = sub i64 %34, %31
%36 = load i32, i32* @SEEK_SET
%37 = call i32 @fseek(i32* %1, i64 %31, i32 %36)
%38 = load i64, i64* %7
%39 = icmp ugt i64 %38, %35
br i1 %39, label %40, label %41
40: ; preds = %30
store i64 %35, i64* %7
br label %41
41: ; preds = %40, %30
%42 = phi i64 [ %35, %40 ], [ %38, %30 ]
%43 = call i64 @fread(i8* %9, i64 %42, i32 1, i32* %1)
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %55
45: ; preds = %41
%46 = call i64 @ferror(i32* %1)
%47 = icmp eq i64 %46, 0
br i1 %47, label %55, label %48
48: ; preds = %45
%49 = load i32, i32* @errno
%50 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%51 = sext i32 %49 to i64
%52 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i64 %51)
%53 = call i32 @strlen(i8* %8)
%54 = call i32 @envia(i32 %0, i8* %8, i32 %53)
br label %71
55: ; preds = %45, %41
%56 = load i64, i64* %7
%57 = call i32 @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i64 %56)
%58 = call i32 @strlen(i8* %10)
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [5420 x i8], [5420 x i8]* %6, i64 0, i64 %59
%61 = load i64, i64* %7
%62 = call i32 @memcpy(i8* %60, i8* %9, i64 %61)
%63 = load i64, i64* %7
%64 = trunc i64 %63 to i32
%65 = add i32 %58, %64
%66 = call i32 @envia(i32 %0, i8* %10, i32 %65)
%67 = icmp eq i32 %66, -1
br i1 %67, label %68, label %71
68: ; preds = %55
%69 = load i32, i32* @stderr
%70 = call i32 @fprintf(i32 %69, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0))
br label %71
71: ; preds = %55, %68, %48, %22, %14
%72 = phi i32 [ -1, %14 ], [ -1, %22 ], [ -1, %48 ], [ -1, %68 ], [ 0, %55 ]
ret i32 %72
}