#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 TIOCM_DTR;
int TIOCM_RTS;
int get_serial_lines(int);
int /*<<< orphan*/ set_serial_lines(int, int);
int /*<<< orphan*/ usleep(int);
int init_pnp_com_seq2(int fd) {
  int modem_lines;
  int rc = 3;
  ;
  ;
  modem_lines = get_serial_lines(fd);
  modem_lines &= ~(TIOCM_DTR | TIOCM_RTS);
  set_serial_lines(fd, modem_lines);
  usleep(200000);
  modem_lines |= (TIOCM_DTR | TIOCM_RTS);
  set_serial_lines(fd, modem_lines);
  usleep(200000);
  return rc;
}


x86 assembly (clang, -O0):
<init_pnp_com_seq2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x3,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <get_serial_lines@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e8c(%rip),%rax
mov    (%rax),%eax
mov    0x2e8b(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <set_serial_lines@plt>
mov    $0x30d40,%edi
call   1050 <usleep@plt>
mov    0x2e5c(%rip),%rax
mov    (%rax),%eax
mov    0x2e5b(%rip),%rcx
or     (%rcx),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <set_serial_lines@plt>
mov    $0x30d40,%edi
call   1050 <usleep@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_pnp_com_seq2>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
call   1040 <get_serial_lines@plt>
mov    0x2e9b(%rip),%r14
mov    0x2e9c(%rip),%r15
mov    (%r15),%ebp
or     (%r14),%ebp
not    %ebp
and    %eax,%ebp
mov    %ebx,%edi
mov    %ebp,%esi
call   1030 <set_serial_lines@plt>
mov    $0x30d40,%edi
call   1050 <usleep@plt>
or     (%r14),%ebp
or     (%r15),%ebp
mov    %ebx,%edi
mov    %ebp,%esi
call   1030 <set_serial_lines@plt>
mov    $0x30d40,%edi
call   1050 <usleep@plt>
mov    $0x3,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@TIOCM_DTR = global i32 0
@TIOCM_RTS = global i32 0
define i32 @init_pnp_com_seq2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 3, i32* %4
%5 = load i32, i32* %2
%6 = call i32 @get_serial_lines(i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* @TIOCM_DTR
%8 = load i32, i32* @TIOCM_RTS
%9 = or i32 %7, %8
%10 = xor i32 %9, -1
%11 = load i32, i32* %3
%12 = and i32 %11, %10
store i32 %12, i32* %3
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = call i32 @set_serial_lines(i32 %13, i32 %14)
%16 = call i32 @usleep(i32 200000)
%17 = load i32, i32* @TIOCM_DTR
%18 = load i32, i32* @TIOCM_RTS
%19 = or i32 %17, %18
%20 = load i32, i32* %3
%21 = or i32 %20, %19
store i32 %21, i32* %3
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = call i32 @set_serial_lines(i32 %22, i32 %23)
%25 = call i32 @usleep(i32 200000)
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
@TIOCM_DTR = global i32 0
@TIOCM_RTS = global i32 0
define i32 @init_pnp_com_seq2(i32 %0) {
%2 = tail call i32 @get_serial_lines(i32 %0)
%3 = load i32, i32* @TIOCM_DTR
%4 = load i32, i32* @TIOCM_RTS
%5 = or i32 %4, %3
%6 = xor i32 %5, -1
%7 = and i32 %2, %6
%8 = tail call i32 @set_serial_lines(i32 %0, i32 %7)
%9 = tail call i32 @usleep(i32 200000)
%10 = load i32, i32* @TIOCM_DTR
%11 = load i32, i32* @TIOCM_RTS
%12 = or i32 %10, %7
%13 = or i32 %12, %11
%14 = tail call i32 @set_serial_lines(i32 %0, i32 %13)
%15 = tail call i32 @usleep(i32 200000)
ret i32 3
}