#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*/ error(char *, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ getstr(char *, char *);
int read_user_matrix_series(char *);
int /*<<< orphan*/ strcpy(char *, char *);
char check_user_matrix_series(char *str, char verbose) {
  int maxres;
  static char lin2[1024 + 1];
  FILE *infile;
  if (verbose)
    getstr("Enter name of the matrix file", lin2);
  else
    strcpy(lin2, str);
  if (*lin2 == '\0')
    return 0;
  if ((infile = fopen(lin2, "r")) == NULL) {
    error("Cannot find matrix file [%s]", lin2);
    return 0;
  }
  fclose(infile);
  strcpy(str, lin2);
  maxres = read_user_matrix_series(str);
  if (maxres <= 0)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<check_user_matrix_series>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
cmpb   $0x0,-0x11(%rbp)
je     1194 <check_user_matrix_series+0x34>
lea    0xe7d(%rip),%rdi
lea    0x2ed6(%rip),%rsi
call   1050 <getstr@plt>
jmp    11a4 <check_user_matrix_series+0x44>
mov    -0x10(%rbp),%rsi
lea    0x2ec1(%rip),%rdi
call   1030 <strcpy@plt>
movsbl 0x2eb5(%rip),%eax
cmp    $0x0,%eax
jne    11bd <check_user_matrix_series+0x5d>
movb   $0x0,-0x1(%rbp)
jmp    1236 <check_user_matrix_series+0xd6>
lea    0x2e9c(%rip),%rdi
lea    0xe53(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    11fa <check_user_matrix_series+0x9a>
lea    0xe3b(%rip),%rdi
lea    0x2e74(%rip),%rsi
call   1060 <error@plt>
movb   $0x0,-0x1(%rbp)
jmp    1236 <check_user_matrix_series+0xd6>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x10(%rbp),%rdi
lea    0x2e52(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
call   1080 <read_user_matrix_series@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jg     1232 <check_user_matrix_series+0xd2>
movb   $0x0,-0x1(%rbp)
jmp    1236 <check_user_matrix_series+0xd6>
movb   $0x1,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_user_matrix_series>:
push   %rbx
mov    %rdi,%rbx
test   %sil,%sil
je     1187 <check_user_matrix_series+0x27>
lea    0xe90(%rip),%rdi
lea    0x2ee9(%rip),%rsi
call   1050 <getstr@plt>
cmpb   $0x0,0x2edd(%rip)
jne    119f <check_user_matrix_series+0x3f>
jmp    11f0 <check_user_matrix_series+0x90>
lea    0x2ed2(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
cmpb   $0x0,0x2ec3(%rip)
je     11f0 <check_user_matrix_series+0x90>
lea    0x2eba(%rip),%rdi
lea    0xe71(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     11dd <check_user_matrix_series+0x7d>
mov    %rax,%rdi
call   1040 <fclose@plt>
lea    0x2e9a(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1080 <read_user_matrix_series@plt>
test   %eax,%eax
setg   %al
pop    %rbx
ret
lea    0xe3c(%rip),%rdi
lea    0x2e75(%rip),%rsi
call   1060 <error@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@check_user_matrix_series.lin2 = internal global [1025 x i8] zeroinitializer
@.str = [30 x i8] c"Enter name of the matrix file\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [29 x i8] c"Cannot find matrix file [%s]\00"
define signext i8 @check_user_matrix_series(i8* %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i32
%7 = alloca i32*
store i8* %0, i8** %4
store i8 %1, i8* %5
%8 = load i8, i8* %5
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @getstr(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1025 x i8], [1025 x i8]* @check_user_matrix_series.lin2, i64 0, i64 0))
br label %15
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = call i32 @strcpy(i8* getelementptr inbounds ([1025 x i8], [1025 x i8]* @check_user_matrix_series.lin2, i64 0, i64 0), i8* %13)
br label %15
15: ; preds = %12, %10
%16 = load i8, i8* getelementptr inbounds ([1025 x i8], [1025 x i8]* @check_user_matrix_series.lin2, i64 0, i64 0)
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %15
store i8 0, i8* %3
br label %36
20: ; preds = %15
%21 = call i32* @fopen(i8* getelementptr inbounds ([1025 x i8], [1025 x i8]* @check_user_matrix_series.lin2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %21, i32** %7
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 @error(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1025 x i8], [1025 x i8]* @check_user_matrix_series.lin2, i64 0, i64 0))
store i8 0, i8* %3
br label %36
25: ; preds = %20
%26 = load i32*, i32** %7
%27 = call i32 @fclose(i32* %26)
%28 = load i8*, i8** %4
%29 = call i32 @strcpy(i8* %28, i8* getelementptr inbounds ([1025 x i8], [1025 x i8]* @check_user_matrix_series.lin2, i64 0, i64 0))
%30 = load i8*, i8** %4
%31 = call i32 @read_user_matrix_series(i8* %30)
store i32 %31, i32* %6
%32 = load i32, i32* %6
%33 = icmp sle i32 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %25
store i8 0, i8* %3
br label %36
35: ; preds = %25
store i8 1, i8* %3
br label %36
36: ; preds = %35, %34, %23, %19
%37 = load i8, i8* %3
ret i8 %37
}

LLVM IR (-O2):
@check_user_matrix_series.lin2 = internal global [1025 x i8] zeroinitializer
@.str = [30 x i8] c"Enter name of the matrix file\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [29 x i8] c"Cannot find matrix file [%s]\00"
define signext i8 @check_user_matrix_series(i8* %0, i8 signext %1) {
%3 = icmp eq i8 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @getstr(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1025 x i8], [1025 x i8]* @check_user_matrix_series.lin2, i64 0, i64 0))
br label %8
6: ; preds = %2
%7 = tail call i32 @strcpy(i8* getelementptr inbounds ([1025 x i8], [1025 x i8]* @check_user_matrix_series.lin2, i64 0, i64 0), i8* %0)
br label %8
8: ; preds = %6, %4
%9 = load i8, i8* getelementptr inbounds ([1025 x i8], [1025 x i8]* @check_user_matrix_series.lin2, i64 0, i64 0)
%10 = icmp eq i8 %9, 0
br i1 %10, label %22, label %11
11: ; preds = %8
%12 = tail call i32* @fopen(i8* getelementptr inbounds ([1025 x i8], [1025 x i8]* @check_user_matrix_series.lin2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = tail call i32 @error(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1025 x i8], [1025 x i8]* @check_user_matrix_series.lin2, i64 0, i64 0))
br label %22
16: ; preds = %11
%17 = tail call i32 @fclose(i32* %12)
%18 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([1025 x i8], [1025 x i8]* @check_user_matrix_series.lin2, i64 0, i64 0))
%19 = tail call i32 @read_user_matrix_series(i8* %0)
%20 = icmp sgt i32 %19, 0
%21 = zext i1 %20 to i8
br label %22
22: ; preds = %16, %8, %14
%23 = phi i8 [ 0, %14 ], [ 0, %8 ], [ %21, %16 ]
ret i8 %23
}