#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 /*<<< orphan*/ Authentication(char *, char *, char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ getuid();
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  char *UserName;
  char *Password;
  char *DeviceName;
  if (getuid() != 0) {
    fprintf(stderr, "抱歉，运行本客户端程序需要root权限\n");
    fprintf(stderr, "(RedHat/Fedora下使用su命令切换为root)\n");
    fprintf(stderr, "(Ubuntu/Debian下在命令前添加sudo)\n");
    exit(-1);
  }
  if (argc < 3 || argc > 4) {
    fprintf(stderr, "命令行参数错误！\n");
    fprintf(stderr, "正确的调用格式例子如下：\n");
    fprintf(stderr, "    %s username password\n", argv[0]);
    fprintf(stderr, "    %s username password eth0\n", argv[0]);
    fprintf(stderr, "    %s username password eth1\n", argv[0]);
    fprintf(stderr, "(注：若不指明网卡，默认情况下将使用eth0)\n");
    exit(-1);
  } else if (argc == 4) {
    DeviceName = argv[3];
  } else {
    DeviceName = "eth0";
  }
  UserName = argv[1];
  Password = argv[2];
  Authentication(UserName, Password, DeviceName);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getuid@plt>
cmp    $0x0,%rax
je     11b6 <main+0x76>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
lea    0xe89(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
lea    0xea5(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
lea    0xebd(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
cmpl   $0x3,-0x8(%rbp)
jl     11ca <main+0x8a>
cmpl   $0x4,-0x8(%rbp)
jle    1273 <main+0x133>
mov    0x2e0f(%rip),%rax
mov    (%rax),%edi
lea    0xeb2(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2df8(%rip),%rax
mov    (%rax),%edi
lea    0xeb5(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xebd(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2dc3(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xeb9(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2da5(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xeba(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2d87(%rip),%rax
mov    (%rax),%edi
lea    0xec2(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
cmpl   $0x4,-0x8(%rbp)
jne    128e <main+0x14e>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    1299 <main+0x159>
lea    0xeca(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    129e <main+0x15e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1050 <Authentication@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <getuid@plt>
test   %rax,%rax
jne    1186 <main+0x46>
lea    -0x5(%rbx),%eax
cmp    $0xfffffffd,%eax
jbe    11b8 <main+0x78>
cmp    $0x4,%ebx
jne    1168 <main+0x28>
mov    0x18(%r14),%rdx
jmp    116f <main+0x2f>
lea    0xff0(%rip),%rdx
mov    0x8(%r14),%rdi
mov    0x10(%r14),%rsi
call   1050 <Authentication@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e53(%rip),%rbx
mov    (%rbx),%edi
lea    0xe6a(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe8d(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xeac(%rip),%rsi
jmp    1221 <main+0xe1>
mov    0x2e21(%rip),%rbx
mov    (%rbx),%edi
lea    0xec4(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xece(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%rbx),%edi
mov    (%r14),%rdx
lea    0xee1(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%rbx),%edi
mov    (%r14),%rdx
lea    0xee8(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%rbx),%edi
mov    (%r14),%rdx
lea    0xef4(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf03(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [51 x i8] c"\E6\8A\B1\E6\AD\89\EF\BC\8C\E8\BF\90\E8\A1\8C\E6\9C\AC\E5\AE\A2\E6\88\B7\E7\AB\AF\E7\A8\8B\E5\BA\8F\E9\9C\80\E8\A6\81root\E6\9D\83\E9\99\90\0A\00"
@.str.1 = [47 x i8] c"(RedHat/Fedora\E4\B8\8B\E4\BD\BF\E7\94\A8su\E5\91\BD\E4\BB\A4\E5\88\87\E6\8D\A2\E4\B8\BAroot)\0A\00"
@.str.2 = [42 x i8] c"(Ubuntu/Debian\E4\B8\8B\E5\9C\A8\E5\91\BD\E4\BB\A4\E5\89\8D\E6\B7\BB\E5\8A\A0sudo)\0A\00"
@.str.3 = [26 x i8] c"\E5\91\BD\E4\BB\A4\E8\A1\8C\E5\8F\82\E6\95\B0\E9\94\99\E8\AF\AF\EF\BC\81\0A\00"
@.str.4 = [38 x i8] c"\E6\AD\A3\E7\A1\AE\E7\9A\84\E8\B0\83\E7\94\A8\E6\A0\BC\E5\BC\8F\E4\BE\8B\E5\AD\90\E5\A6\82\E4\B8\8B\EF\BC\9A\0A\00"
@.str.5 = [26 x i8] c" %s username password\0A\00"
@.str.6 = [31 x i8] c" %s username password eth0\0A\00"
@.str.7 = [31 x i8] c" %s username password eth1\0A\00"
@.str.8 = [59 x i8] c"(\E6\B3\A8\EF\BC\9A\E8\8B\A5\E4\B8\8D\E6\8C\87\E6\98\8E\E7\BD\91\E5\8D\A1\EF\BC\8C\E9\BB\98\E8\AE\A4\E6\83\85\E5\86\B5\E4\B8\8B\E5\B0\86\E4\BD\BF\E7\94\A8eth0)\0A\00"
@.str.9 = [5 x i8] c"eth0\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i64 (...) @getuid()
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %19
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* @stderr
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 @exit(i32 -1)
unreachable
19: ; preds = %2
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 3
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = load i32, i32* %4
%24 = icmp sgt i32 %23, 4
br i1 %24, label %25, label %48
25: ; preds = %22, %19
%26 = load i32, i32* @stderr
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%28 = load i32, i32* @stderr
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
%30 = load i32, i32* @stderr
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 0
%33 = load i8*, i8** %32
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* %33)
%35 = load i32, i32* @stderr
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 0
%38 = load i8*, i8** %37
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i8* %38)
%40 = load i32, i32* @stderr
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 0
%43 = load i8*, i8** %42
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i8* %43)
%45 = load i32, i32* @stderr
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.8, i64 0, i64 0))
%47 = call i32 @exit(i32 -1)
unreachable
48: ; preds = %22
%49 = load i32, i32* %4
%50 = icmp eq i32 %49, 4
br i1 %50, label %51, label %55
51: ; preds = %48
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 3
%54 = load i8*, i8** %53
store i8* %54, i8** %8
br label %56
55: ; preds = %48
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8** %8
br label %56
56: ; preds = %55, %51
br label %57
57: ; preds = %56
%58 = load i8**, i8*** %5
%59 = getelementptr inbounds i8*, i8** %58, i64 1
%60 = load i8*, i8** %59
store i8* %60, i8** %6
%61 = load i8**, i8*** %5
%62 = getelementptr inbounds i8*, i8** %61, i64 2
%63 = load i8*, i8** %62
store i8* %63, i8** %7
%64 = load i8*, i8** %6
%65 = load i8*, i8** %7
%66 = load i8*, i8** %8
%67 = call i32 @Authentication(i8* %64, i8* %65, i8* %66)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [51 x i8] c"\E6\8A\B1\E6\AD\89\EF\BC\8C\E8\BF\90\E8\A1\8C\E6\9C\AC\E5\AE\A2\E6\88\B7\E7\AB\AF\E7\A8\8B\E5\BA\8F\E9\9C\80\E8\A6\81root\E6\9D\83\E9\99\90\0A\00"
@.str.1 = [47 x i8] c"(RedHat/Fedora\E4\B8\8B\E4\BD\BF\E7\94\A8su\E5\91\BD\E4\BB\A4\E5\88\87\E6\8D\A2\E4\B8\BAroot)\0A\00"
@.str.2 = [42 x i8] c"(Ubuntu/Debian\E4\B8\8B\E5\9C\A8\E5\91\BD\E4\BB\A4\E5\89\8D\E6\B7\BB\E5\8A\A0sudo)\0A\00"
@.str.3 = [26 x i8] c"\E5\91\BD\E4\BB\A4\E8\A1\8C\E5\8F\82\E6\95\B0\E9\94\99\E8\AF\AF\EF\BC\81\0A\00"
@.str.4 = [38 x i8] c"\E6\AD\A3\E7\A1\AE\E7\9A\84\E8\B0\83\E7\94\A8\E6\A0\BC\E5\BC\8F\E4\BE\8B\E5\AD\90\E5\A6\82\E4\B8\8B\EF\BC\9A\0A\00"
@.str.5 = [26 x i8] c" %s username password\0A\00"
@.str.6 = [31 x i8] c" %s username password eth0\0A\00"
@.str.7 = [31 x i8] c" %s username password eth1\0A\00"
@.str.8 = [59 x i8] c"(\E6\B3\A8\EF\BC\9A\E8\8B\A5\E4\B8\8D\E6\8C\87\E6\98\8E\E7\BD\91\E5\8D\A1\EF\BC\8C\E9\BB\98\E8\AE\A4\E6\83\85\E5\86\B5\E4\B8\8B\E5\B0\86\E4\BD\BF\E7\94\A8eth0)\0A\00"
@.str.9 = [5 x i8] c"eth0\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i64 (...) @getuid()
%4 = icmp eq i64 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @stderr
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* @stderr
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
%12 = tail call i32 @exit(i32 -1)
unreachable
13: ; preds = %2
%14 = add i32 %0, -5
%15 = icmp ult i32 %14, -2
br i1 %15, label %16, label %33
16: ; preds = %13
%17 = load i32, i32* @stderr
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%19 = load i32, i32* @stderr
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
%21 = load i32, i32* @stderr
%22 = load i8*, i8** %1
%23 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* %22)
%24 = load i32, i32* @stderr
%25 = load i8*, i8** %1
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i8* %25)
%27 = load i32, i32* @stderr
%28 = load i8*, i8** %1
%29 = tail call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i8* %28)
%30 = load i32, i32* @stderr
%31 = tail call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.8, i64 0, i64 0))
%32 = tail call i32 @exit(i32 -1)
unreachable
33: ; preds = %13
%34 = icmp eq i32 %0, 4
br i1 %34, label %35, label %38
35: ; preds = %33
%36 = getelementptr inbounds i8*, i8** %1, i64 3
%37 = load i8*, i8** %36
br label %38
38: ; preds = %33, %35
%39 = phi i8* [ %37, %35 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), %33 ]
%40 = getelementptr inbounds i8*, i8** %1, i64 1
%41 = load i8*, i8** %40
%42 = getelementptr inbounds i8*, i8** %1, i64 2
%43 = load i8*, i8** %42
%44 = tail call i32 @Authentication(i8* %41, i8* %43, i8* %39)
ret i32 0
}