#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 */
scalar_t__ EOF;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ printf(char *, char const *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void make_outfiles(char out_dir[200]) {
  FILE *fpflistx, *fpoutx;
  char out[400];
  extern const char flist[200];
  char str1[200];
  if ((fpflistx = fopen(flist, "r")) == NULL) {
    printf("Cannot open file %s \n", flist);
    exit(0);
  }
  while (fscanf(fpflistx, "%s", str1) != EOF) {
    strcpy(out, out_dir);
    strcat(out, str1);
    fpoutx = fopen(out, "wb");
    fclose(fpoutx);
  }
  fclose(fpflistx);
}


x86 assembly (clang, -O0):
<make_outfiles>:
push   %rbp
mov    %rsp,%rbp
sub    $0x280,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e4a(%rip),%rdi
lea    0xe73(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    11ba <make_outfiles+0x4a>
lea    0xe5b(%rip),%rdi
mov    0x2e22(%rip),%rsi
call   1050 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
jmp    11bf <make_outfiles+0x4f>
mov    -0x10(%rbp),%rdi
lea    -0x280(%rbp),%rdx
lea    0xe47(%rip),%rsi
call   1060 <fscanf@plt>
mov    0x2e0b(%rip),%rcx
cmp    (%rcx),%rax
je     122e <make_outfiles+0xbe>
lea    -0x1b0(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x1b0(%rbp),%rdi
lea    -0x280(%rbp),%rsi
call   1080 <strcat@plt>
lea    -0x1b0(%rbp),%rdi
lea    0xe04(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
jmp    11bf <make_outfiles+0x4f>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x280,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_outfiles>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x268,%rsp
mov    %rdi,%r14
mov    0x2e45(%rip),%rdi
lea    0xe6e(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     123b <make_outfiles+0xcb>
mov    %rax,%r15
lea    0xe6e(%rip),%rsi
mov    %rsp,%rdx
mov    %rax,%rdi
call   1060 <fscanf@plt>
mov    0x2e2c(%rip),%r13
cmp    0x0(%r13),%rax
je     1221 <make_outfiles+0xb1>
lea    0xd0(%rsp),%rbx
mov    %rsp,%r12
lea    0xe44(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1080 <strcat@plt>
mov    %rbx,%rdi
lea    0xe1b(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rdi
call   1040 <fclose@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
call   1060 <fscanf@plt>
cmp    0x0(%r13),%rax
jne    11e0 <make_outfiles+0x70>
mov    %r15,%rdi
call   1040 <fclose@plt>
add    $0x268,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdc0(%rip),%rdi
mov    0x2d87(%rip),%rsi
call   1050 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@flist = external constant [200 x i8]
@.str = [2 x i8] c"r\00"
@.str.1 = [22 x i8] c"Cannot open file %s \0A\00"
@.str.2 = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.3 = [3 x i8] c"wb\00"
define void @make_outfiles(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca [400 x i8]
%6 = alloca [200 x i8]
store i8* %0, i8** %2
%7 = call i32* @fopen(i8* getelementptr inbounds ([200 x i8], [200 x i8]* @flist, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %7, i32** %3
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([200 x i8], [200 x i8]* @flist, i64 0, i64 0))
%11 = call i32 @exit(i32 0)
unreachable
12: ; preds = %1
br label %13
13: ; preds = %19, %12
%14 = load i32*, i32** %3
%15 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%16 = call i64 @fscanf(i32* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %15)
%17 = load i64, i64* @EOF
%18 = icmp ne i64 %16, %17
br i1 %18, label %19, label %30
19: ; preds = %13
%20 = getelementptr inbounds [400 x i8], [400 x i8]* %5, i64 0, i64 0
%21 = load i8*, i8** %2
%22 = call i32 @strcpy(i8* %20, i8* %21)
%23 = getelementptr inbounds [400 x i8], [400 x i8]* %5, i64 0, i64 0
%24 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%25 = call i32 @strcat(i8* %23, i8* %24)
%26 = getelementptr inbounds [400 x i8], [400 x i8]* %5, i64 0, i64 0
%27 = call i32* @fopen(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %27, i32** %4
%28 = load i32*, i32** %4
%29 = call i32 @fclose(i32* %28)
br label %13
30: ; preds = %13
%31 = load i32*, i32** %3
%32 = call i32 @fclose(i32* %31)
ret void
}

LLVM IR (-O2):
@flist = external constant [200 x i8]
@.str = [2 x i8] c"r\00"
@.str.1 = [22 x i8] c"Cannot open file %s \0A\00"
@.str.2 = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.3 = [3 x i8] c"wb\00"
define void @make_outfiles(i8* %0) {
%2 = alloca [400 x i8]
%3 = alloca [200 x i8]
%4 = getelementptr inbounds [400 x i8], [400 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([200 x i8], [200 x i8]* @flist, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %12, label %8
8: ; preds = %1
%9 = call i64 @fscanf(i32* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%10 = load i64, i64* @EOF
%11 = icmp eq i64 %9, %10
br i1 %11, label %23, label %15
12: ; preds = %1
%13 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([200 x i8], [200 x i8]* @flist, i64 0, i64 0))
%14 = tail call i32 @exit(i32 0)
unreachable
15: ; preds = %8, %15
%16 = call i32 @strcpy(i8* %4, i8* %0)
%17 = call i32 @strcat(i8* %4, i8* %5)
%18 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 @fclose(i32* %18)
%20 = call i64 @fscanf(i32* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%21 = load i64, i64* @EOF
%22 = icmp eq i64 %20, %21
br i1 %22, label %23, label %15
23: ; preds = %15, %8
%24 = call i32 @fclose(i32* %6)
ret void
}