#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 atoi(char *);
int /*<<< orphan*/ ethertap(char *, int, int, char *, char *,
                            int /*<<< orphan*/, int /*<<< orphan*/ *);
void ethertap_v0(int argc, char **argv) {
  char *dev = argv[0];
  int fd = atoi(argv[1]);
  char *gate_addr = NULL;
  char *remote_addr = NULL;
  if (argc > 2) {
    gate_addr = argv[2];
    remote_addr = argv[3];
  }
  ethertap(dev, fd, -1, gate_addr, remote_addr, 0, NULL);
}


x86 assembly (clang, -O0):
<ethertap_v0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x1c(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
cmpl   $0x2,-0x4(%rbp)
jle    117c <ethertap_v0+0x5c>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    $0xffffffff,%edx
xor    %r9d,%r9d
xor    %eax,%eax
movq   $0x0,(%rsp)
call   1030 <ethertap@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ethertap_v0>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    (%rsi),%r14
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
cmp    $0x3,%ebp
jl     1148 <ethertap_v0+0x28>
mov    0x10(%rbx),%rcx
mov    0x18(%rbx),%r8
jmp    114d <ethertap_v0+0x2d>
xor    %ecx,%ecx
xor    %r8d,%r8d
movq   $0x0,(%rsp)
mov    %r14,%rdi
mov    %eax,%esi
mov    $0xffffffff,%edx
xor    %r9d,%r9d
call   1030 <ethertap@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @ethertap_v0(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%9 = load i8**, i8*** %4
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
store i8* %11, i8** %5
%12 = load i8**, i8*** %4
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @atoi(i8* %14)
store i32 %15, i32* %6
store i8* null, i8** %7
store i8* null, i8** %8
%16 = load i32, i32* %3
%17 = icmp sgt i32 %16, 2
br i1 %17, label %18, label %25
18: ; preds = %2
%19 = load i8**, i8*** %4
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
store i8* %21, i8** %7
%22 = load i8**, i8*** %4
%23 = getelementptr inbounds i8*, i8** %22, i64 3
%24 = load i8*, i8** %23
store i8* %24, i8** %8
br label %25
25: ; preds = %18, %2
%26 = load i8*, i8** %5
%27 = load i32, i32* %6
%28 = load i8*, i8** %7
%29 = load i8*, i8** %8
%30 = call i32 @ethertap(i8* %26, i32 %27, i32 -1, i8* %28, i8* %29, i32 0, i32* null)
ret void
}

LLVM IR (-O2):
define void @ethertap_v0(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 @atoi(i8* %5)
%7 = icmp sgt i32 %0, 2
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 2
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8*, i8** %1, i64 3
%12 = load i8*, i8** %11
br label %13
13: ; preds = %8, %2
%14 = phi i8* [ %10, %8 ], [ null, %2 ]
%15 = phi i8* [ %12, %8 ], [ null, %2 ]
%16 = tail call i32 @ethertap(i8* %3, i32 %6, i32 -1, i8* %14, i8* %15, i32 0, i32* null)
ret void
}