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

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int _check_configure(int *);
int _read_line(int, char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int read_configure() {
  int fd;
  char buffer[150];
  int i;
  int config_array[13];
  for (i = 0; i < 13; i++) {
    config_array[i] = 0;
  }
  i = 0;
  if ((fd = open("/etc/xylftp/xylftp.conf", O_RDONLY)) == -1) {
    fprintf(stderr, "can't open the configure file,please use the tool "
                    "xylftppass to solve this problem!\n");
    return -1;
  } else {
    i = _read_line(fd, buffer);
    close(fd);
  }
  if (_check_configure(config_array) == -1) {
    fprintf(stderr, "configure file error!");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<read_configure>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0xa4(%rbp)
cmpl   $0xd,-0xa4(%rbp)
jge    1198 <read_configure+0x48>
movslq -0xa4(%rbp),%rax
movl   $0x0,-0xe0(%rbp,%rax,4)
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    1165 <read_configure+0x15>
movl   $0x0,-0xa4(%rbp)
mov    0x2e3f(%rip),%rax
mov    (%rax),%esi
lea    0xe4e(%rip),%rdi
call   1060 <open@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xffffffff,%eax
jne    11e4 <read_configure+0x94>
mov    0x2e0e(%rip),%rax
mov    (%rax),%edi
lea    0xe45(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    123e <read_configure+0xee>
mov    -0x8(%rbp),%edi
lea    -0xa0(%rbp),%rsi
call   1070 <_read_line@plt>
mov    %eax,-0xa4(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <close@plt>
lea    -0xe0(%rbp),%rdi
call   1030 <_check_configure@plt>
cmp    $0xffffffff,%eax
jne    1237 <read_configure+0xe7>
mov    0x2dbb(%rip),%rax
mov    (%rax),%edi
lea    0xe47(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    123e <read_configure+0xee>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_configure>:
push   %rbx
sub    $0xe0,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movl   $0x0,0x30(%rsp)
mov    0x2e70(%rip),%rax
mov    (%rax),%esi
lea    0xe7f(%rip),%rdi
call   1060 <open@plt>
cmp    $0xffffffff,%eax
je     11c3 <read_configure+0x73>
mov    %eax,%ebx
lea    0x40(%rsp),%rsi
mov    %eax,%edi
call   1070 <_read_line@plt>
mov    %ebx,%edi
call   1040 <close@plt>
mov    %rsp,%rdi
call   1030 <_check_configure@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
jne    11dd <read_configure+0x8d>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
lea    0xeac(%rip),%rsi
jmp    11d3 <read_configure+0x83>
mov    0x2e0e(%rip),%rax
mov    (%rax),%edi
lea    0xe45(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0xe0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"/etc/xylftp/xylftp.conf\00"
@O_RDONLY = global i32 0
@stderr = global i32 0
@.str.1 = [85 x i8] c"can't open the configure file,please use the tool xylftppass to solve this problem!\0A\00"
@.str.2 = [22 x i8] c"configure file error!\00"
define i32 @read_configure() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [150 x i8]
%4 = alloca i32
%5 = alloca [13 x i32]
store i32 0, i32* %4
br label %6
6: ; preds = %13, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 13
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [13 x i32], [13 x i32]* %5, i64 0, i64 %11
store i32 0, i32* %12
br label %13
13: ; preds = %9
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 1
store i32 %15, i32* %4
br label %6
16: ; preds = %6
store i32 0, i32* %4
%17 = load i32, i32* @O_RDONLY
%18 = call i32 @open(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %17)
store i32 %18, i32* %2
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = load i32, i32* @stderr
%22 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %1
br label %37
23: ; preds = %16
%24 = load i32, i32* %2
%25 = getelementptr inbounds [150 x i8], [150 x i8]* %3, i64 0, i64 0
%26 = call i32 @_read_line(i32 %24, i8* %25)
store i32 %26, i32* %4
%27 = load i32, i32* %2
%28 = call i32 @close(i32 %27)
br label %29
29: ; preds = %23
%30 = getelementptr inbounds [13 x i32], [13 x i32]* %5, i64 0, i64 0
%31 = call i32 @_check_configure(i32* %30)
%32 = icmp eq i32 %31, -1
br i1 %32, label %33, label %36
33: ; preds = %29
%34 = load i32, i32* @stderr
%35 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %1
br label %37
36: ; preds = %29
store i32 0, i32* %1
br label %37
37: ; preds = %36, %33, %20
%38 = load i32, i32* %1
ret i32 %38
}

LLVM IR (-O2):
@.str = [24 x i8] c"/etc/xylftp/xylftp.conf\00"
@O_RDONLY = global i32 0
@stderr = global i32 0
@.str.1 = [85 x i8] c"can't open the configure file,please use the tool xylftppass to solve this problem!\0A\00"
@.str.2 = [22 x i8] c"configure file error!\00"
define i32 @read_configure() {
%1 = alloca [150 x i8]
%2 = alloca [13 x i32]
%3 = bitcast [13 x i32]* %2 to i8*
%4 = getelementptr inbounds [150 x i8], [150 x i8]* %1, i64 0, i64 0
%5 = load i32, i32* @O_RDONLY
%6 = tail call i32 @open(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.1, i64 0, i64 0))
br label %20
11: ; preds = %0
%12 = call i32 @_read_line(i32 %6, i8* %4)
%13 = call i32 @close(i32 %6)
%14 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 0
%15 = call i32 @_check_configure(i32* %14)
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %20
17: ; preds = %11
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %11, %17, %8
%21 = phi i32 [ -1, %8 ], [ -1, %17 ], [ 0, %11 ]
ret i32 %21
}