#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int fscanf(int /*<<< orphan*/ *, char *, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcpy(char *, char *);
int system(char *);
int /*<<< orphan*/ unlink(char *);
int FTP_getfile(char *filenm, char *loc_pathnm, char *errmsg) {
  FILE *f1 = NULL, *f2 = NULL;
  char *func = "FTP_getfile";
  char filename[200];
  char hostnm[100];
  char usernm[100];
  char passwd[100];
  char pathnm[100];
  int stat;
  int n;
  {};
  sprintf(filename, "%s/tables.cfg", loc_pathnm);
  {};
  if ((f1 = fopen(filename, "r")) == NULL) {
    sprintf(errmsg, "%s: failed to open '%s' for reading;\n", func, filename);
    stat = (1);
    goto BYE;
  }
  n = fscanf(f1, "%s%s", hostnm, pathnm);
  fclose(f1);
  if (n != 2) {
    sprintf(errmsg, "%s: Fail to read 2 args from '%s'\n", func, filename);
    stat = (1);
    goto BYE;
  }
  strcpy(passwd, "gribsimp22");
  if ((f1 = fopen("temp_ftp_script", "w")) == NULL) {
    sprintf(errmsg, "%s:  failed to build FTP script\n", func);
    stat = (1);
    goto BYE;
  }
  fprintf(f1,
          "#!/bin/sh\nexec 1>&-;exec 2>&-\nftp -in %s << STOP\n"
          "user anonymous %s\ncd %s\nlcd %s\nget %s\nquit\n"
          "STOP\nexit\n",
          hostnm, passwd, pathnm, loc_pathnm, filenm);
  fclose(f1);
  {};
  fprintf(stdout, "Attempting to get remote '%s'\n", filenm);
  n = system("chmod 755 temp_ftp_script;temp_ftp_script");
  unlink("temp_ftp_script");
  if (n != 0) {
    sprintf(errmsg, "%s:  system call to ftp failed\n", func);
    stat = (1);
    goto BYE;
  }
  sprintf(filename, "%s/%s", loc_pathnm, filenm);
  if ((f2 = fopen(filename, "rb+")) == NULL) {
    sprintf(errmsg, "%s: '%s' not avail on %s in %s\n\n", func, filenm, hostnm,
            pathnm);
    stat = (1);
    goto BYE;
  }
  {};
  stat = 0;
BYE:
  if (f2)
    fclose(f2);
  {};
  return (stat);
}


x86 assembly (clang, -O0):
<FTP_getfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2d0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
lea    0xe52(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    -0x100(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe48(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x100(%rbp),%rdi
lea    0xe41(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1218 <FTP_getfile+0x98>
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rdx
lea    -0x100(%rbp),%rcx
lea    0xe1a(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
movl   $0x1,-0x2c4(%rbp)
jmp    13ff <FTP_getfile+0x27f>
mov    -0x20(%rbp),%rdi
lea    -0x170(%rbp),%rdx
lea    -0x2c0(%rbp),%rcx
lea    0xe11(%rip),%rsi
call   1070 <fscanf@plt>
mov    %eax,-0x2c8(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
cmpl   $0x2,-0x2c8(%rbp)
je     127e <FTP_getfile+0xfe>
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rdx
lea    -0x100(%rbp),%rcx
lea    0xddf(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
movl   $0x1,-0x2c4(%rbp)
jmp    13ff <FTP_getfile+0x27f>
lea    -0x250(%rbp),%rdi
lea    0xdde(%rip),%rsi
call   1040 <strcpy@plt>
lea    0xea0(%rip),%rdi
lea    0xdd6(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    12d7 <FTP_getfile+0x157>
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rdx
lea    0xdb6(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
movl   $0x1,-0x2c4(%rbp)
jmp    13ff <FTP_getfile+0x27f>
mov    -0x20(%rbp),%rax
mov    %eax,%edi
lea    -0x170(%rbp),%rdx
lea    -0x250(%rbp),%rcx
lea    -0x2c0(%rbp),%r8
mov    -0x10(%rbp),%r9
mov    -0x8(%rbp),%rax
lea    0xd97(%rip),%rsi
mov    %rax,(%rsp)
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
mov    0x2cc4(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xdd6(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
lea    0xde7(%rip),%rdi
call   1060 <system@plt>
mov    %eax,-0x2c8(%rbp)
lea    0xdef(%rip),%rdi
call   1030 <unlink@plt>
cmpl   $0x0,-0x2c8(%rbp)
je     1380 <FTP_getfile+0x200>
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rdx
lea    0xdde(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
movl   $0x1,-0x2c4(%rbp)
jmp    13ff <FTP_getfile+0x27f>
lea    -0x100(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xdd2(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x100(%rbp),%rdi
lea    0xdc3(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    13f5 <FTP_getfile+0x275>
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    -0x170(%rbp),%r8
lea    -0x2c0(%rbp),%r9
lea    0xd93(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
movl   $0x1,-0x2c4(%rbp)
jmp    13ff <FTP_getfile+0x27f>
movl   $0x0,-0x2c4(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1413 <FTP_getfile+0x293>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x2c4(%rbp),%eax
add    $0x2d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FTP_getfile>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x230,%rsp
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%r14
lea    0xe6d(%rip),%rsi
lea    0x160(%rsp),%rbp
mov    %rbp,%rdi
mov    %r12,%rdx
xor    %eax,%eax
call   10a0 <sprintf@plt>
lea    0xe5f(%rip),%rsi
mov    %rbp,%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     12a6 <FTP_getfile+0x126>
mov    %rax,%rbp
lea    0xe6c(%rip),%rsi
lea    0x80(%rsp),%rdx
lea    0x10(%rsp),%rcx
mov    %rax,%rdi
call   1070 <fscanf@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1050 <fclose@plt>
cmp    $0x2,%ebx
jne    12af <FTP_getfile+0x12f>
lea    0xe65(%rip),%rsi
lea    0xf0(%rsp),%rdi
call   1040 <strcpy@plt>
lea    0xf1f(%rip),%rdi
lea    0xe55(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     12d1 <FTP_getfile+0x151>
mov    %rax,%rbp
mov    %r14,(%rsp)
lea    0xe5c(%rip),%rsi
lea    0x80(%rsp),%rdx
lea    0xf0(%rsp),%rcx
lea    0x10(%rsp),%r8
mov    %ebp,%edi
mov    %r12,%r9
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
mov    0x2d74(%rip),%rax
mov    (%rax),%edi
lea    0xe8a(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0xe98(%rip),%rdi
call   1060 <system@plt>
mov    %eax,%ebx
lea    0xea4(%rip),%rdi
call   1030 <unlink@plt>
test   %ebx,%ebx
je     1300 <FTP_getfile+0x180>
lea    0xea4(%rip),%rsi
jmp    12d8 <FTP_getfile+0x158>
lea    0xd6f(%rip),%rsi
jmp    12b6 <FTP_getfile+0x136>
lea    0xd91(%rip),%rsi
lea    0xd43(%rip),%rdx
lea    0x160(%rsp),%rcx
mov    %r15,%rdi
xor    %eax,%eax
call   10a0 <sprintf@plt>
jmp    12e9 <FTP_getfile+0x169>
lea    0xd9f(%rip),%rsi
lea    0xd21(%rip),%rdx
mov    %r15,%rdi
xor    %eax,%eax
call   10a0 <sprintf@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x230,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe61(%rip),%rsi
xor    %ebp,%ebp
lea    0x160(%rsp),%rbx
mov    %rbx,%rdi
mov    %r12,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   10a0 <sprintf@plt>
lea    0xe46(%rip),%rsi
mov    %rbx,%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     133f <FTP_getfile+0x1bf>
mov    %rax,%rdi
call   1050 <fclose@plt>
jmp    12ee <FTP_getfile+0x16e>
lea    0xe2c(%rip),%rsi
lea    0xcb3(%rip),%rdx
lea    0x80(%rsp),%r8
lea    0x10(%rsp),%r9
mov    %r15,%rdi
mov    %r14,%rcx
xor    %eax,%eax
call   10a0 <sprintf@plt>
jmp    12e9 <FTP_getfile+0x169>

LLVM IR (-O0):
@.str = [12 x i8] c"FTP_getfile\00"
@.str.1 = [14 x i8] c"%s/tables.cfg\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [38 x i8] c"%s: failed to open '%s' for reading;\0A\00"
@.str.4 = [5 x i8] c"%s%s\00"
@.str.5 = [35 x i8] c"%s: Fail to read 2 args from '%s'\0A\00"
@.str.6 = [11 x i8] c"gribsimp22\00"
@.str.7 = [16 x i8] c"temp_ftp_script\00"
@.str.8 = [2 x i8] c"w\00"
@.str.9 = [33 x i8] c"%s: failed to build FTP script\0A\00"
@.str.10 = [103 x i8] c"#!/bin/sh\0Aexec 1>&-;exec 2>&-\0Aftp -in %s << STOP\0Auser anonymous %s\0Acd %s\0Alcd %s\0Aget %s\0Aquit\0ASTOP\0Aexit\0A\00"
@stdout = global i32 0
@.str.11 = [31 x i8] c"Attempting to get remote '%s'\0A\00"
@.str.12 = [42 x i8] c"chmod 755 temp_ftp_script;temp_ftp_script\00"
@.str.13 = [32 x i8] c"%s: system call to ftp failed\0A\00"
@.str.14 = [6 x i8] c"%s/%s\00"
@.str.15 = [4 x i8] c"rb+\00"
@.str.16 = [33 x i8] c"%s: '%s' not avail on %s in %s\0A\0A\00"
define i32 @FTP_getfile(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i8*
%10 = alloca [200 x i8]
%11 = alloca [100 x i8]
%12 = alloca [100 x i8]
%13 = alloca [100 x i8]
%14 = alloca [100 x i8]
%15 = alloca i32
%16 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
store i32* null, i32** %7
store i32* null, i32** %8
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %9
%17 = getelementptr inbounds [200 x i8], [200 x i8]* %10, i64 0, i64 0
%18 = load i8*, i8** %5
%19 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %17, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%20 = getelementptr inbounds [200 x i8], [200 x i8]* %10, i64 0, i64 0
%21 = call i32* @fopen(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %21, i32** %7
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %28
23: ; preds = %3
%24 = load i8*, i8** %6
%25 = load i8*, i8** %9
%26 = getelementptr inbounds [200 x i8], [200 x i8]* %10, i64 0, i64 0
%27 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %24, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* %25, i8* %26)
store i32 1, i32* %15
br label %89
28: ; preds = %3
%29 = load i32*, i32** %7
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %14, i64 0, i64 0
%32 = call i32 @fscanf(i32* %29, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %30, i8* %31)
store i32 %32, i32* %16
%33 = load i32*, i32** %7
%34 = call i32 @fclose(i32* %33)
%35 = load i32, i32* %16
%36 = icmp ne i32 %35, 2
br i1 %36, label %37, label %42
37: ; preds = %28
%38 = load i8*, i8** %6
%39 = load i8*, i8** %9
%40 = getelementptr inbounds [200 x i8], [200 x i8]* %10, i64 0, i64 0
%41 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %38, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i8* %39, i8* %40)
store i32 1, i32* %15
br label %89
42: ; preds = %28
%43 = getelementptr inbounds [100 x i8], [100 x i8]* %13, i64 0, i64 0
%44 = call i32 @strcpy(i8* %43, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%45 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
store i32* %45, i32** %7
%46 = icmp eq i32* %45, null
br i1 %46, label %47, label %51
47: ; preds = %42
%48 = load i8*, i8** %6
%49 = load i8*, i8** %9
%50 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %48, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i8* %49)
store i32 1, i32* %15
br label %89
51: ; preds = %42
%52 = load i32*, i32** %7
%53 = ptrtoint i32* %52 to i32
%54 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%55 = getelementptr inbounds [100 x i8], [100 x i8]* %13, i64 0, i64 0
%56 = getelementptr inbounds [100 x i8], [100 x i8]* %14, i64 0, i64 0
%57 = load i8*, i8** %5
%58 = load i8*, i8** %4
%59 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([103 x i8], [103 x i8]* @.str.10, i64 0, i64 0), i8* %54, i8* %55, i8* %56, i8* %57, i8* %58)
%60 = load i32*, i32** %7
%61 = call i32 @fclose(i32* %60)
%62 = load i32, i32* @stdout
%63 = load i8*, i8** %4
%64 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), i8* %63)
%65 = call i32 @system(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.12, i64 0, i64 0))
store i32 %65, i32* %16
%66 = call i32 @unlink(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%67 = load i32, i32* %16
%68 = icmp ne i32 %67, 0
br i1 %68, label %69, label %73
69: ; preds = %51
%70 = load i8*, i8** %6
%71 = load i8*, i8** %9
%72 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %70, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.13, i64 0, i64 0), i8* %71)
store i32 1, i32* %15
br label %89
73: ; preds = %51
%74 = getelementptr inbounds [200 x i8], [200 x i8]* %10, i64 0, i64 0
%75 = load i8*, i8** %5
%76 = load i8*, i8** %4
%77 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %74, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i8* %75, i8* %76)
%78 = getelementptr inbounds [200 x i8], [200 x i8]* %10, i64 0, i64 0
%79 = call i32* @fopen(i8* %78, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0))
store i32* %79, i32** %8
%80 = icmp eq i32* %79, null
br i1 %80, label %81, label %88
81: ; preds = %73
%82 = load i8*, i8** %6
%83 = load i8*, i8** %9
%84 = load i8*, i8** %4
%85 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%86 = getelementptr inbounds [100 x i8], [100 x i8]* %14, i64 0, i64 0
%87 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %82, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.16, i64 0, i64 0), i8* %83, i8* %84, i8* %85, i8* %86)
store i32 1, i32* %15
br label %89
88: ; preds = %73
store i32 0, i32* %15
br label %89
89: ; preds = %88, %81, %69, %47, %37, %23
%90 = load i32*, i32** %8
%91 = icmp ne i32* %90, null
br i1 %91, label %92, label %95
92: ; preds = %89
%93 = load i32*, i32** %8
%94 = call i32 @fclose(i32* %93)
br label %95
95: ; preds = %92, %89
%96 = load i32, i32* %15
ret i32 %96
}

LLVM IR (-O2):
@.str = [12 x i8] c"FTP_getfile\00"
@.str.1 = [14 x i8] c"%s/tables.cfg\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [38 x i8] c"%s: failed to open '%s' for reading;\0A\00"
@.str.4 = [5 x i8] c"%s%s\00"
@.str.5 = [35 x i8] c"%s: Fail to read 2 args from '%s'\0A\00"
@.str.6 = [11 x i8] c"gribsimp22\00"
@.str.7 = [16 x i8] c"temp_ftp_script\00"
@.str.8 = [2 x i8] c"w\00"
@.str.9 = [33 x i8] c"%s: failed to build FTP script\0A\00"
@.str.10 = [103 x i8] c"#!/bin/sh\0Aexec 1>&-;exec 2>&-\0Aftp -in %s << STOP\0Auser anonymous %s\0Acd %s\0Alcd %s\0Aget %s\0Aquit\0ASTOP\0Aexit\0A\00"
@stdout = global i32 0
@.str.11 = [31 x i8] c"Attempting to get remote '%s'\0A\00"
@.str.12 = [42 x i8] c"chmod 755 temp_ftp_script;temp_ftp_script\00"
@.str.13 = [32 x i8] c"%s: system call to ftp failed\0A\00"
@.str.14 = [6 x i8] c"%s/%s\00"
@.str.15 = [4 x i8] c"rb+\00"
@.str.16 = [33 x i8] c"%s: '%s' not avail on %s in %s\0A\0A\00"
define i32 @FTP_getfile(i8* %0, i8* %1, i8* nocapture writeonly %2) {
%4 = alloca [200 x i8]
%5 = alloca [100 x i8]
%6 = alloca [100 x i8]
%7 = alloca [100 x i8]
%8 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%12 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%13 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %17
15: ; preds = %3
%16 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %49
17: ; preds = %3
%18 = call i32 @fscanf(i32* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %9, i8* %11)
%19 = call i32 @fclose(i32* %13)
%20 = icmp eq i32 %18, 2
br i1 %20, label %23, label %21
21: ; preds = %17
%22 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %49
23: ; preds = %17
%24 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%25 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%26 = icmp eq i32* %25, null
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %49
29: ; preds = %23
%30 = ptrtoint i32* %25 to i64
%31 = trunc i64 %30 to i32
%32 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([103 x i8], [103 x i8]* @.str.10, i64 0, i64 0), i8* %9, i8* %10, i8* %11, i8* %1, i8* %0)
%33 = call i32 @fclose(i32* %25)
%34 = load i32, i32* @stdout
%35 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), i8* %0)
%36 = call i32 @system(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.12, i64 0, i64 0))
%37 = call i32 @unlink(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%38 = icmp eq i32 %36, 0
br i1 %38, label %41, label %39
39: ; preds = %29
%40 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %49
41: ; preds = %29
%42 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i8* %1, i8* %0)
%43 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0))
%44 = icmp eq i32* %43, null
br i1 %44, label %45, label %47
45: ; preds = %41
%46 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %9, i8* %11)
br label %49
47: ; preds = %41
%48 = call i32 @fclose(i32* %43)
br label %49
49: ; preds = %45, %39, %27, %21, %15, %47
%50 = phi i32 [ 0, %47 ], [ 1, %15 ], [ 1, %21 ], [ 1, %27 ], [ 1, %39 ], [ 1, %45 ]
ret i32 %50
}