#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 timeval {
  int tv_usec;
  scalar_t__ tv_sec;
};
struct termios {
  int dummy;
};
typedef int /*<<< orphan*/ resp;

/* Variables and functions */
scalar_t__ EAGAIN;
int TIOCM_DTR;
int TIOCM_RTS;
scalar_t__ errno;
int get_serial_lines(int);
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/, int);
int read(int, unsigned char *, int);
int /*<<< orphan*/ set_serial_lines(int, int);
int setup_serial_port(int, int, struct termios *);
scalar_t__ strstr(unsigned char *, char *);
int tcgetattr(int, struct termios *);
int time(int /*<<< orphan*/ *);
int /*<<< orphan*/ usleep(int);
scalar_t__ wait_for_input(int, struct timeval *);
int /*<<< orphan*/ write(int, char *, int);
int init_pnp_com_ati9(int fd) {
  int modem_lines;
  int temp;
  int done;
  int respindex;
  int starttime;
  unsigned char resp[100], buf[2];
  struct timeval timo;
  struct termios portattr;
  ;
  ;
  modem_lines = get_serial_lines(fd);
  modem_lines &= ~TIOCM_RTS;
  set_serial_lines(fd, modem_lines);
  usleep(200000);
  temp = tcgetattr(fd, &portattr);
  if (temp < 0) {
    modem_lines |= TIOCM_DTR | TIOCM_RTS;
    set_serial_lines(fd, modem_lines);
    return 1;
  }
  temp = setup_serial_port(fd, 8, &portattr);
  if (temp < 0) {
    modem_lines |= TIOCM_DTR | TIOCM_RTS;
    set_serial_lines(fd, modem_lines);
    return 1;
  }
  modem_lines = get_serial_lines(fd);
  modem_lines |= TIOCM_RTS | TIOCM_DTR;
  set_serial_lines(fd, modem_lines);
  usleep(200000);
  ;
  ;
  write(fd, "ATI9\r", 5);
  done = 0;
  respindex = 0;
  starttime = time(NULL);
  memset(resp, 0, sizeof(resp));
  while (!done) {
    timo.tv_sec = 0;
    timo.tv_usec = 250000;
    if (wait_for_input(fd, &timo) > 0) {
      temp = read(fd, buf, 1);
      if (temp < 0) {
        if (errno != EAGAIN)
          return 1;
      } else {
        resp[respindex++] = buf[0];
        resp[respindex] = 0;
      }
    } else
      done = 1;
    if (time(NULL) - starttime > 5)
      done = 1;
    if (respindex > 6)
      done = 1;
    if (strstr(resp, "ATI9\r"))
      done = 1;
    ;
    ;
  }
  if (strstr(resp, "("))
    return 3;
  else
    return 2;
  return 3;
}


x86 assembly (clang, -O0):
<init_pnp_com_ati9>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   10a0 <get_serial_lines@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e18(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <set_serial_lines@plt>
mov    $0x30d40,%edi
call   10d0 <usleep@plt>
mov    -0x8(%rbp),%edi
lea    -0xa0(%rbp),%rsi
call   10b0 <tcgetattr@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jge    123b <init_pnp_com_ati9+0x8b>
mov    0x2dcd(%rip),%rax
mov    (%rax),%eax
mov    0x2dcc(%rip),%rcx
or     (%rcx),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <set_serial_lines@plt>
movl   $0x1,-0x4(%rbp)
jmp    143d <init_pnp_com_ati9+0x28d>
mov    -0x8(%rbp),%edi
mov    $0x8,%esi
lea    -0xa0(%rbp),%rdx
call   1050 <setup_serial_port@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jge    128b <init_pnp_com_ati9+0xdb>
mov    0x2d7d(%rip),%rax
mov    (%rax),%eax
mov    0x2d7c(%rip),%rcx
or     (%rcx),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <set_serial_lines@plt>
movl   $0x1,-0x4(%rbp)
jmp    143d <init_pnp_com_ati9+0x28d>
mov    -0x8(%rbp),%edi
call   10a0 <get_serial_lines@plt>
mov    %eax,-0xc(%rbp)
mov    0x2d4b(%rip),%rax
mov    (%rax),%eax
mov    0x2d3a(%rip),%rcx
or     (%rcx),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <set_serial_lines@plt>
mov    $0x30d40,%edi
call   10d0 <usleep@plt>
mov    -0x8(%rbp),%edi
lea    0xd33(%rip),%rsi
mov    $0x5,%edx
call   1040 <write@plt>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
mov    %eax,-0x1c(%rbp)
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1070 <memset@plt>
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1317 <init_pnp_com_ati9+0x167>
jmp    1410 <init_pnp_com_ati9+0x260>
movq   $0x0,-0x90(%rbp)
movl   $0x3d090,-0x98(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x98(%rbp),%rsi
call   1060 <wait_for_input@plt>
cmp    $0x0,%rax
jle    13b6 <init_pnp_com_ati9+0x206>
mov    -0x8(%rbp),%edi
lea    -0x82(%rbp),%rsi
mov    $0x1,%edx
call   1080 <read@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jge    1391 <init_pnp_com_ati9+0x1e1>
mov    0x2c63(%rip),%rax
mov    (%rax),%rax
mov    0x2c49(%rip),%rcx
cmp    (%rcx),%rax
je     138c <init_pnp_com_ati9+0x1dc>
movl   $0x1,-0x4(%rbp)
jmp    143d <init_pnp_com_ati9+0x28d>
jmp    13b1 <init_pnp_com_ati9+0x201>
mov    -0x82(%rbp),%cl
mov    -0x18(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
cltq
mov    %cl,-0x80(%rbp,%rax,1)
movslq -0x18(%rbp),%rax
movb   $0x0,-0x80(%rbp,%rax,1)
jmp    13bd <init_pnp_com_ati9+0x20d>
movl   $0x1,-0x14(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
sub    -0x1c(%rbp),%eax
cmp    $0x5,%eax
jle    13d9 <init_pnp_com_ati9+0x229>
movl   $0x1,-0x14(%rbp)
cmpl   $0x6,-0x18(%rbp)
jle    13ea <init_pnp_com_ati9+0x23a>
movl   $0x1,-0x14(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xc0b(%rip),%rsi
call   10c0 <strstr@plt>
cmp    $0x0,%rax
je     140b <init_pnp_com_ati9+0x25b>
movl   $0x1,-0x14(%rbp)
jmp    1301 <init_pnp_com_ati9+0x151>
lea    -0x80(%rbp),%rdi
lea    0xbeb(%rip),%rsi
call   10c0 <strstr@plt>
cmp    $0x0,%rax
je     1436 <init_pnp_com_ati9+0x286>
movl   $0x3,-0x4(%rbp)
jmp    143d <init_pnp_com_ati9+0x28d>
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_pnp_com_ati9>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %edi,%ebx
call   10a0 <get_serial_lines@plt>
mov    0x2e19(%rip),%r14
mov    (%r14),%ebp
not    %ebp
and    %eax,%ebp
mov    %ebx,%edi
mov    %ebp,%esi
call   1030 <set_serial_lines@plt>
mov    $0x30d40,%edi
call   10d0 <usleep@plt>
lea    0x8(%rsp),%rsi
mov    %ebx,%edi
call   10b0 <tcgetattr@plt>
test   %eax,%eax
js     1350 <init_pnp_com_ati9+0x1a0>
lea    0x8(%rsp),%rdx
mov    %ebx,%edi
mov    $0x8,%esi
call   1050 <setup_serial_port@plt>
test   %eax,%eax
js     1350 <init_pnp_com_ati9+0x1a0>
mov    %ebx,%edi
call   10a0 <get_serial_lines@plt>
mov    0x2dbc(%rip),%rcx
or     (%r14),%eax
or     (%rcx),%eax
mov    %ebx,%edi
mov    %eax,%esi
call   1030 <set_serial_lines@plt>
mov    $0x30d40,%edi
call   10d0 <usleep@plt>
lea    0xdbd(%rip),%rsi
mov    %ebx,%edi
mov    $0x5,%edx
call   1040 <write@plt>
xor    %r14d,%r14d
xor    %edi,%edi
call   1090 <time@plt>
mov    %eax,%ebp
lea    0x20(%rsp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1070 <memset@plt>
lea    0x10(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movq   $0x0,0x18(%rsp)
movl   $0x3d090,0x10(%rsp)
mov    %ebx,%edi
mov    %r12,%rsi
call   1060 <wait_for_input@plt>
test   %rax,%rax
jle    12d0 <init_pnp_com_ati9+0x120>
mov    %ebx,%edi
lea    0x6(%rsp),%rsi
mov    $0x1,%edx
call   1080 <read@plt>
test   %eax,%eax
js     12e0 <init_pnp_com_ati9+0x130>
movzbl 0x6(%rsp),%eax
movslq %r14d,%rcx
lea    0x1(%rcx),%r14
mov    %al,0x20(%rsp,%rcx,1)
movb   $0x0,0x21(%rsp,%rcx,1)
mov    $0x1,%r15b
jmp    12f9 <init_pnp_com_ati9+0x149>
nop
xor    %r15d,%r15d
jmp    12f9 <init_pnp_com_ati9+0x149>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x2ce9(%rip),%rax
mov    (%rax),%rax
mov    $0x1,%r15b
mov    0x2ccc(%rip),%rcx
cmp    (%rcx),%rax
jne    1365 <init_pnp_com_ati9+0x1b5>
xor    %edi,%edi
call   1090 <time@plt>
mov    %eax,%r13d
lea    0x20(%rsp),%rdi
lea    0xcf1(%rip),%rsi
call   10c0 <strstr@plt>
test   %rax,%rax
jne    1331 <init_pnp_com_ati9+0x181>
cmp    $0x6,%r14d
jg     1331 <init_pnp_com_ati9+0x181>
sub    %ebp,%r13d
cmp    $0x5,%r13d
jg     1331 <init_pnp_com_ati9+0x181>
test   %r15b,%r15b
jne    1280 <init_pnp_com_ati9+0xd0>
lea    0xcce(%rip),%rsi
lea    0x20(%rsp),%rdi
call   10c0 <strstr@plt>
cmp    $0x1,%rax
mov    $0x3,%eax
sbb    $0x0,%eax
jmp    136a <init_pnp_com_ati9+0x1ba>
mov    0x2c89(%rip),%rax
or     (%rax),%ebp
or     (%r14),%ebp
mov    %ebx,%edi
mov    %ebp,%esi
call   1030 <set_serial_lines@plt>
mov    $0x1,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
%struct.termios = type { i32 }
@TIOCM_RTS = global i32 0
@TIOCM_DTR = global i32 0
@.str = [6 x i8] c"ATI9\0D\00"
@errno = global i64 0
@EAGAIN = global i64 0
@.str.1 = [2 x i8] c"(\00"
define i32 @init_pnp_com_ati9(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [100 x i8]
%10 = alloca [2 x i8]
%11 = alloca %struct.timeval
%12 = alloca %struct.termios
store i32 %0, i32* %3
%13 = load i32, i32* %3
%14 = call i32 @get_serial_lines(i32 %13)
store i32 %14, i32* %4
%15 = load i32, i32* @TIOCM_RTS
%16 = xor i32 %15, -1
%17 = load i32, i32* %4
%18 = and i32 %17, %16
store i32 %18, i32* %4
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = call i32 @set_serial_lines(i32 %19, i32 %20)
%22 = call i32 @usleep(i32 200000)
%23 = load i32, i32* %3
%24 = call i32 @tcgetattr(i32 %23, %struct.termios* %12)
store i32 %24, i32* %5
%25 = load i32, i32* %5
%26 = icmp slt i32 %25, 0
br i1 %26, label %27, label %36
27: ; preds = %1
%28 = load i32, i32* @TIOCM_DTR
%29 = load i32, i32* @TIOCM_RTS
%30 = or i32 %28, %29
%31 = load i32, i32* %4
%32 = or i32 %31, %30
store i32 %32, i32* %4
%33 = load i32, i32* %3
%34 = load i32, i32* %4
%35 = call i32 @set_serial_lines(i32 %33, i32 %34)
store i32 1, i32* %2
br label %123
36: ; preds = %1
%37 = load i32, i32* %3
%38 = call i32 @setup_serial_port(i32 %37, i32 8, %struct.termios* %12)
store i32 %38, i32* %5
%39 = load i32, i32* %5
%40 = icmp slt i32 %39, 0
br i1 %40, label %41, label %50
41: ; preds = %36
%42 = load i32, i32* @TIOCM_DTR
%43 = load i32, i32* @TIOCM_RTS
%44 = or i32 %42, %43
%45 = load i32, i32* %4
%46 = or i32 %45, %44
store i32 %46, i32* %4
%47 = load i32, i32* %3
%48 = load i32, i32* %4
%49 = call i32 @set_serial_lines(i32 %47, i32 %48)
store i32 1, i32* %2
br label %123
50: ; preds = %36
%51 = load i32, i32* %3
%52 = call i32 @get_serial_lines(i32 %51)
store i32 %52, i32* %4
%53 = load i32, i32* @TIOCM_RTS
%54 = load i32, i32* @TIOCM_DTR
%55 = or i32 %53, %54
%56 = load i32, i32* %4
%57 = or i32 %56, %55
store i32 %57, i32* %4
%58 = load i32, i32* %3
%59 = load i32, i32* %4
%60 = call i32 @set_serial_lines(i32 %58, i32 %59)
%61 = call i32 @usleep(i32 200000)
%62 = load i32, i32* %3
%63 = call i32 @write(i32 %62, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
store i32 0, i32* %6
store i32 0, i32* %7
%64 = call i32 @time(i32* null)
store i32 %64, i32* %8
%65 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%66 = call i32 @memset(i8* %65, i32 0, i32 100)
br label %67
67: ; preds = %116, %50
%68 = load i32, i32* %6
%69 = icmp ne i32 %68, 0
%70 = xor i1 %69, true
br i1 %70, label %71, label %117
71: ; preds = %67
%72 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 1
store i64 0, i64* %72
%73 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 0
store i32 250000, i32* %73
%74 = load i32, i32* %3
%75 = call i64 @wait_for_input(i32 %74, %struct.timeval* %11)
%76 = icmp sgt i64 %75, 0
br i1 %76, label %77, label %100
77: ; preds = %71
%78 = load i32, i32* %3
%79 = getelementptr inbounds [2 x i8], [2 x i8]* %10, i64 0, i64 0
%80 = call i32 @read(i32 %78, i8* %79, i32 1)
store i32 %80, i32* %5
%81 = load i32, i32* %5
%82 = icmp slt i32 %81, 0
br i1 %82, label %83, label %89
83: ; preds = %77
%84 = load i64, i64* @errno
%85 = load i64, i64* @EAGAIN
%86 = icmp ne i64 %84, %85
br i1 %86, label %87, label %88
87: ; preds = %83
store i32 1, i32* %2
br label %123
88: ; preds = %83
br label %99
89: ; preds = %77
%90 = getelementptr inbounds [2 x i8], [2 x i8]* %10, i64 0, i64 0
%91 = load i8, i8* %90
%92 = load i32, i32* %7
%93 = add nsw i32 %92, 1
store i32 %93, i32* %7
%94 = sext i32 %92 to i64
%95 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 %94
store i8 %91, i8* %95
%96 = load i32, i32* %7
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 %97
store i8 0, i8* %98
br label %99
99: ; preds = %89, %88
br label %101
100: ; preds = %71
store i32 1, i32* %6
br label %101
101: ; preds = %100, %99
%102 = call i32 @time(i32* null)
%103 = load i32, i32* %8
%104 = sub nsw i32 %102, %103
%105 = icmp sgt i32 %104, 5
br i1 %105, label %106, label %107
106: ; preds = %101
store i32 1, i32* %6
br label %107
107: ; preds = %106, %101
%108 = load i32, i32* %7
%109 = icmp sgt i32 %108, 6
br i1 %109, label %110, label %111
110: ; preds = %107
store i32 1, i32* %6
br label %111
111: ; preds = %110, %107
%112 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%113 = call i64 @strstr(i8* %112, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%114 = icmp ne i64 %113, 0
br i1 %114, label %115, label %116
115: ; preds = %111
store i32 1, i32* %6
br label %116
116: ; preds = %115, %111
br label %67
117: ; preds = %67
%118 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%119 = call i64 @strstr(i8* %118, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%120 = icmp ne i64 %119, 0
br i1 %120, label %121, label %122
121: ; preds = %117
store i32 3, i32* %2
br label %123
122: ; preds = %117
store i32 2, i32* %2
br label %123
123: ; preds = %122, %121, %87, %41, %27
%124 = load i32, i32* %2
ret i32 %124
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
%struct.termios = type { i32 }
@TIOCM_RTS = global i32 0
@TIOCM_DTR = global i32 0
@.str = [6 x i8] c"ATI9\0D\00"
@errno = global i64 0
@EAGAIN = global i64 0
@.str.1 = [2 x i8] c"(\00"
define i32 @init_pnp_com_ati9(i32 %0) {
%2 = alloca [100 x i8]
%3 = alloca [2 x i8]
%4 = alloca %struct.timeval
%5 = alloca %struct.termios
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%8 = bitcast %struct.timeval* %4 to i8*
%9 = bitcast %struct.termios* %5 to i8*
%10 = tail call i32 @get_serial_lines(i32 %0)
%11 = load i32, i32* @TIOCM_RTS
%12 = xor i32 %11, -1
%13 = and i32 %10, %12
%14 = tail call i32 @set_serial_lines(i32 %0, i32 %13)
%15 = tail call i32 @usleep(i32 200000)
%16 = call i32 @tcgetattr(i32 %0, %struct.termios* %5)
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %1
%19 = load i32, i32* @TIOCM_DTR
%20 = load i32, i32* @TIOCM_RTS
%21 = or i32 %19, %13
%22 = or i32 %21, %20
%23 = call i32 @set_serial_lines(i32 %0, i32 %22)
br label %80
24: ; preds = %1
%25 = call i32 @setup_serial_port(i32 %0, i32 8, %struct.termios* %5)
%26 = icmp slt i32 %25, 0
br i1 %26, label %27, label %33
27: ; preds = %24
%28 = load i32, i32* @TIOCM_DTR
%29 = load i32, i32* @TIOCM_RTS
%30 = or i32 %28, %13
%31 = or i32 %30, %29
%32 = call i32 @set_serial_lines(i32 %0, i32 %31)
br label %80
33: ; preds = %24
%34 = call i32 @get_serial_lines(i32 %0)
%35 = load i32, i32* @TIOCM_RTS
%36 = load i32, i32* @TIOCM_DTR
%37 = or i32 %35, %34
%38 = or i32 %37, %36
%39 = call i32 @set_serial_lines(i32 %0, i32 %38)
%40 = call i32 @usleep(i32 200000)
%41 = call i32 @write(i32 %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%42 = call i32 @time(i32* null)
%43 = call i32 @memset(i8* %6, i32 0, i32 100)
%44 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 1
%45 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
br label %46
46: ; preds = %33, %64
%47 = phi i32 [ 0, %33 ], [ %66, %64 ]
store i64 0, i64* %44
store i32 250000, i32* %45
%48 = call i64 @wait_for_input(i32 %0, %struct.timeval* %4)
%49 = icmp sgt i64 %48, 0
br i1 %49, label %50, label %64
50: ; preds = %46
%51 = call i32 @read(i32 %0, i8* %7, i32 1)
%52 = icmp slt i32 %51, 0
br i1 %52, label %53, label %57
53: ; preds = %50
%54 = load i64, i64* @errno
%55 = load i64, i64* @EAGAIN
%56 = icmp eq i64 %54, %55
br i1 %56, label %64, label %80
57: ; preds = %50
%58 = load i8, i8* %7
%59 = add nsw i32 %47, 1
%60 = sext i32 %47 to i64
%61 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %60
store i8 %58, i8* %61
%62 = sext i32 %59 to i64
%63 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %62
store i8 0, i8* %63
br label %64
64: ; preds = %46, %57, %53
%65 = phi i1 [ false, %46 ], [ true, %57 ], [ true, %53 ]
%66 = phi i32 [ %47, %46 ], [ %59, %57 ], [ %47, %53 ]
%67 = call i32 @time(i32* null)
%68 = sub nsw i32 %67, %42
%69 = icmp slt i32 %68, 6
%70 = icmp slt i32 %66, 7
%71 = select i1 %70, i1 %69, i1 false
%72 = call i64 @strstr(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%73 = icmp eq i64 %72, 0
%74 = and i1 %71, %65
%75 = select i1 %73, i1 %74, i1 false
br i1 %75, label %46, label %76
76: ; preds = %64
%77 = call i64 @strstr(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%78 = icmp eq i64 %77, 0
%79 = select i1 %78, i32 2, i32 3
br label %80
80: ; preds = %53, %76, %27, %18
%81 = phi i32 [ 1, %18 ], [ 1, %27 ], [ %79, %76 ], [ 1, %53 ]
ret i32 %81
}