#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*/ McDevIf_AddPacket(int, unsigned char);
unsigned char McResCtrl_GetRegVal(int, int);
signed long McPacket_AddGPSet(unsigned char bGpio, unsigned long dPadNo) {
  signed long sdRet = ((signed long)0);
  unsigned char bReg;
  bReg = McResCtrl_GetRegVal((0x00001000UL), (31));
  if (dPadNo == ((unsigned long)0)) {
    if (bGpio == (0)) {
      bReg &= (unsigned char)~(0x01);
    } else if (bGpio == (1)) {
      bReg |= (0x01);
    } else {
    }
  } else if (dPadNo == ((unsigned long)1)) {
    if (bGpio == (0)) {
      bReg &= (unsigned char)~(0x02);
    } else if (bGpio == (1)) {
      bReg |= (0x02);
    } else {
    }
  } else {
    sdRet = (-10);
  }
  if (sdRet == ((signed long)0)) {
    McDevIf_AddPacket((0x10000000UL) | (0x00001000UL) | (unsigned long)(31),
                      bReg);
  }
  return sdRet;
}


x86 assembly (clang, -O0):
<McPacket_AddGPSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    $0x1000,%edi
mov    $0x1f,%esi
call   1030 <McResCtrl_GetRegVal@plt>
mov    %al,-0x19(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11a0 <McPacket_AddGPSet+0x80>
movzbl -0x1(%rbp),%eax
cmp    $0x0,%eax
jne    1175 <McPacket_AddGPSet+0x55>
movzbl -0x19(%rbp),%eax
and    $0xfe,%eax
mov    %al,-0x19(%rbp)
jmp    119b <McPacket_AddGPSet+0x7b>
movzbl -0x1(%rbp),%eax
cmp    $0x1,%eax
jne    1191 <McPacket_AddGPSet+0x71>
movzbl -0x19(%rbp),%eax
or     $0x1,%eax
mov    %al,-0x19(%rbp)
jmp    1196 <McPacket_AddGPSet+0x76>
jmp    1196 <McPacket_AddGPSet+0x76>
jmp    119b <McPacket_AddGPSet+0x7b>
jmp    1201 <McPacket_AddGPSet+0xe1>
cmpq   $0x1,-0x10(%rbp)
jne    11f4 <McPacket_AddGPSet+0xd4>
movzbl -0x1(%rbp),%eax
cmp    $0x0,%eax
jne    11c9 <McPacket_AddGPSet+0xa9>
movzbl -0x19(%rbp),%eax
and    $0xfd,%eax
mov    %al,-0x19(%rbp)
jmp    11ef <McPacket_AddGPSet+0xcf>
movzbl -0x1(%rbp),%eax
cmp    $0x1,%eax
jne    11e5 <McPacket_AddGPSet+0xc5>
movzbl -0x19(%rbp),%eax
or     $0x2,%eax
mov    %al,-0x19(%rbp)
jmp    11ea <McPacket_AddGPSet+0xca>
jmp    11ea <McPacket_AddGPSet+0xca>
jmp    11ef <McPacket_AddGPSet+0xcf>
jmp    11fc <McPacket_AddGPSet+0xdc>
movq   $0xfffffffffffffff6,-0x18(%rbp)
ff
jmp    1201 <McPacket_AddGPSet+0xe1>
cmpq   $0x0,-0x18(%rbp)
jne    121a <McPacket_AddGPSet+0xfa>
mov    $0x1000101f,%edi
movzbl -0x19(%rbp),%esi
call   1040 <McDevIf_AddPacket@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<McPacket_AddGPSet>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    $0x1000,%edi
mov    $0x1f,%esi
call   1030 <McResCtrl_GetRegVal@plt>
cmp    $0x1,%rbx
je     1158 <McPacket_AddGPSet+0x38>
mov    $0xfffffffffffffff6,%rcx
test   %rbx,%rbx
jne    117c <McPacket_AddGPSet+0x5c>
cmp    $0x1,%bpl
je     1167 <McPacket_AddGPSet+0x47>
test   %bpl,%bpl
jne    116d <McPacket_AddGPSet+0x4d>
and    $0xfe,%al
jmp    116d <McPacket_AddGPSet+0x4d>
cmp    $0x1,%bpl
je     116b <McPacket_AddGPSet+0x4b>
test   %bpl,%bpl
jne    116d <McPacket_AddGPSet+0x4d>
and    $0xfd,%al
jmp    116d <McPacket_AddGPSet+0x4d>
or     $0x1,%al
jmp    116d <McPacket_AddGPSet+0x4d>
or     $0x2,%al
movzbl %al,%esi
mov    $0x1000101f,%edi
call   1040 <McDevIf_AddPacket@plt>
xor    %ecx,%ecx
mov    %rcx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i64 @McPacket_AddGPSet(i8 zeroext %0, i64 %1) {
%3 = alloca i8
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8
store i8 %0, i8* %3
store i64 %1, i64* %4
store i64 0, i64* %5
%7 = call zeroext i8 @McResCtrl_GetRegVal(i32 4096, i32 31)
store i8 %7, i8* %6
%8 = load i64, i64* %4
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %31
10: ; preds = %2
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %10
%15 = load i8, i8* %6
%16 = zext i8 %15 to i32
%17 = and i32 %16, 254
%18 = trunc i32 %17 to i8
store i8 %18, i8* %6
br label %30
19: ; preds = %10
%20 = load i8, i8* %3
%21 = zext i8 %20 to i32
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %28
23: ; preds = %19
%24 = load i8, i8* %6
%25 = zext i8 %24 to i32
%26 = or i32 %25, 1
%27 = trunc i32 %26 to i8
store i8 %27, i8* %6
br label %29
28: ; preds = %19
br label %29
29: ; preds = %28, %23
br label %30
30: ; preds = %29, %14
br label %57
31: ; preds = %2
%32 = load i64, i64* %4
%33 = icmp eq i64 %32, 1
br i1 %33, label %34, label %55
34: ; preds = %31
%35 = load i8, i8* %3
%36 = zext i8 %35 to i32
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %43
38: ; preds = %34
%39 = load i8, i8* %6
%40 = zext i8 %39 to i32
%41 = and i32 %40, 253
%42 = trunc i32 %41 to i8
store i8 %42, i8* %6
br label %54
43: ; preds = %34
%44 = load i8, i8* %3
%45 = zext i8 %44 to i32
%46 = icmp eq i32 %45, 1
br i1 %46, label %47, label %52
47: ; preds = %43
%48 = load i8, i8* %6
%49 = zext i8 %48 to i32
%50 = or i32 %49, 2
%51 = trunc i32 %50 to i8
store i8 %51, i8* %6
br label %53
52: ; preds = %43
br label %53
53: ; preds = %52, %47
br label %54
54: ; preds = %53, %38
br label %56
55: ; preds = %31
store i64 -10, i64* %5
br label %56
56: ; preds = %55, %54
br label %57
57: ; preds = %56, %30
%58 = load i64, i64* %5
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %63
60: ; preds = %57
%61 = load i8, i8* %6
%62 = call i32 @McDevIf_AddPacket(i32 268439583, i8 zeroext %61)
br label %63
63: ; preds = %60, %57
%64 = load i64, i64* %5
ret i64 %64
}

LLVM IR (-O2):
define i64 @McPacket_AddGPSet(i8 zeroext %0, i64 %1) {
%3 = tail call zeroext i8 @McResCtrl_GetRegVal(i32 4096, i32 31)
switch i64 %1, label %17 [
i64 0, label %4
i64 1, label %9
]
4: ; preds = %2
switch i8 %0, label %14 [
i8 0, label %5
i8 1, label %7
]
5: ; preds = %4
%6 = and i8 %3, -2
br label %14
7: ; preds = %4
%8 = or i8 %3, 1
br label %14
9: ; preds = %2
switch i8 %0, label %14 [
i8 0, label %10
i8 1, label %12
]
10: ; preds = %9
%11 = and i8 %3, -3
br label %14
12: ; preds = %9
%13 = or i8 %3, 2
br label %14
14: ; preds = %12, %10, %5, %7, %4, %9
%15 = phi i8 [ %3, %9 ], [ %3, %4 ], [ %8, %7 ], [ %6, %5 ], [ %11, %10 ], [ %13, %12 ]
%16 = tail call i32 @McDevIf_AddPacket(i32 268439583, i8 zeroext %15)
br label %17
17: ; preds = %2, %14
%18 = phi i64 [ 0, %14 ], [ -10, %2 ]
ret i64 %18
}