#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ serv_addr;
typedef int /*<<< orphan*/ cli_addr;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int accept(int, struct sockaddr *, int *);
int atoi(char *);
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ listen(int, int);
int /*<<< orphan*/ printf(char *);
int read(int, char *, int);
int /*<<< orphan*/ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
                              char const *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int write(int, char *, int);
int main(int argc, char *argv[]) {
  int sockfd, newsockfd, portno;
  socklen_t clilen;
  char buffer[256];
  struct sockaddr_in serv_addr, cli_addr;
  int n;
  int opt = 1;
  if (argc < 2) {
    fprintf(stderr, "ERROR, no port provided\n");
    exit(1);
  }
  sockfd = socket(AF_INET, SOCK_STREAM, 0);
  if (sockfd < 0)
    error("ERROR opening socket");
  bzero((char *)&serv_addr, sizeof(serv_addr));
  portno = atoi(argv[1]);
  serv_addr.sin_family = AF_INET;
  serv_addr.sin_addr.s_addr = INADDR_ANY;
  serv_addr.sin_port = htons(portno);
  setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (const char *)&opt, sizeof(int));
  if (bind(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0)
    error("ERROR on binding");
  listen(sockfd, 5);
  clilen = sizeof(cli_addr);
  newsockfd = accept(sockfd, (struct sockaddr *)&cli_addr, &clilen);
  if (newsockfd < 0)
    error("ERROR on accept");
  bzero(buffer, 256);
  n = read(newsockfd, buffer, 255);
  if (n < 0)
    error("ERROR reading from socket");
  FILE *fp;
  fp = fopen("socket_output", "w");
  if (fp == 0)
    printf("Could not open file\n");
  fprintf(fp, "%s", buffer);
  fclose(fp);
  n = write(newsockfd, "I got your message!", 19);
  if (n < 0)
    error("ERROR writing to socket");
  close(newsockfd);
  close(sockfd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x148(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    125f <main+0x4f>
mov    0x2d84(%rip),%rax
movslq (%rax),%rdi
lea    0xdb2(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    0x2d7a(%rip),%rax
mov    (%rax),%edi
mov    0x2d51(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1291 <main+0x81>
lea    0xd8d(%rip),%rdi
call   10d0 <error@plt>
lea    -0x130(%rbp),%rdi
mov    $0xc,%esi
call   10f0 <bzero@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1110 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2d27(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x128(%rbp)
mov    0x2d10(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x12c(%rbp)
mov    -0x1c(%rbp),%edi
call   1060 <htons@plt>
mov    %eax,-0x130(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2d00(%rip),%rax
mov    (%rax),%esi
mov    0x2cc7(%rip),%rax
mov    (%rax),%edx
lea    -0x148(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    -0x14(%rbp),%edi
lea    -0x130(%rbp),%rsi
mov    $0xc,%edx
call   10c0 <bind@plt>
cmp    $0x0,%rax
jge    132f <main+0x11f>
lea    0xd04(%rip),%rdi
call   10d0 <error@plt>
mov    -0x14(%rbp),%edi
mov    $0x5,%esi
call   10b0 <listen@plt>
movl   $0xc,-0x20(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x140(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1100 <accept@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    136f <main+0x15f>
lea    0xcd5(%rip),%rdi
call   10d0 <error@plt>
lea    -0x120(%rbp),%rdi
mov    $0x100,%esi
call   10f0 <bzero@plt>
mov    -0x18(%rbp),%edi
lea    -0x120(%rbp),%rsi
mov    $0xff,%edx
call   1090 <read@plt>
mov    %eax,-0x144(%rbp)
cmpl   $0x0,-0x144(%rbp)
jge    13b3 <main+0x1a3>
lea    0xca1(%rip),%rdi
call   10d0 <error@plt>
lea    0xcaf(%rip),%rdi
lea    0xcb6(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x150(%rbp)
cmpq   $0x0,-0x150(%rbp)
jne    13e7 <main+0x1d7>
lea    0xc97(%rip),%rdi
call   1070 <printf@plt>
mov    -0x150(%rbp),%rdi
lea    -0x120(%rbp),%rdx
lea    0xc92(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x150(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x18(%rbp),%edi
lea    0xc78(%rip),%rsi
mov    $0x13,%edx
call   1040 <write@plt>
mov    %eax,-0x144(%rbp)
cmpl   $0x0,-0x144(%rbp)
jge    1442 <main+0x232>
lea    0xc68(%rip),%rdi
call   10d0 <error@plt>
mov    -0x18(%rbp),%edi
call   1080 <close@plt>
mov    -0x14(%rbp),%edi
call   1080 <close@plt>
xor    %eax,%eax
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x138,%rsp
movl   $0x1,0x8(%rsp)
cmp    $0x1,%edi
jle    13d4 <main+0x1b4>
mov    %rsi,%rbp
mov    0x2d98(%rip),%rbx
mov    (%rbx),%edi
mov    0x2d6f(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1140 <socket@plt>
mov    %eax,%r15d
test   %eax,%eax
jns    126d <main+0x4d>
lea    0xdb1(%rip),%rdi
call   10d0 <error@plt>
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0xc,%esi
call   10f0 <bzero@plt>
mov    0x8(%rbp),%rdi
call   1110 <atoi@plt>
mov    (%rbx),%ecx
mov    %ecx,0x18(%rsp)
mov    0x2d43(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,0x14(%rsp)
mov    %eax,%edi
call   1070 <htons@plt>
mov    %eax,0x10(%rsp)
mov    0x2d3b(%rip),%rax
mov    (%rax),%esi
mov    0x2d02(%rip),%rax
mov    (%rax),%edx
lea    0x8(%rsp),%rcx
mov    %r15d,%edi
mov    $0x4,%r8d
call   1040 <setsockopt@plt>
mov    %r15d,%edi
mov    %r14,%rsi
mov    $0xc,%edx
call   10c0 <bind@plt>
test   %rax,%rax
jns    12ec <main+0xcc>
lea    0xd47(%rip),%rdi
call   10d0 <error@plt>
mov    %r15d,%edi
mov    $0x5,%esi
call   10b0 <listen@plt>
movl   $0xc,0xc(%rsp)
lea    0x20(%rsp),%rsi
lea    0xc(%rsp),%rdx
mov    %r15d,%edi
call   1100 <accept@plt>
mov    %eax,%ebp
test   %eax,%eax
jns    1325 <main+0x105>
lea    0xd1f(%rip),%rdi
call   10d0 <error@plt>
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
call   10f0 <bzero@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0xff,%edx
call   10a0 <read@plt>
test   %eax,%eax
jns    1356 <main+0x136>
lea    0xcfe(%rip),%rdi
call   10d0 <error@plt>
lea    0xd0c(%rip),%rdi
lea    0xd13(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    137d <main+0x15d>
lea    0xd2d(%rip),%rdi
call   1030 <puts@plt>
lea    0x30(%rsp),%rdi
mov    %rbx,%rsi
call   1080 <fputs@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0xce0(%rip),%rsi
mov    %ebp,%edi
mov    $0x13,%edx
call   1050 <write@plt>
test   %eax,%eax
jns    13b5 <main+0x195>
lea    0xcdd(%rip),%rdi
call   10d0 <error@plt>
mov    %ebp,%edi
call   1090 <close@plt>
mov    %r15d,%edi
call   1090 <close@plt>
xor    %eax,%eax
add    $0x138,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2bed(%rip),%rax
movslq (%rax),%rcx
lea    0xc1b(%rip),%rdi
mov    $0x18,%esi
mov    $0x1,%edx
call   1130 <fwrite@plt>
mov    $0x1,%edi
call   1120 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [25 x i8] c"ERROR, no port provided\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [21 x i8] c"ERROR opening socket\00"
@INADDR_ANY = global i32 0
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.2 = [17 x i8] c"ERROR on binding\00"
@.str.3 = [16 x i8] c"ERROR on accept\00"
@.str.4 = [26 x i8] c"ERROR reading from socket\00"
@.str.5 = [14 x i8] c"socket_output\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [21 x i8] c"Could not open file\0A\00"
@.str.8 = [3 x i8] c"%s\00"
@.str.9 = [20 x i8] c"I got your message!\00"
@.str.10 = [24 x i8] c"ERROR writing to socket\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [256 x i8]
%11 = alloca %struct.sockaddr_in
%12 = alloca %struct.sockaddr_in
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %14
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 2
br i1 %17, label %18, label %24
18: ; preds = %2
%19 = load i32, i32* @stderr
%20 = sext i32 %19 to i64
%21 = inttoptr i64 %20 to i32*
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %2
%25 = load i32, i32* @AF_INET
%26 = load i32, i32* @SOCK_STREAM
%27 = call i32 @socket(i32 %25, i32 %26, i32 0)
store i32 %27, i32* %6
%28 = load i32, i32* %6
%29 = icmp slt i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %24
%31 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %32
32: ; preds = %30, %24
%33 = bitcast %struct.sockaddr_in* %11 to i8*
%34 = call i32 @bzero(i8* %33, i32 12)
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
%38 = call i32 @atoi(i8* %37)
store i32 %38, i32* %8
%39 = load i32, i32* @AF_INET
%40 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 2
store i32 %39, i32* %40
%41 = load i32, i32* @INADDR_ANY
%42 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 1
%43 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %42, i32 0, i32 0
store i32 %41, i32* %43
%44 = load i32, i32* %8
%45 = call i32 @htons(i32 %44)
%46 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
store i32 %45, i32* %46
%47 = load i32, i32* %6
%48 = load i32, i32* @SOL_SOCKET
%49 = load i32, i32* @SO_REUSEADDR
%50 = bitcast i32* %14 to i8*
%51 = call i32 @setsockopt(i32 %47, i32 %48, i32 %49, i8* %50, i32 4)
%52 = load i32, i32* %6
%53 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%54 = call i64 @bind(i32 %52, %struct.sockaddr* %53, i32 12)
%55 = icmp slt i64 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %32
%57 = call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %58
58: ; preds = %56, %32
%59 = load i32, i32* %6
%60 = call i32 @listen(i32 %59, i32 5)
store i32 12, i32* %9
%61 = load i32, i32* %6
%62 = bitcast %struct.sockaddr_in* %12 to %struct.sockaddr*
%63 = call i32 @accept(i32 %61, %struct.sockaddr* %62, i32* %9)
store i32 %63, i32* %7
%64 = load i32, i32* %7
%65 = icmp slt i32 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %58
%67 = call i32 @error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %68
68: ; preds = %66, %58
%69 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%70 = call i32 @bzero(i8* %69, i32 256)
%71 = load i32, i32* %7
%72 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%73 = call i32 @read(i32 %71, i8* %72, i32 255)
store i32 %73, i32* %13
%74 = load i32, i32* %13
%75 = icmp slt i32 %74, 0
br i1 %75, label %76, label %78
76: ; preds = %68
%77 = call i32 @error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
br label %78
78: ; preds = %76, %68
%79 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %79, i32** %15
%80 = load i32*, i32** %15
%81 = icmp eq i32* %80, null
br i1 %81, label %82, label %84
82: ; preds = %78
%83 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
br label %84
84: ; preds = %82, %78
%85 = load i32*, i32** %15
%86 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%87 = call i32 (i32*, i8*, ...) @fprintf(i32* %85, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %86)
%88 = load i32*, i32** %15
%89 = call i32 @fclose(i32* %88)
%90 = load i32, i32* %7
%91 = call i32 @write(i32 %90, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), i32 19)
store i32 %91, i32* %13
%92 = load i32, i32* %13
%93 = icmp slt i32 %92, 0
br i1 %93, label %94, label %96
94: ; preds = %84
%95 = call i32 @error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0))
br label %96
96: ; preds = %94, %84
%97 = load i32, i32* %7
%98 = call i32 @close(i32 %97)
%99 = load i32, i32* %6
%100 = call i32 @close(i32 %99)
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [25 x i8] c"ERROR, no port provided\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [21 x i8] c"ERROR opening socket\00"
@INADDR_ANY = global i32 0
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.2 = [17 x i8] c"ERROR on binding\00"
@.str.3 = [16 x i8] c"ERROR on accept\00"
@.str.4 = [26 x i8] c"ERROR reading from socket\00"
@.str.5 = [14 x i8] c"socket_output\00"
@.str.6 = [2 x i8] c"w\00"
@.str.9 = [20 x i8] c"I got your message!\00"
@.str.10 = [24 x i8] c"ERROR writing to socket\00"
@str = [20 x i8] c"Could not open file\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca [256 x i8]
%5 = alloca %struct.sockaddr_in
%6 = alloca %struct.sockaddr_in
%7 = alloca i32
%8 = bitcast i32* %3 to i8*
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%10 = bitcast %struct.sockaddr_in* %5 to i8*
%11 = bitcast %struct.sockaddr_in* %6 to i8*
%12 = bitcast i32* %7 to i8*
store i32 1, i32* %7
%13 = icmp slt i32 %0, 2
br i1 %13, label %14, label %20
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to i32*
%18 = tail call i64 @fwrite(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i64 24, i64 1, i32* %17)
%19 = tail call i32 @exit(i32 1)
unreachable
20: ; preds = %2
%21 = load i32, i32* @AF_INET
%22 = load i32, i32* @SOCK_STREAM
%23 = tail call i32 @socket(i32 %21, i32 %22, i32 0)
%24 = icmp slt i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %20
%26 = tail call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %27
27: ; preds = %25, %20
%28 = call i32 @bzero(i8* %10, i32 12)
%29 = getelementptr inbounds i8*, i8** %1, i64 1
%30 = load i8*, i8** %29
%31 = tail call i32 @atoi(i8* %30)
%32 = load i32, i32* @AF_INET
%33 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 2
store i32 %32, i32* %33
%34 = load i32, i32* @INADDR_ANY
%35 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 1, i32 0
store i32 %34, i32* %35
%36 = tail call i32 @htons(i32 %31)
%37 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 0
store i32 %36, i32* %37
%38 = load i32, i32* @SOL_SOCKET
%39 = load i32, i32* @SO_REUSEADDR
%40 = call i32 @setsockopt(i32 %23, i32 %38, i32 %39, i8* %12, i32 4)
%41 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%42 = call i64 @bind(i32 %23, %struct.sockaddr* %41, i32 12)
%43 = icmp slt i64 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %27
%45 = call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %46
46: ; preds = %44, %27
%47 = call i32 @listen(i32 %23, i32 5)
store i32 12, i32* %3
%48 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%49 = call i32 @accept(i32 %23, %struct.sockaddr* %48, i32* %3)
%50 = icmp slt i32 %49, 0
br i1 %50, label %51, label %53
51: ; preds = %46
%52 = call i32 @error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %53
53: ; preds = %51, %46
%54 = call i32 @bzero(i8* %9, i32 256)
%55 = call i32 @read(i32 %49, i8* %9, i32 255)
%56 = icmp slt i32 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %53
%58 = call i32 @error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
br label %59
59: ; preds = %57, %53
%60 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%61 = icmp eq i32* %60, null
br i1 %61, label %62, label %64
62: ; preds = %59
%63 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %64
64: ; preds = %62, %59
%65 = call i32 @fputs(i8* %9, i32* %60)
%66 = call i32 @fclose(i32* %60)
%67 = call i32 @write(i32 %49, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), i32 19)
%68 = icmp slt i32 %67, 0
br i1 %68, label %69, label %71
69: ; preds = %64
%70 = call i32 @error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0))
br label %71
71: ; preds = %69, %64
%72 = call i32 @close(i32 %49)
%73 = call i32 @close(i32 %23)
ret i32 0
}