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

/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ mmsleep(int);
int /*<<< orphan*/ read(int, char *, int);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int strlen(char *);
int /*<<< orphan*/ write(int, char *, int);
int del_port_vlan_h3c(char *setport, int vlanid, int rfd, int wfd) {
  char buf[2048];
  write(wfd, "system-view\r", 12);
  mmsleep(70);
  read(rfd, buf, sizeof(buf));
  memset(buf, 0, sizeof(buf));
  sprintf(buf, "interface %s\r", setport);
  write(wfd, buf, strlen(buf));
  mmsleep(70);
  read(rfd, buf, sizeof(buf));
  memset(buf, 0, sizeof(buf));
  sprintf(buf, "undo port trunk permit vlan %d\r", vlanid);
  write(wfd, buf, strlen(buf));
  mmsleep(250);
  read(rfd, buf, sizeof(buf));
  write(wfd, "quit\r", 5);
  mmsleep(70);
  read(rfd, buf, sizeof(buf));
  write(wfd, "quit\r", 5);
  mmsleep(70);
  read(rfd, buf, sizeof(buf));
}


x86 assembly (clang, -O0):
<del_port_vlan_h3c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x840,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
lea    0xe7e(%rip),%rsi
mov    $0xc,%edx
call   1030 <write@plt>
mov    $0x46,%edi
call   1080 <mmsleep@plt>
mov    -0x18(%rbp),%edi
lea    -0x820(%rbp),%rsi
mov    $0x800,%edx
call   1060 <read@plt>
lea    -0x820(%rbp),%rdi
xor    %esi,%esi
mov    $0x800,%edx
call   1050 <memset@plt>
lea    -0x820(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe3e(%rip),%rsi
mov    $0x0,%al
call   1070 <sprintf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x83c(%rbp)
lea    -0x820(%rbp),%rax
mov    %rax,-0x838(%rbp)
lea    -0x820(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x83c(%rbp),%edi
mov    -0x838(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    $0x46,%edi
call   1080 <mmsleep@plt>
mov    -0x18(%rbp),%edi
lea    -0x820(%rbp),%rsi
mov    $0x800,%edx
call   1060 <read@plt>
lea    -0x820(%rbp),%rdi
xor    %esi,%esi
mov    $0x800,%edx
call   1050 <memset@plt>
lea    -0x820(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xdcc(%rip),%rsi
mov    $0x0,%al
call   1070 <sprintf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x82c(%rbp)
lea    -0x820(%rbp),%rax
mov    %rax,-0x828(%rbp)
lea    -0x820(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x82c(%rbp),%edi
mov    -0x828(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    $0xfa,%edi
call   1080 <mmsleep@plt>
mov    -0x18(%rbp),%edi
lea    -0x820(%rbp),%rsi
mov    $0x800,%edx
call   1060 <read@plt>
mov    -0x1c(%rbp),%edi
lea    0xd86(%rip),%rsi
mov    $0x5,%edx
call   1030 <write@plt>
mov    $0x46,%edi
call   1080 <mmsleep@plt>
mov    -0x18(%rbp),%edi
lea    -0x820(%rbp),%rsi
mov    $0x800,%edx
call   1060 <read@plt>
mov    -0x1c(%rbp),%edi
lea    0xd54(%rip),%rsi
mov    $0x5,%edx
call   1030 <write@plt>
mov    $0x46,%edi
call   1080 <mmsleep@plt>
mov    -0x18(%rbp),%edi
lea    -0x820(%rbp),%rsi
mov    $0x800,%edx
call   1060 <read@plt>
mov    -0x4(%rbp),%eax
add    $0x840,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<del_port_vlan_h3c>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x800,%rsp
mov    %ecx,%ebp
mov    %edx,%r14d
mov    %esi,%r15d
mov    %rdi,%r12
lea    0xe7f(%rip),%rsi
mov    %ecx,%edi
mov    $0xc,%edx
call   1030 <write@plt>
mov    $0x46,%edi
call   1080 <mmsleep@plt>
mov    %rsp,%rbx
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x800,%edx
call   1060 <read@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x800,%edx
call   1050 <memset@plt>
lea    0xe4d(%rip),%rsi
mov    %rbx,%rdi
mov    %r12,%rdx
xor    %eax,%eax
call   1070 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    $0x46,%edi
call   1080 <mmsleep@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x800,%edx
call   1060 <read@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x800,%edx
call   1050 <memset@plt>
lea    0xe0a(%rip),%rsi
mov    %rbx,%rdi
mov    %r15d,%edx
xor    %eax,%eax
call   1070 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    $0xfa,%edi
call   1080 <mmsleep@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x800,%edx
call   1060 <read@plt>
lea    0xde8(%rip),%r15
mov    %ebp,%edi
mov    %r15,%rsi
mov    $0x5,%edx
call   1030 <write@plt>
mov    $0x46,%edi
call   1080 <mmsleep@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x800,%edx
call   1060 <read@plt>
mov    %ebp,%edi
mov    %r15,%rsi
mov    $0x5,%edx
call   1030 <write@plt>
mov    $0x46,%edi
call   1080 <mmsleep@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x800,%edx
call   1060 <read@plt>
add    $0x800,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"system-view\0D\00"
@.str.1 = [14 x i8] c"interface %s\0D\00"
@.str.2 = [32 x i8] c"undo port trunk permit vlan %d\0D\00"
@.str.3 = [6 x i8] c"quit\0D\00"
define i32 @del_port_vlan_h3c(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [2048 x i8]
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%11 = load i32, i32* %9
%12 = call i32 @write(i32 %11, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 12)
%13 = call i32 @mmsleep(i32 70)
%14 = load i32, i32* %8
%15 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%16 = call i32 @read(i32 %14, i8* %15, i32 2048)
%17 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%18 = call i32 @memset(i8* %17, i32 0, i32 2048)
%19 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%20 = load i8*, i8** %6
%21 = call i32 (i8*, i8*, ...) @sprintf(i8* %19, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%22 = load i32, i32* %9
%23 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%24 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%25 = call i32 @strlen(i8* %24)
%26 = call i32 @write(i32 %22, i8* %23, i32 %25)
%27 = call i32 @mmsleep(i32 70)
%28 = load i32, i32* %8
%29 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%30 = call i32 @read(i32 %28, i8* %29, i32 2048)
%31 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%32 = call i32 @memset(i8* %31, i32 0, i32 2048)
%33 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%34 = load i32, i32* %7
%35 = call i32 (i8*, i8*, ...) @sprintf(i8* %33, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %9
%37 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%38 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%39 = call i32 @strlen(i8* %38)
%40 = call i32 @write(i32 %36, i8* %37, i32 %39)
%41 = call i32 @mmsleep(i32 250)
%42 = load i32, i32* %8
%43 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%44 = call i32 @read(i32 %42, i8* %43, i32 2048)
%45 = load i32, i32* %9
%46 = call i32 @write(i32 %45, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 5)
%47 = call i32 @mmsleep(i32 70)
%48 = load i32, i32* %8
%49 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%50 = call i32 @read(i32 %48, i8* %49, i32 2048)
%51 = load i32, i32* %9
%52 = call i32 @write(i32 %51, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 5)
%53 = call i32 @mmsleep(i32 70)
%54 = load i32, i32* %8
%55 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%56 = call i32 @read(i32 %54, i8* %55, i32 2048)
%57 = load i32, i32* %5
ret i32 %57
}

LLVM IR (-O2):
@.str = [13 x i8] c"system-view\0D\00"
@.str.1 = [14 x i8] c"interface %s\0D\00"
@.str.2 = [32 x i8] c"undo port trunk permit vlan %d\0D\00"
@.str.3 = [6 x i8] c"quit\0D\00"
define i32 @del_port_vlan_h3c(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca [2048 x i8]
%6 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%7 = tail call i32 @write(i32 %3, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 12)
%8 = tail call i32 @mmsleep(i32 70)
%9 = call i32 @read(i32 %2, i8* %6, i32 2048)
%10 = call i32 @memset(i8* %6, i32 0, i32 2048)
%11 = call i32 (i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%12 = call i32 @strlen(i8* %6)
%13 = call i32 @write(i32 %3, i8* %6, i32 %12)
%14 = call i32 @mmsleep(i32 70)
%15 = call i32 @read(i32 %2, i8* %6, i32 2048)
%16 = call i32 @memset(i8* %6, i32 0, i32 2048)
%17 = call i32 (i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %1)
%18 = call i32 @strlen(i8* %6)
%19 = call i32 @write(i32 %3, i8* %6, i32 %18)
%20 = call i32 @mmsleep(i32 250)
%21 = call i32 @read(i32 %2, i8* %6, i32 2048)
%22 = call i32 @write(i32 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 5)
%23 = call i32 @mmsleep(i32 70)
%24 = call i32 @read(i32 %2, i8* %6, i32 2048)
%25 = call i32 @write(i32 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 5)
%26 = call i32 @mmsleep(i32 70)
%27 = call i32 @read(i32 %2, i8* %6, i32 2048)
ret i32 undef
}