#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 */
struct pcibx_device {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ pcibx_write(struct pcibx_device *, int, int);
int /*<<< orphan*/ prsendinfo(char *);
void pcibx_cmd_global_pwr(struct pcibx_device *dev, int on) {
  if (on) {
    prsendinfo("Global Power ON");
    pcibx_write(dev, 0x63, 1);
  } else {
    prsendinfo("Global Power OFF");
    pcibx_write(dev, 0x63, 0);
  }
}


x86 assembly (clang, -O0):
<pcibx_cmd_global_pwr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     115d <pcibx_cmd_global_pwr+0x3d>
lea    0xec0(%rip),%rdi
call   1040 <prsendinfo@plt>
mov    -0x8(%rbp),%rdi
mov    $0x63,%esi
mov    $0x1,%edx
call   1030 <pcibx_write@plt>
jmp    1179 <pcibx_cmd_global_pwr+0x59>
lea    0xeac(%rip),%rdi
call   1040 <prsendinfo@plt>
mov    -0x8(%rbp),%rdi
mov    $0x63,%esi
xor    %edx,%edx
call   1030 <pcibx_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pcibx_cmd_global_pwr>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %ebp,%ebp
test   %esi,%esi
setne  %bpl
lea    0xedb(%rip),%rax
lea    0xec4(%rip),%rdi
cmove  %rax,%rdi
call   1040 <prsendinfo@plt>
mov    %rbx,%rdi
mov    $0x63,%esi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <pcibx_write@plt>

LLVM IR (-O0):
%struct.pcibx_device = type { i32 }
@.str = [16 x i8] c"Global Power ON\00"
@.str.1 = [17 x i8] c"Global Power OFF\00"
define void @pcibx_cmd_global_pwr(%struct.pcibx_device* %0, i32 %1) {
%3 = alloca %struct.pcibx_device*
%4 = alloca i32
store %struct.pcibx_device* %0, %struct.pcibx_device** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = call i32 @prsendinfo(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%9 = load %struct.pcibx_device*, %struct.pcibx_device** %3
%10 = call i32 @pcibx_write(%struct.pcibx_device* %9, i32 99, i32 1)
br label %15
11: ; preds = %2
%12 = call i32 @prsendinfo(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%13 = load %struct.pcibx_device*, %struct.pcibx_device** %3
%14 = call i32 @pcibx_write(%struct.pcibx_device* %13, i32 99, i32 0)
br label %15
15: ; preds = %11, %7
ret void
}

LLVM IR (-O2):
%struct.pcibx_device = type { i32 }
@.str = [16 x i8] c"Global Power ON\00"
@.str.1 = [17 x i8] c"Global Power OFF\00"
define void @pcibx_cmd_global_pwr(%struct.pcibx_device* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = select i1 %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0)
%5 = xor i1 %3, true
%6 = zext i1 %5 to i32
%7 = tail call i32 @prsendinfo(i8* %4)
%8 = tail call i32 @pcibx_write(%struct.pcibx_device* %0, i32 99, i32 %6)
ret void
}