#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 */
struct dirent {
  char *d_name;
};

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int open(char *, int /*<<< orphan*/);
int read(int, char *, int);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
scalar_t__ strncmp(char *, char *, int);
int strtol(char *, int /*<<< orphan*/ *, int);
int check_device(struct dirent *de, char *vidpid, int *bus, int *address) {
  int fd;
  char path[128], vid[5], buf[5];
  memcpy(vid, vidpid, 4);
  vid[4] = '\0';
  sprintf(path, "%s/%s/idVendor", "/sys/bus/usb/devices", de->d_name);
  if ((fd = open(path, O_RDONLY)) == -1)
    return 0;
  buf[4] = '\0';
  if ((read(fd, buf, 4) != 4) || strncmp(vid, buf, 4)) {
    close(fd);
    return 0;
  }
  sprintf(path, "%s/%s/idProduct", "/sys/bus/usb/devices", de->d_name);
  if ((fd = open(path, O_RDONLY)) == -1)
    return 0;
  buf[4] = '\0';
  if ((read(fd, buf, 4) != 4) || strncmp(vidpid + 5, buf, 4)) {
    close(fd);
    return 0;
  }
  sprintf(path, "%s/%s/busnum", "/sys/bus/usb/devices", de->d_name);
  if ((fd = open(path, O_RDONLY)) == -1)
    return 0;
  memset(buf, 0, 5);
  read(fd, buf, 4);
  *bus = strtol(buf, NULL, 10);
  sprintf(path, "%s/%s/devnum", "/sys/bus/usb/devices", de->d_name);
  if ((fd = open(path, O_RDONLY)) == -1)
    return 0;
  memset(buf, 0, 5);
  read(fd, buf, 4);
  *address = strtol(buf, NULL, 10);
  return 1;
}


x86 assembly (clang, -O0):
<check_device>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
lea    -0xb5(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x4,%edx
call   1080 <memcpy@plt>
movb   $0x0,-0xb1(%rbp)
lea    -0xb0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xe34(%rip),%rsi
lea    0xe3c(%rip),%rdx
call   10a0 <sprintf@plt>
lea    -0xb0(%rbp),%rdi
mov    0x2e02(%rip),%rax
mov    (%rax),%esi
call   1090 <open@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0xffffffff,%eax
jne    1205 <check_device+0x85>
movl   $0x0,-0x4(%rbp)
jmp    1433 <check_device+0x2b3>
movb   $0x0,-0xb6(%rbp)
mov    -0x2c(%rbp),%edi
lea    -0xba(%rbp),%rsi
mov    $0x4,%edx
call   1060 <read@plt>
cmp    $0x4,%eax
jne    124b <check_device+0xcb>
lea    -0xb5(%rbp),%rdi
lea    -0xba(%rbp),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     125f <check_device+0xdf>
mov    -0x2c(%rbp),%edi
call   1050 <close@plt>
movl   $0x0,-0x4(%rbp)
jmp    1433 <check_device+0x2b3>
lea    -0xb0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xdb0(%rip),%rsi
lea    0xd94(%rip),%rdx
call   10a0 <sprintf@plt>
lea    -0xb0(%rbp),%rdi
mov    0x2d5a(%rip),%rax
mov    (%rax),%esi
call   1090 <open@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0xffffffff,%eax
jne    12ad <check_device+0x12d>
movl   $0x0,-0x4(%rbp)
jmp    1433 <check_device+0x2b3>
movb   $0x0,-0xb6(%rbp)
mov    -0x2c(%rbp),%edi
lea    -0xba(%rbp),%rsi
mov    $0x4,%edx
call   1060 <read@plt>
cmp    $0x4,%eax
jne    12f4 <check_device+0x174>
mov    -0x18(%rbp),%rdi
add    $0x5,%rdi
lea    -0xba(%rbp),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1308 <check_device+0x188>
mov    -0x2c(%rbp),%edi
call   1050 <close@plt>
movl   $0x0,-0x4(%rbp)
jmp    1433 <check_device+0x2b3>
lea    -0xb0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xd17(%rip),%rsi
lea    0xceb(%rip),%rdx
call   10a0 <sprintf@plt>
lea    -0xb0(%rbp),%rdi
mov    0x2cb1(%rip),%rax
mov    (%rax),%esi
call   1090 <open@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0xffffffff,%eax
jne    1356 <check_device+0x1d6>
movl   $0x0,-0x4(%rbp)
jmp    1433 <check_device+0x2b3>
lea    -0xba(%rbp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1040 <memset@plt>
mov    -0x2c(%rbp),%edi
lea    -0xba(%rbp),%rsi
mov    $0x4,%edx
call   1060 <read@plt>
lea    -0xba(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
lea    -0xb0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xc92(%rip),%rsi
lea    0xc59(%rip),%rdx
call   10a0 <sprintf@plt>
lea    -0xb0(%rbp),%rdi
mov    0x2c1f(%rip),%rax
mov    (%rax),%esi
call   1090 <open@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0xffffffff,%eax
jne    13e8 <check_device+0x268>
movl   $0x0,-0x4(%rbp)
jmp    1433 <check_device+0x2b3>
lea    -0xba(%rbp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1040 <memset@plt>
mov    -0x2c(%rbp),%edi
lea    -0xba(%rbp),%rsi
mov    $0x4,%edx
call   1060 <read@plt>
lea    -0xba(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_device>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %rcx,0x18(%rsp)
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r13
lea    0x13(%rsp),%rdi
mov    $0x4,%edx
call   1080 <memcpy@plt>
movb   $0x0,0x17(%rsp)
mov    0x0(%r13),%rcx
lea    0xe42(%rip),%rsi
lea    0xe4a(%rip),%rdx
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
call   10a0 <sprintf@plt>
mov    0x2e0f(%rip),%r14
mov    (%r14),%esi
mov    %rbp,%rdi
call   1090 <open@plt>
xor    %r12d,%r12d
cmp    $0xffffffff,%eax
je     1229 <check_device+0xa9>
mov    %eax,%ebp
movb   $0x0,0x12(%rsp)
lea    0xe(%rsp),%rsi
mov    %eax,%edi
mov    $0x4,%edx
call   1060 <read@plt>
cmp    $0x4,%eax
jne    1222 <check_device+0xa2>
lea    0x13(%rsp),%rdi
lea    0xe(%rsp),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     123e <check_device+0xbe>
mov    %ebp,%edi
call   1050 <close@plt>
mov    %r12d,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x0(%r13),%rcx
lea    0xddb(%rip),%rsi
lea    0xdbf(%rip),%rdx
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
call   10a0 <sprintf@plt>
mov    (%r14),%esi
mov    %rbp,%rdi
call   1090 <open@plt>
cmp    $0xffffffff,%eax
je     1229 <check_device+0xa9>
mov    %eax,%ebp
movb   $0x0,0x12(%rsp)
lea    0xe(%rsp),%rsi
mov    %eax,%edi
mov    $0x4,%edx
call   1060 <read@plt>
cmp    $0x4,%eax
jne    1222 <check_device+0xa2>
add    $0x5,%rbx
lea    0xe(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1222 <check_device+0xa2>
mov    0x0(%r13),%rcx
lea    0xd80(%rip),%rsi
lea    0xd54(%rip),%rdx
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   10a0 <sprintf@plt>
mov    (%r14),%esi
mov    %rbx,%rdi
call   1090 <open@plt>
cmp    $0xffffffff,%eax
je     1229 <check_device+0xa9>
mov    %eax,%ebx
lea    0xe(%rsp),%rbp
xor    %r12d,%r12d
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1040 <memset@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    $0x4,%edx
call   1060 <read@plt>
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %eax,(%r15)
mov    0x0(%r13),%rcx
lea    0xd20(%rip),%rsi
lea    0xce7(%rip),%rdx
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   10a0 <sprintf@plt>
mov    (%r14),%esi
mov    %rbx,%rdi
call   1090 <open@plt>
cmp    $0xffffffff,%eax
je     1229 <check_device+0xa9>
mov    %eax,%ebx
lea    0xe(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1040 <memset@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    $0x4,%edx
call   1060 <read@plt>
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    0x18(%rsp),%rcx
mov    %eax,(%rcx)
mov    $0x1,%r12d
jmp    1229 <check_device+0xa9>

LLVM IR (-O0):
%struct.dirent = type { i8* }
@.str = [15 x i8] c"%s/%s/idVendor\00"
@.str.1 = [21 x i8] c"/sys/bus/usb/devices\00"
@O_RDONLY = global i32 0
@.str.2 = [16 x i8] c"%s/%s/idProduct\00"
@.str.3 = [13 x i8] c"%s/%s/busnum\00"
@.str.4 = [13 x i8] c"%s/%s/devnum\00"
define i32 @check_device(%struct.dirent* %0, i8* %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca %struct.dirent*
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca [128 x i8]
%12 = alloca [5 x i8]
%13 = alloca [5 x i8]
store %struct.dirent* %0, %struct.dirent** %6
store i8* %1, i8** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
%14 = getelementptr inbounds [5 x i8], [5 x i8]* %12, i64 0, i64 0
%15 = load i8*, i8** %7
%16 = call i32 @memcpy(i8* %14, i8* %15, i32 4)
%17 = getelementptr inbounds [5 x i8], [5 x i8]* %12, i64 0, i64 4
store i8 0, i8* %17
%18 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%19 = load %struct.dirent*, %struct.dirent** %6
%20 = getelementptr inbounds %struct.dirent, %struct.dirent* %19, i32 0, i32 0
%21 = load i8*, i8** %20
%22 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %21)
%23 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%24 = load i32, i32* @O_RDONLY
%25 = call i32 @open(i8* %23, i32 %24)
store i32 %25, i32* %10
%26 = icmp eq i32 %25, -1
br i1 %26, label %27, label %28
27: ; preds = %4
store i32 0, i32* %5
br label %107
28: ; preds = %4
%29 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 4
store i8 0, i8* %29
%30 = load i32, i32* %10
%31 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 0
%32 = call i32 @read(i32 %30, i8* %31, i32 4)
%33 = icmp ne i32 %32, 4
br i1 %33, label %39, label %34
34: ; preds = %28
%35 = getelementptr inbounds [5 x i8], [5 x i8]* %12, i64 0, i64 0
%36 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 0
%37 = call i64 @strncmp(i8* %35, i8* %36, i32 4)
%38 = icmp ne i64 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %34, %28
%40 = load i32, i32* %10
%41 = call i32 @close(i32 %40)
store i32 0, i32* %5
br label %107
42: ; preds = %34
%43 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%44 = load %struct.dirent*, %struct.dirent** %6
%45 = getelementptr inbounds %struct.dirent, %struct.dirent* %44, i32 0, i32 0
%46 = load i8*, i8** %45
%47 = call i32 @sprintf(i8* %43, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %46)
%48 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%49 = load i32, i32* @O_RDONLY
%50 = call i32 @open(i8* %48, i32 %49)
store i32 %50, i32* %10
%51 = icmp eq i32 %50, -1
br i1 %51, label %52, label %53
52: ; preds = %42
store i32 0, i32* %5
br label %107
53: ; preds = %42
%54 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 4
store i8 0, i8* %54
%55 = load i32, i32* %10
%56 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 0
%57 = call i32 @read(i32 %55, i8* %56, i32 4)
%58 = icmp ne i32 %57, 4
br i1 %58, label %65, label %59
59: ; preds = %53
%60 = load i8*, i8** %7
%61 = getelementptr inbounds i8, i8* %60, i64 5
%62 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 0
%63 = call i64 @strncmp(i8* %61, i8* %62, i32 4)
%64 = icmp ne i64 %63, 0
br i1 %64, label %65, label %68
65: ; preds = %59, %53
%66 = load i32, i32* %10
%67 = call i32 @close(i32 %66)
store i32 0, i32* %5
br label %107
68: ; preds = %59
%69 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%70 = load %struct.dirent*, %struct.dirent** %6
%71 = getelementptr inbounds %struct.dirent, %struct.dirent* %70, i32 0, i32 0
%72 = load i8*, i8** %71
%73 = call i32 @sprintf(i8* %69, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %72)
%74 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%75 = load i32, i32* @O_RDONLY
%76 = call i32 @open(i8* %74, i32 %75)
store i32 %76, i32* %10
%77 = icmp eq i32 %76, -1
br i1 %77, label %78, label %79
78: ; preds = %68
store i32 0, i32* %5
br label %107
79: ; preds = %68
%80 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 0
%81 = call i32 @memset(i8* %80, i32 0, i32 5)
%82 = load i32, i32* %10
%83 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 0
%84 = call i32 @read(i32 %82, i8* %83, i32 4)
%85 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 0
%86 = call i32 @strtol(i8* %85, i32* null, i32 10)
%87 = load i32*, i32** %8
store i32 %86, i32* %87
%88 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%89 = load %struct.dirent*, %struct.dirent** %6
%90 = getelementptr inbounds %struct.dirent, %struct.dirent* %89, i32 0, i32 0
%91 = load i8*, i8** %90
%92 = call i32 @sprintf(i8* %88, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %91)
%93 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%94 = load i32, i32* @O_RDONLY
%95 = call i32 @open(i8* %93, i32 %94)
store i32 %95, i32* %10
%96 = icmp eq i32 %95, -1
br i1 %96, label %97, label %98
97: ; preds = %79
store i32 0, i32* %5
br label %107
98: ; preds = %79
%99 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 0
%100 = call i32 @memset(i8* %99, i32 0, i32 5)
%101 = load i32, i32* %10
%102 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 0
%103 = call i32 @read(i32 %101, i8* %102, i32 4)
%104 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 0
%105 = call i32 @strtol(i8* %104, i32* null, i32 10)
%106 = load i32*, i32** %9
store i32 %105, i32* %106
store i32 1, i32* %5
br label %107
107: ; preds = %98, %97, %78, %65, %52, %39, %27
%108 = load i32, i32* %5
ret i32 %108
}

LLVM IR (-O2):
%struct.dirent = type { i8* }
@.str = [15 x i8] c"%s/%s/idVendor\00"
@.str.1 = [21 x i8] c"/sys/bus/usb/devices\00"
@O_RDONLY = global i32 0
@.str.2 = [16 x i8] c"%s/%s/idProduct\00"
@.str.3 = [13 x i8] c"%s/%s/busnum\00"
@.str.4 = [13 x i8] c"%s/%s/devnum\00"
define i32 @check_device(%struct.dirent* nocapture %0, i8* %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = alloca [128 x i8]
%6 = alloca [5 x i8]
%7 = alloca [5 x i8]
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%9 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%11 = call i32 @memcpy(i8* %9, i8* %1, i32 4)
%12 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 4
store i8 0, i8* %12
%13 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 0
%14 = load i8*, i8** %13
%15 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = load i32, i32* @O_RDONLY
%17 = call i32 @open(i8* %8, i32 %16)
%18 = icmp eq i32 %17, -1
br i1 %18, label %62, label %19
19: ; preds = %4
%20 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 4
store i8 0, i8* %20
%21 = call i32 @read(i32 %17, i8* %10, i32 4)
%22 = icmp eq i32 %21, 4
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = call i64 @strncmp(i8* %9, i8* %10, i32 4)
%25 = icmp eq i64 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %23, %19
%27 = call i32 @close(i32 %17)
br label %62
28: ; preds = %23
%29 = load i8*, i8** %13
%30 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %29)
%31 = load i32, i32* @O_RDONLY
%32 = call i32 @open(i8* %8, i32 %31)
%33 = icmp eq i32 %32, -1
br i1 %33, label %62, label %34
34: ; preds = %28
store i8 0, i8* %20
%35 = call i32 @read(i32 %32, i8* %10, i32 4)
%36 = icmp eq i32 %35, 4
br i1 %36, label %37, label %41
37: ; preds = %34
%38 = getelementptr inbounds i8, i8* %1, i64 5
%39 = call i64 @strncmp(i8* %38, i8* %10, i32 4)
%40 = icmp eq i64 %39, 0
br i1 %40, label %43, label %41
41: ; preds = %37, %34
%42 = call i32 @close(i32 %32)
br label %62
43: ; preds = %37
%44 = load i8*, i8** %13
%45 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %44)
%46 = load i32, i32* @O_RDONLY
%47 = call i32 @open(i8* %8, i32 %46)
%48 = icmp eq i32 %47, -1
br i1 %48, label %62, label %49
49: ; preds = %43
%50 = call i32 @memset(i8* %10, i32 0, i32 5)
%51 = call i32 @read(i32 %47, i8* %10, i32 4)
%52 = call i32 @strtol(i8* nocapture %10, i32* null, i32 10)
store i32 %52, i32* %2
%53 = load i8*, i8** %13
%54 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %53)
%55 = load i32, i32* @O_RDONLY
%56 = call i32 @open(i8* %8, i32 %55)
%57 = icmp eq i32 %56, -1
br i1 %57, label %62, label %58
58: ; preds = %49
%59 = call i32 @memset(i8* %10, i32 0, i32 5)
%60 = call i32 @read(i32 %56, i8* %10, i32 4)
%61 = call i32 @strtol(i8* nocapture %10, i32* null, i32 10)
store i32 %61, i32* %3
br label %62
62: ; preds = %49, %43, %28, %4, %58, %41, %26
%63 = phi i32 [ 0, %26 ], [ 0, %41 ], [ 1, %58 ], [ 0, %4 ], [ 0, %28 ], [ 0, %43 ], [ 0, %49 ]
ret i32 %63
}