#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*/ hoic_sw(int, int);
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int hdoip_cli_hpd(int fd, int fdr, char **argv, int argc) {
  if (strcmp(argv[0], "on") == 0) {
    hoic_sw(fd, (0x32000008));
  } else if (strcmp(argv[0], "off") == 0) {
    hoic_sw(fd, (0x32000009));
  } else {
    printf("use: hdoip hpd {on|off}\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<hdoip_cli_hpd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xead(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1174 <hdoip_cli_hpd+0x44>
mov    -0x4(%rbp),%edi
mov    $0x32000008,%esi
call   1030 <hoic_sw@plt>
jmp    11b4 <hdoip_cli_hpd+0x84>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe81(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11a3 <hdoip_cli_hpd+0x73>
mov    -0x4(%rbp),%edi
mov    $0x32000009,%esi
call   1030 <hoic_sw@plt>
jmp    11af <hdoip_cli_hpd+0x7f>
lea    0xe5d(%rip),%rdi
call   1040 <printf@plt>
jmp    11b4 <hdoip_cli_hpd+0x84>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hdoip_cli_hpd>:
push   %rbp
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %edi,%ebp
mov    (%rdx),%rdi
lea    0xebe(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     116e <hdoip_cli_hpd+0x3e>
mov    (%rbx),%rdi
lea    0xead(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1177 <hdoip_cli_hpd+0x47>
lea    0xea0(%rip),%rdi
call   1030 <puts@plt>
jmp    1183 <hdoip_cli_hpd+0x53>
mov    %ebp,%edi
mov    $0x32000008,%esi
jmp    117e <hdoip_cli_hpd+0x4e>
mov    %ebp,%edi
mov    $0x32000009,%esi
call   1040 <hoic_sw@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"on\00"
@.str.1 = [4 x i8] c"off\00"
@.str.2 = [25 x i8] c"use: hdoip hpd {on|off}\0A\00"
define i32 @hdoip_cli_hpd(i32 %0, i32 %1, i8** %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
store i32 %3, i32* %8
%9 = load i8**, i8*** %7
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %4
%15 = load i32, i32* %5
%16 = call i32 @hoic_sw(i32 %15, i32 838860808)
br label %29
17: ; preds = %4
%18 = load i8**, i8*** %7
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %17
%24 = load i32, i32* %5
%25 = call i32 @hoic_sw(i32 %24, i32 838860809)
br label %28
26: ; preds = %17
%27 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
br label %28
28: ; preds = %26, %23
br label %29
29: ; preds = %28, %14
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"on\00"
@.str.1 = [4 x i8] c"off\00"
@str = [24 x i8] c"use: hdoip hpd {on|off}\00"
define i32 @hdoip_cli_hpd(i32 %0, i32 %1, i8** nocapture %2, i32 %3) {
%5 = load i8*, i8** %2
%6 = tail call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = tail call i32 @hoic_sw(i32 %0, i32 838860808)
br label %18
10: ; preds = %4
%11 = load i8*, i8** %2
%12 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = tail call i32 @hoic_sw(i32 %0, i32 838860809)
br label %18
16: ; preds = %10
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
br label %18
18: ; preds = %14, %16, %8
ret i32 0
}