#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*/ CLOCK_StartTimer();
int /*<<< orphan*/ MCU_SerialNumber();
int /*<<< orphan*/ PROTO_CS_HI();
int /*<<< orphan*/ PROTO_CS_LO();
int /*<<< orphan*/ TELEMETRY_SetType();
int /*<<< orphan*/ TELEMETRY_SetUpdated();
int /*<<< orphan*/ UART_Stop();
int /*<<< orphan*/ USB_Disable();
int /*<<< orphan*/ _usleep();
int /*<<< orphan*/ rcc_peripheral_disable_clock();
int /*<<< orphan*/ spi_disable();
int /*<<< orphan*/ spi_read();
int /*<<< orphan*/ spi_set_bidirectional_receive_only_mode();
int /*<<< orphan*/ spi_set_unidirectional_mode();
void PROTO_Stubs(int idx) {
  if (!idx)
    return;
  CLOCK_StartTimer();
  spi_disable();
  spi_set_bidirectional_receive_only_mode();
  spi_read();
  spi_set_unidirectional_mode();
  TELEMETRY_SetUpdated();
  TELEMETRY_SetType();
  UART_Stop();
  rcc_peripheral_disable_clock();
  _usleep();
  MCU_SerialNumber();
  USB_Disable();
  PROTO_CS_HI();
  PROTO_CS_LO();
}


x86 assembly (clang, -O0):
<PROTO_Stubs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    11fa <PROTO_Stubs+0x1a>
jmp    125c <PROTO_Stubs+0x7c>
mov    $0x0,%al
call   10e0 <CLOCK_StartTimer@plt>
mov    $0x0,%al
call   1100 <spi_disable@plt>
mov    $0x0,%al
call   1080 <spi_set_bidirectional_receive_only_mode@plt>
mov    $0x0,%al
call   10b0 <spi_read@plt>
mov    $0x0,%al
call   10d0 <spi_set_unidirectional_mode@plt>
mov    $0x0,%al
call   1060 <TELEMETRY_SetUpdated@plt>
mov    $0x0,%al
call   1090 <TELEMETRY_SetType@plt>
mov    $0x0,%al
call   1030 <UART_Stop@plt>
mov    $0x0,%al
call   10f0 <rcc_peripheral_disable_clock@plt>
mov    $0x0,%al
call   10c0 <_usleep@plt>
mov    $0x0,%al
call   1070 <MCU_SerialNumber@plt>
mov    $0x0,%al
call   1040 <USB_Disable@plt>
mov    $0x0,%al
call   1050 <PROTO_CS_HI@plt>
mov    $0x0,%al
call   10a0 <PROTO_CS_LO@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PROTO_Stubs>:
test   %edi,%edi
je     1248 <PROTO_Stubs+0x68>
push   %rax
xor    %eax,%eax
call   10e0 <CLOCK_StartTimer@plt>
xor    %eax,%eax
call   1100 <spi_disable@plt>
xor    %eax,%eax
call   1080 <spi_set_bidirectional_receive_only_mode@plt>
xor    %eax,%eax
call   10b0 <spi_read@plt>
xor    %eax,%eax
call   10d0 <spi_set_unidirectional_mode@plt>
xor    %eax,%eax
call   1060 <TELEMETRY_SetUpdated@plt>
xor    %eax,%eax
call   1090 <TELEMETRY_SetType@plt>
xor    %eax,%eax
call   1030 <UART_Stop@plt>
xor    %eax,%eax
call   10f0 <rcc_peripheral_disable_clock@plt>
xor    %eax,%eax
call   10c0 <_usleep@plt>
xor    %eax,%eax
call   1070 <MCU_SerialNumber@plt>
xor    %eax,%eax
call   1040 <USB_Disable@plt>
xor    %eax,%eax
call   1050 <PROTO_CS_HI@plt>
xor    %eax,%eax
pop    %rcx
jmp    10a0 <PROTO_CS_LO@plt>
ret

LLVM IR (-O0):
define void @PROTO_Stubs(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %6, label %5
5: ; preds = %1
br label %21
6: ; preds = %1
%7 = call i32 (...) @CLOCK_StartTimer()
%8 = call i32 (...) @spi_disable()
%9 = call i32 (...) @spi_set_bidirectional_receive_only_mode()
%10 = call i32 (...) @spi_read()
%11 = call i32 (...) @spi_set_unidirectional_mode()
%12 = call i32 (...) @TELEMETRY_SetUpdated()
%13 = call i32 (...) @TELEMETRY_SetType()
%14 = call i32 (...) @UART_Stop()
%15 = call i32 (...) @rcc_peripheral_disable_clock()
%16 = call i32 (...) @_usleep()
%17 = call i32 (...) @MCU_SerialNumber()
%18 = call i32 (...) @USB_Disable()
%19 = call i32 (...) @PROTO_CS_HI()
%20 = call i32 (...) @PROTO_CS_LO()
br label %21
21: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
define void @PROTO_Stubs(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %18, label %3
3: ; preds = %1
%4 = tail call i32 (...) @CLOCK_StartTimer()
%5 = tail call i32 (...) @spi_disable()
%6 = tail call i32 (...) @spi_set_bidirectional_receive_only_mode()
%7 = tail call i32 (...) @spi_read()
%8 = tail call i32 (...) @spi_set_unidirectional_mode()
%9 = tail call i32 (...) @TELEMETRY_SetUpdated()
%10 = tail call i32 (...) @TELEMETRY_SetType()
%11 = tail call i32 (...) @UART_Stop()
%12 = tail call i32 (...) @rcc_peripheral_disable_clock()
%13 = tail call i32 (...) @_usleep()
%14 = tail call i32 (...) @MCU_SerialNumber()
%15 = tail call i32 (...) @USB_Disable()
%16 = tail call i32 (...) @PROTO_CS_HI()
%17 = tail call i32 (...) @PROTO_CS_LO()
br label %18
18: ; preds = %1, %3
ret void
}