#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 */
unsigned long ADCCurrentGet();
unsigned long ADCTemperatureGet();
int ADCVBusGet();
int CANErrorRegGet();
int CANStatusRegGet();
int /*<<< orphan*/ CANStatusWriteLECNoEvent();
unsigned char ControllerCommunicationFaultsGet();
unsigned char ControllerControlModeGet();
unsigned char ControllerCurrentFaultsGet();
int /*<<< orphan*/ ControllerFaultCountReset(unsigned char);
unsigned long ControllerFaultsActive();
unsigned char ControllerGateFaultsGet();
unsigned long ControllerPositionGet();
unsigned long ControllerPowerStatus();
int /*<<< orphan*/ ControllerPowerStatusClear();
unsigned long ControllerSpeedGet();
unsigned long ControllerStickyFaultsActive(int);
unsigned char ControllerTemperatureFaultsGet();
unsigned char ControllerVBusFaultsGet();
int ControllerVoltageGet();
unsigned long LimitStatusGet(int);
int /*<<< orphan*/ MessageSendResponse(unsigned long, unsigned char *, int);
unsigned long MessageStatusHandler(unsigned long ulID, unsigned char *pucData,
                                   unsigned long ulMsgLen) {
  unsigned char pucMessage[8], ucValue;
  unsigned long ulValue, ulAck;
  ulAck = 0;
  switch (ulID & (~0x0000003f)) {
  case ((0x00020000 | 0x02000000 | 0x00001400) | (0 << 6)): {
    ulValue = ControllerVoltageGet();
    MessageSendResponse(ulID, (unsigned char *)&ulValue, 2);
    ulAck = 1;
    break;
  }
  case ((0x00020000 | 0x02000000 | 0x00001400) | (1 << 6)): {
    ulValue = ADCVBusGet();
    MessageSendResponse(ulID, (unsigned char *)&ulValue, 2);
    ulAck = 1;
    break;
  }
  case ((0x00020000 | 0x02000000 | 0x00001400) | (7 << 6)): {
    ulValue = ControllerFaultsActive();
    MessageSendResponse(ulID, (unsigned char *)&ulValue, 2);
    ulAck = 1;
    break;
  }
  case ((0x00020000 | 0x02000000 | 0x00001400) | (2 << 6)): {
    ulValue = ADCCurrentGet();
    MessageSendResponse(ulID, (unsigned char *)&ulValue, 2);
    ulAck = 1;
    break;
  }
  case ((0x00020000 | 0x02000000 | 0x00001400) | (3 << 6)): {
    ulValue = ADCTemperatureGet();
    MessageSendResponse(ulID, (unsigned char *)&ulValue, 2);
    ulAck = 1;
    break;
  }
  case ((0x00020000 | 0x02000000 | 0x00001400) | (4 << 6)): {
    ulValue = ControllerPositionGet();
    MessageSendResponse(ulID, (unsigned char *)&ulValue, 4);
    ulAck = 1;
    break;
  }
  case ((0x00020000 | 0x02000000 | 0x00001400) | (5 << 6)): {
    ulValue = ControllerSpeedGet();
    MessageSendResponse(ulID, (unsigned char *)&ulValue, 4);
    ulAck = 1;
    break;
  }
  case ((0x00020000 | 0x02000000 | 0x00001400) | (6 << 6)): {
    ulValue = LimitStatusGet(1);
    MessageSendResponse(ulID, (unsigned char *)&ulValue, 1);
    ulAck = 1;
    break;
  }
  case ((0x00020000 | 0x02000000 | 0x00001400) | (8 << 6)): {
    if (ulMsgLen == 0) {
      ulValue = ControllerPowerStatus();
      MessageSendResponse(ulID, (unsigned char *)&ulValue, 1);
    } else if (ulMsgLen == 1) {
      if (pucData[0]) {
        ControllerPowerStatusClear();
      }
    }
    ulAck = 1;
    break;
  }
  case ((0x00020000 | 0x02000000 | 0x00001400) | (9 << 6)): {
    ucValue = ControllerControlModeGet();
    MessageSendResponse(ulID, &ucValue, 1);
    ulAck = 1;
    break;
  }
  case ((0x00020000 | 0x02000000 | 0x00001400) | (10 << 6)): {
    ulValue = (ControllerVoltageGet() * ADCVBusGet()) / 32768;
    MessageSendResponse(ulID, (unsigned char *)&ulValue, 2);
    ulAck = 1;
    break;
  }
  case ((0x00020000 | 0x02000000 | 0x00001400) | (11 << 6)): {
    ulValue = ControllerStickyFaultsActive(1);
    MessageSendResponse(ulID, (unsigned char *)&ulValue, 2);
    ulAck = 1;
    break;
  }
  case ((0x00020000 | 0x02000000 | 0x00001400) | (12 << 6)): {
    pucMessage[0] = ControllerCurrentFaultsGet();
    pucMessage[1] = ControllerTemperatureFaultsGet();
    pucMessage[2] = ControllerVBusFaultsGet();
    pucMessage[3] = ControllerGateFaultsGet();
    pucMessage[4] = ControllerCommunicationFaultsGet();
    pucMessage[5] = CANStatusRegGet() & 0x000000ff;
    *(unsigned short *)(pucMessage + 6) = CANErrorRegGet() & 0x0000ffff;
    if (ulMsgLen == 1) {
      ControllerFaultCountReset(pucData[0]);
      if (pucData[0] & 0x20) {
        CANStatusWriteLECNoEvent();
      }
    }
    MessageSendResponse(ulID, pucMessage, 8);
    ulAck = 1;
    break;
  }
  default: {
    break;
  }
  }
  return (ulAck);
}


x86 assembly (clang, -O0):
<MessageStatusHandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
and    $0xffffffffffffffc0,%rax
mov    %rax,-0x40(%rbp)
sub    $0x2021400,%rax
je     1395 <MessageStatusHandler+0x135>
jmp    1299 <MessageStatusHandler+0x39>
mov    -0x40(%rbp),%rax
sub    $0x2021440,%rax
je     13c1 <MessageStatusHandler+0x161>
jmp    12ae <MessageStatusHandler+0x4e>
mov    -0x40(%rbp),%rax
sub    $0x2021480,%rax
je     1417 <MessageStatusHandler+0x1b7>
jmp    12c3 <MessageStatusHandler+0x63>
mov    -0x40(%rbp),%rax
sub    $0x20214c0,%rax
je     1441 <MessageStatusHandler+0x1e1>
jmp    12d8 <MessageStatusHandler+0x78>
mov    -0x40(%rbp),%rax
sub    $0x2021500,%rax
je     146b <MessageStatusHandler+0x20b>
jmp    12ed <MessageStatusHandler+0x8d>
mov    -0x40(%rbp),%rax
sub    $0x2021540,%rax
je     1495 <MessageStatusHandler+0x235>
jmp    1302 <MessageStatusHandler+0xa2>
mov    -0x40(%rbp),%rax
sub    $0x2021580,%rax
je     14bf <MessageStatusHandler+0x25f>
jmp    1317 <MessageStatusHandler+0xb7>
mov    -0x40(%rbp),%rax
sub    $0x20215c0,%rax
je     13ed <MessageStatusHandler+0x18d>
jmp    132c <MessageStatusHandler+0xcc>
mov    -0x40(%rbp),%rax
sub    $0x2021600,%rax
je     14ec <MessageStatusHandler+0x28c>
jmp    1341 <MessageStatusHandler+0xe1>
mov    -0x40(%rbp),%rax
sub    $0x2021640,%rax
je     154f <MessageStatusHandler+0x2ef>
jmp    1356 <MessageStatusHandler+0xf6>
mov    -0x40(%rbp),%rax
sub    $0x2021680,%rax
je     1578 <MessageStatusHandler+0x318>
jmp    136b <MessageStatusHandler+0x10b>
mov    -0x40(%rbp),%rax
sub    $0x20216c0,%rax
je     15be <MessageStatusHandler+0x35e>
jmp    1380 <MessageStatusHandler+0x120>
mov    -0x40(%rbp),%rax
sub    $0x2021700,%rax
je     15eb <MessageStatusHandler+0x38b>
jmp    1691 <MessageStatusHandler+0x431>
mov    $0x0,%al
call   10b0 <ControllerVoltageGet@plt>
cltq
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x2,%edx
call   1040 <MessageSendResponse@plt>
movq   $0x1,-0x38(%rbp)
jmp    1696 <MessageStatusHandler+0x436>
mov    $0x0,%al
call   1110 <ADCVBusGet@plt>
cltq
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x2,%edx
call   1040 <MessageSendResponse@plt>
movq   $0x1,-0x38(%rbp)
jmp    1696 <MessageStatusHandler+0x436>
mov    $0x0,%al
call   1030 <ControllerFaultsActive@plt>
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x2,%edx
call   1040 <MessageSendResponse@plt>
movq   $0x1,-0x38(%rbp)
jmp    1696 <MessageStatusHandler+0x436>
mov    $0x0,%al
call   10e0 <ADCCurrentGet@plt>
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x2,%edx
call   1040 <MessageSendResponse@plt>
movq   $0x1,-0x38(%rbp)
jmp    1696 <MessageStatusHandler+0x436>
mov    $0x0,%al
call   10c0 <ADCTemperatureGet@plt>
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x2,%edx
call   1040 <MessageSendResponse@plt>
movq   $0x1,-0x38(%rbp)
jmp    1696 <MessageStatusHandler+0x436>
mov    $0x0,%al
call   1050 <ControllerPositionGet@plt>
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x4,%edx
call   1040 <MessageSendResponse@plt>
movq   $0x1,-0x38(%rbp)
jmp    1696 <MessageStatusHandler+0x436>
mov    $0x0,%al
call   1130 <ControllerSpeedGet@plt>
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x4,%edx
call   1040 <MessageSendResponse@plt>
movq   $0x1,-0x38(%rbp)
jmp    1696 <MessageStatusHandler+0x436>
mov    $0x1,%edi
call   1140 <LimitStatusGet@plt>
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x1,%edx
call   1040 <MessageSendResponse@plt>
movq   $0x1,-0x38(%rbp)
jmp    1696 <MessageStatusHandler+0x436>
cmpq   $0x0,-0x18(%rbp)
jne    1519 <MessageStatusHandler+0x2b9>
mov    $0x0,%al
call   1170 <ControllerPowerStatus@plt>
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x1,%edx
call   1040 <MessageSendResponse@plt>
jmp    1542 <MessageStatusHandler+0x2e2>
cmpq   $0x1,-0x18(%rbp)
jne    153d <MessageStatusHandler+0x2dd>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1538 <MessageStatusHandler+0x2d8>
mov    $0x0,%al
call   10f0 <ControllerPowerStatusClear@plt>
jmp    153d <MessageStatusHandler+0x2dd>
jmp    1542 <MessageStatusHandler+0x2e2>
movq   $0x1,-0x38(%rbp)
jmp    1696 <MessageStatusHandler+0x436>
mov    $0x0,%al
call   10a0 <ControllerControlModeGet@plt>
mov    %al,-0x21(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x21(%rbp),%rsi
mov    $0x1,%edx
call   1040 <MessageSendResponse@plt>
movq   $0x1,-0x38(%rbp)
jmp    1696 <MessageStatusHandler+0x436>
mov    $0x0,%al
call   10b0 <ControllerVoltageGet@plt>
mov    %eax,-0x44(%rbp)
mov    $0x0,%al
call   1110 <ADCVBusGet@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
imul   %ecx,%eax
mov    $0x8000,%ecx
cltd
idiv   %ecx
cltq
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x2,%edx
call   1040 <MessageSendResponse@plt>
movq   $0x1,-0x38(%rbp)
jmp    1696 <MessageStatusHandler+0x436>
mov    $0x1,%edi
call   10d0 <ControllerStickyFaultsActive@plt>
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x2,%edx
call   1040 <MessageSendResponse@plt>
movq   $0x1,-0x38(%rbp)
jmp    1696 <MessageStatusHandler+0x436>
mov    $0x0,%al
call   1160 <ControllerCurrentFaultsGet@plt>
mov    %al,-0x20(%rbp)
mov    $0x0,%al
call   1150 <ControllerTemperatureFaultsGet@plt>
mov    %al,-0x1f(%rbp)
mov    $0x0,%al
call   1120 <ControllerVBusFaultsGet@plt>
mov    %al,-0x1e(%rbp)
mov    $0x0,%al
call   1070 <ControllerGateFaultsGet@plt>
mov    %al,-0x1d(%rbp)
mov    $0x0,%al
call   1100 <ControllerCommunicationFaultsGet@plt>
mov    %al,-0x1c(%rbp)
mov    $0x0,%al
call   1180 <CANStatusRegGet@plt>
and    $0xff,%eax
mov    %al,-0x1b(%rbp)
mov    $0x0,%al
call   1080 <CANErrorRegGet@plt>
and    $0xffff,%eax
mov    %ax,-0x1a(%rbp)
cmpq   $0x1,-0x18(%rbp)
jne    1672 <MessageStatusHandler+0x412>
mov    -0x10(%rbp),%rax
movzbl (%rax),%edi
call   1060 <ControllerFaultCountReset@plt>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     166d <MessageStatusHandler+0x40d>
mov    $0x0,%al
call   1090 <CANStatusWriteLECNoEvent@plt>
jmp    1672 <MessageStatusHandler+0x412>
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x8,%edx
call   1040 <MessageSendResponse@plt>
movq   $0x1,-0x38(%rbp)
jmp    1696 <MessageStatusHandler+0x436>
jmp    1696 <MessageStatusHandler+0x436>
mov    -0x38(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MessageStatusHandler>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    -0x2021400(%rdi),%rax
shr    $0x6,%rax
cmp    $0xc,%rax
ja     129b <MessageStatusHandler+0x3b>
mov    %rdx,%r12
mov    %rsi,%r15
mov    %rdi,%r14
lea    0xd77(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   10b0 <ControllerVoltageGet@plt>
jmp    12a9 <MessageStatusHandler+0x49>
xor    %ebx,%ebx
jmp    1396 <MessageStatusHandler+0x136>
xor    %eax,%eax
call   1110 <ADCVBusGet@plt>
cltq
jmp    137d <MessageStatusHandler+0x11d>
xor    %eax,%eax
call   10e0 <ADCCurrentGet@plt>
jmp    137d <MessageStatusHandler+0x11d>
xor    %eax,%eax
call   10c0 <ADCTemperatureGet@plt>
jmp    137d <MessageStatusHandler+0x11d>
xor    %eax,%eax
call   1050 <ControllerPositionGet@plt>
jmp    12d8 <MessageStatusHandler+0x78>
xor    %eax,%eax
call   1130 <ControllerSpeedGet@plt>
mov    %rax,(%rsp)
mov    %rsp,%rsi
mov    %r14,%rdi
mov    $0x4,%edx
jmp    138c <MessageStatusHandler+0x12c>
mov    $0x1,%edi
call   1140 <LimitStatusGet@plt>
mov    %rax,(%rsp)
jmp    1340 <MessageStatusHandler+0xe0>
xor    %eax,%eax
call   1030 <ControllerFaultsActive@plt>
jmp    137d <MessageStatusHandler+0x11d>
mov    $0x1,%ebx
cmp    $0x1,%r12
je     141e <MessageStatusHandler+0x1be>
test   %r12,%r12
jne    1396 <MessageStatusHandler+0x136>
xor    %eax,%eax
call   1170 <ControllerPowerStatus@plt>
mov    %rax,(%rsp)
mov    %rsp,%rsi
mov    %r14,%rdi
mov    $0x1,%edx
call   1040 <MessageSendResponse@plt>
jmp    1396 <MessageStatusHandler+0x136>
xor    %eax,%eax
call   10a0 <ControllerControlModeGet@plt>
mov    %al,(%rsp)
mov    %rsp,%rsi
mov    %r14,%rdi
mov    $0x1,%edx
jmp    138c <MessageStatusHandler+0x12c>
xor    %eax,%eax
call   10b0 <ControllerVoltageGet@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1110 <ADCVBusGet@plt>
imul   %ebx,%eax
lea    0x7fff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
sar    $0xf,%ecx
movslq %ecx,%rax
jmp    137d <MessageStatusHandler+0x11d>
mov    $0x1,%edi
call   10d0 <ControllerStickyFaultsActive@plt>
mov    %rax,(%rsp)
mov    %rsp,%rsi
mov    %r14,%rdi
mov    $0x2,%edx
call   1040 <MessageSendResponse@plt>
mov    $0x1,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
xor    %eax,%eax
call   1160 <ControllerCurrentFaultsGet@plt>
mov    %al,(%rsp)
xor    %eax,%eax
call   1150 <ControllerTemperatureFaultsGet@plt>
mov    %al,0x1(%rsp)
xor    %eax,%eax
call   1120 <ControllerVBusFaultsGet@plt>
mov    %al,0x2(%rsp)
xor    %eax,%eax
call   1070 <ControllerGateFaultsGet@plt>
mov    %al,0x3(%rsp)
xor    %eax,%eax
call   1100 <ControllerCommunicationFaultsGet@plt>
mov    %al,0x4(%rsp)
xor    %eax,%eax
call   1180 <CANStatusRegGet@plt>
mov    %al,0x5(%rsp)
xor    %eax,%eax
call   1080 <CANErrorRegGet@plt>
mov    %ax,0x6(%rsp)
cmp    $0x1,%r12
jne    140e <MessageStatusHandler+0x1ae>
movzbl (%r15),%edi
call   1060 <ControllerFaultCountReset@plt>
testb  $0x20,(%r15)
je     140e <MessageStatusHandler+0x1ae>
xor    %eax,%eax
call   1090 <CANStatusWriteLECNoEvent@plt>
mov    %rsp,%rsi
mov    %r14,%rdi
mov    $0x8,%edx
jmp    138c <MessageStatusHandler+0x12c>
cmpb   $0x0,(%r15)
je     1396 <MessageStatusHandler+0x136>
xor    %eax,%eax
call   10f0 <ControllerPowerStatusClear@plt>
jmp    1396 <MessageStatusHandler+0x136>

LLVM IR (-O0):
define i64 @MessageStatusHandler(i64 %0, i8* %1, i64 %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i64
%7 = alloca [8 x i8]
%8 = alloca i8
%9 = alloca i64
%10 = alloca i64
store i64 %0, i64* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
store i64 0, i64* %10
%11 = load i64, i64* %4
%12 = and i64 %11, -64
switch i64 %12, label %135 [
i64 33690624, label %13
i64 33690688, label %19
i64 33691072, label %25
i64 33690752, label %30
i64 33690816, label %35
i64 33690880, label %40
i64 33690944, label %45
i64 33691008, label %50
i64 33691136, label %55
i64 33691200, label %76
i64 33691264, label %80
i64 33691328, label %89
i64 33691392, label %94
]
13: ; preds = %3
%14 = call i32 (...) @ControllerVoltageGet()
%15 = sext i32 %14 to i64
store i64 %15, i64* %9
%16 = load i64, i64* %4
%17 = bitcast i64* %9 to i8*
%18 = call i32 @MessageSendResponse(i64 %16, i8* %17, i32 2)
store i64 1, i64* %10
br label %136
19: ; preds = %3
%20 = call i32 (...) @ADCVBusGet()
%21 = sext i32 %20 to i64
store i64 %21, i64* %9
%22 = load i64, i64* %4
%23 = bitcast i64* %9 to i8*
%24 = call i32 @MessageSendResponse(i64 %22, i8* %23, i32 2)
store i64 1, i64* %10
br label %136
25: ; preds = %3
%26 = call i64 (...) @ControllerFaultsActive()
store i64 %26, i64* %9
%27 = load i64, i64* %4
%28 = bitcast i64* %9 to i8*
%29 = call i32 @MessageSendResponse(i64 %27, i8* %28, i32 2)
store i64 1, i64* %10
br label %136
30: ; preds = %3
%31 = call i64 (...) @ADCCurrentGet()
store i64 %31, i64* %9
%32 = load i64, i64* %4
%33 = bitcast i64* %9 to i8*
%34 = call i32 @MessageSendResponse(i64 %32, i8* %33, i32 2)
store i64 1, i64* %10
br label %136
35: ; preds = %3
%36 = call i64 (...) @ADCTemperatureGet()
store i64 %36, i64* %9
%37 = load i64, i64* %4
%38 = bitcast i64* %9 to i8*
%39 = call i32 @MessageSendResponse(i64 %37, i8* %38, i32 2)
store i64 1, i64* %10
br label %136
40: ; preds = %3
%41 = call i64 (...) @ControllerPositionGet()
store i64 %41, i64* %9
%42 = load i64, i64* %4
%43 = bitcast i64* %9 to i8*
%44 = call i32 @MessageSendResponse(i64 %42, i8* %43, i32 4)
store i64 1, i64* %10
br label %136
45: ; preds = %3
%46 = call i64 (...) @ControllerSpeedGet()
store i64 %46, i64* %9
%47 = load i64, i64* %4
%48 = bitcast i64* %9 to i8*
%49 = call i32 @MessageSendResponse(i64 %47, i8* %48, i32 4)
store i64 1, i64* %10
br label %136
50: ; preds = %3
%51 = call i64 @LimitStatusGet(i32 1)
store i64 %51, i64* %9
%52 = load i64, i64* %4
%53 = bitcast i64* %9 to i8*
%54 = call i32 @MessageSendResponse(i64 %52, i8* %53, i32 1)
store i64 1, i64* %10
br label %136
55: ; preds = %3
%56 = load i64, i64* %6
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %63
58: ; preds = %55
%59 = call i64 (...) @ControllerPowerStatus()
store i64 %59, i64* %9
%60 = load i64, i64* %4
%61 = bitcast i64* %9 to i8*
%62 = call i32 @MessageSendResponse(i64 %60, i8* %61, i32 1)
br label %75
63: ; preds = %55
%64 = load i64, i64* %6
%65 = icmp eq i64 %64, 1
br i1 %65, label %66, label %74
66: ; preds = %63
%67 = load i8*, i8** %5
%68 = getelementptr inbounds i8, i8* %67, i64 0
%69 = load i8, i8* %68
%70 = icmp ne i8 %69, 0
br i1 %70, label %71, label %73
71: ; preds = %66
%72 = call i32 (...) @ControllerPowerStatusClear()
br label %73
73: ; preds = %71, %66
br label %74
74: ; preds = %73, %63
br label %75
75: ; preds = %74, %58
store i64 1, i64* %10
br label %136
76: ; preds = %3
%77 = call zeroext i8 (...) @ControllerControlModeGet()
store i8 %77, i8* %8
%78 = load i64, i64* %4
%79 = call i32 @MessageSendResponse(i64 %78, i8* %8, i32 1)
store i64 1, i64* %10
br label %136
80: ; preds = %3
%81 = call i32 (...) @ControllerVoltageGet()
%82 = call i32 (...) @ADCVBusGet()
%83 = mul nsw i32 %81, %82
%84 = sdiv i32 %83, 32768
%85 = sext i32 %84 to i64
store i64 %85, i64* %9
%86 = load i64, i64* %4
%87 = bitcast i64* %9 to i8*
%88 = call i32 @MessageSendResponse(i64 %86, i8* %87, i32 2)
store i64 1, i64* %10
br label %136
89: ; preds = %3
%90 = call i64 @ControllerStickyFaultsActive(i32 1)
store i64 %90, i64* %9
%91 = load i64, i64* %4
%92 = bitcast i64* %9 to i8*
%93 = call i32 @MessageSendResponse(i64 %91, i8* %92, i32 2)
store i64 1, i64* %10
br label %136
94: ; preds = %3
%95 = call zeroext i8 (...) @ControllerCurrentFaultsGet()
%96 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 0
store i8 %95, i8* %96
%97 = call zeroext i8 (...) @ControllerTemperatureFaultsGet()
%98 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 1
store i8 %97, i8* %98
%99 = call zeroext i8 (...) @ControllerVBusFaultsGet()
%100 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 2
store i8 %99, i8* %100
%101 = call zeroext i8 (...) @ControllerGateFaultsGet()
%102 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 3
store i8 %101, i8* %102
%103 = call zeroext i8 (...) @ControllerCommunicationFaultsGet()
%104 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 4
store i8 %103, i8* %104
%105 = call i32 (...) @CANStatusRegGet()
%106 = and i32 %105, 255
%107 = trunc i32 %106 to i8
%108 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 5
store i8 %107, i8* %108
%109 = call i32 (...) @CANErrorRegGet()
%110 = and i32 %109, 65535
%111 = trunc i32 %110 to i16
%112 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 0
%113 = getelementptr inbounds i8, i8* %112, i64 6
%114 = bitcast i8* %113 to i16*
store i16 %111, i16* %114
%115 = load i64, i64* %6
%116 = icmp eq i64 %115, 1
br i1 %116, label %117, label %131
117: ; preds = %94
%118 = load i8*, i8** %5
%119 = getelementptr inbounds i8, i8* %118, i64 0
%120 = load i8, i8* %119
%121 = call i32 @ControllerFaultCountReset(i8 zeroext %120)
%122 = load i8*, i8** %5
%123 = getelementptr inbounds i8, i8* %122, i64 0
%124 = load i8, i8* %123
%125 = zext i8 %124 to i32
%126 = and i32 %125, 32
%127 = icmp ne i32 %126, 0
br i1 %127, label %128, label %130
128: ; preds = %117
%129 = call i32 (...) @CANStatusWriteLECNoEvent()
br label %130
130: ; preds = %128, %117
br label %131
131: ; preds = %130, %94
%132 = load i64, i64* %4
%133 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 0
%134 = call i32 @MessageSendResponse(i64 %132, i8* %133, i32 8)
store i64 1, i64* %10
br label %136
135: ; preds = %3
br label %136
136: ; preds = %135, %131, %89, %80, %76, %75, %50, %45, %40, %35, %30, %25, %19, %13
%137 = load i64, i64* %10
ret i64 %137
}

LLVM IR (-O2):
define i64 @MessageStatusHandler(i64 %0, i8* nocapture %1, i64 %2) {
%4 = alloca [8 x i8]
%5 = alloca i8
%6 = alloca i64
%7 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%8 = bitcast i64* %6 to i8*
%9 = add i64 %0, -33690624
%10 = lshr i64 %9, 6
switch i64 %10, label %87 [
i64 0, label %11
i64 1, label %15
i64 7, label %19
i64 2, label %22
i64 3, label %25
i64 4, label %28
i64 5, label %31
i64 6, label %34
i64 8, label %37
i64 9, label %46
i64 10, label %49
i64 11, label %56
i64 12, label %59
]
11: ; preds = %3
%12 = tail call i32 (...) @ControllerVoltageGet()
%13 = sext i32 %12 to i64
store i64 %13, i64* %6
%14 = call i32 @MessageSendResponse(i64 %0, i8* %8, i32 2)
br label %87
15: ; preds = %3
%16 = tail call i32 (...) @ADCVBusGet()
%17 = sext i32 %16 to i64
store i64 %17, i64* %6
%18 = call i32 @MessageSendResponse(i64 %0, i8* %8, i32 2)
br label %87
19: ; preds = %3
%20 = tail call i64 (...) @ControllerFaultsActive()
store i64 %20, i64* %6
%21 = call i32 @MessageSendResponse(i64 %0, i8* %8, i32 2)
br label %87
22: ; preds = %3
%23 = tail call i64 (...) @ADCCurrentGet()
store i64 %23, i64* %6
%24 = call i32 @MessageSendResponse(i64 %0, i8* %8, i32 2)
br label %87
25: ; preds = %3
%26 = tail call i64 (...) @ADCTemperatureGet()
store i64 %26, i64* %6
%27 = call i32 @MessageSendResponse(i64 %0, i8* %8, i32 2)
br label %87
28: ; preds = %3
%29 = tail call i64 (...) @ControllerPositionGet()
store i64 %29, i64* %6
%30 = call i32 @MessageSendResponse(i64 %0, i8* %8, i32 4)
br label %87
31: ; preds = %3
%32 = tail call i64 (...) @ControllerSpeedGet()
store i64 %32, i64* %6
%33 = call i32 @MessageSendResponse(i64 %0, i8* %8, i32 4)
br label %87
34: ; preds = %3
%35 = tail call i64 @LimitStatusGet(i32 1)
store i64 %35, i64* %6
%36 = call i32 @MessageSendResponse(i64 %0, i8* %8, i32 1)
br label %87
37: ; preds = %3
switch i64 %2, label %87 [
i64 0, label %38
i64 1, label %41
]
38: ; preds = %37
%39 = tail call i64 (...) @ControllerPowerStatus()
store i64 %39, i64* %6
%40 = call i32 @MessageSendResponse(i64 %0, i8* %8, i32 1)
br label %87
41: ; preds = %37
%42 = load i8, i8* %1
%43 = icmp eq i8 %42, 0
br i1 %43, label %87, label %44
44: ; preds = %41
%45 = tail call i32 (...) @ControllerPowerStatusClear()
br label %87
46: ; preds = %3
%47 = tail call zeroext i8 (...) @ControllerControlModeGet()
store i8 %47, i8* %5
%48 = call i32 @MessageSendResponse(i64 %0, i8* %5, i32 1)
br label %87
49: ; preds = %3
%50 = tail call i32 (...) @ControllerVoltageGet()
%51 = tail call i32 (...) @ADCVBusGet()
%52 = mul nsw i32 %51, %50
%53 = sdiv i32 %52, 32768
%54 = sext i32 %53 to i64
store i64 %54, i64* %6
%55 = call i32 @MessageSendResponse(i64 %0, i8* %8, i32 2)
br label %87
56: ; preds = %3
%57 = tail call i64 @ControllerStickyFaultsActive(i32 1)
store i64 %57, i64* %6
%58 = call i32 @MessageSendResponse(i64 %0, i8* %8, i32 2)
br label %87
59: ; preds = %3
%60 = tail call zeroext i8 (...) @ControllerCurrentFaultsGet()
store i8 %60, i8* %7
%61 = tail call zeroext i8 (...) @ControllerTemperatureFaultsGet()
%62 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 1
store i8 %61, i8* %62
%63 = tail call zeroext i8 (...) @ControllerVBusFaultsGet()
%64 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 2
store i8 %63, i8* %64
%65 = tail call zeroext i8 (...) @ControllerGateFaultsGet()
%66 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 3
store i8 %65, i8* %66
%67 = tail call zeroext i8 (...) @ControllerCommunicationFaultsGet()
%68 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 4
store i8 %67, i8* %68
%69 = tail call i32 (...) @CANStatusRegGet()
%70 = trunc i32 %69 to i8
%71 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 5
store i8 %70, i8* %71
%72 = tail call i32 (...) @CANErrorRegGet()
%73 = trunc i32 %72 to i16
%74 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 6
%75 = bitcast i8* %74 to i16*
store i16 %73, i16* %75
%76 = icmp eq i64 %2, 1
br i1 %76, label %77, label %85
77: ; preds = %59
%78 = load i8, i8* %1
%79 = tail call i32 @ControllerFaultCountReset(i8 zeroext %78)
%80 = load i8, i8* %1
%81 = and i8 %80, 32
%82 = icmp eq i8 %81, 0
br i1 %82, label %85, label %83
83: ; preds = %77
%84 = tail call i32 (...) @CANStatusWriteLECNoEvent()
br label %85
85: ; preds = %77, %83, %59
%86 = call i32 @MessageSendResponse(i64 %0, i8* %7, i32 8)
br label %87
87: ; preds = %38, %41, %44, %37, %3, %85, %56, %49, %46, %34, %31, %28, %25, %22, %19, %15, %11
%88 = phi i64 [ 0, %3 ], [ 1, %85 ], [ 1, %56 ], [ 1, %49 ], [ 1, %46 ], [ 1, %34 ], [ 1, %31 ], [ 1, %28 ], [ 1, %25 ], [ 1, %22 ], [ 1, %19 ], [ 1, %15 ], [ 1, %11 ], [ 1, %37 ], [ 1, %44 ], [ 1, %41 ], [ 1, %38 ]
ret i64 %88
}