#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*/ TELEMETRY_SetType();
int /*<<< orphan*/ TELEMETRY_SetUpdated();
int /*<<< orphan*/ UART_Stop();
int /*<<< orphan*/ _usleep();
int /*<<< orphan*/ rand();
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();
  rand();
}


x86 assembly (clang, -O0):
<PROTO_Stubs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    11ca <PROTO_Stubs+0x1a>
jmp    1217 <PROTO_Stubs+0x67>
mov    $0x0,%al
call   10a0 <CLOCK_StartTimer@plt>
mov    $0x0,%al
call   10c0 <spi_disable@plt>
mov    $0x0,%al
call   1050 <spi_set_bidirectional_receive_only_mode@plt>
mov    $0x0,%al
call   1070 <spi_read@plt>
mov    $0x0,%al
call   1090 <spi_set_unidirectional_mode@plt>
mov    $0x0,%al
call   1040 <TELEMETRY_SetUpdated@plt>
mov    $0x0,%al
call   1060 <TELEMETRY_SetType@plt>
mov    $0x0,%al
call   1030 <UART_Stop@plt>
mov    $0x0,%al
call   10b0 <rcc_peripheral_disable_clock@plt>
mov    $0x0,%al
call   1080 <_usleep@plt>
mov    $0x0,%al
call   10d0 <rand@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PROTO_Stubs>:
test   %edi,%edi
je     1203 <PROTO_Stubs+0x53>
push   %rax
xor    %eax,%eax
call   10a0 <CLOCK_StartTimer@plt>
xor    %eax,%eax
call   10c0 <spi_disable@plt>
xor    %eax,%eax
call   1050 <spi_set_bidirectional_receive_only_mode@plt>
xor    %eax,%eax
call   1070 <spi_read@plt>
xor    %eax,%eax
call   1090 <spi_set_unidirectional_mode@plt>
xor    %eax,%eax
call   1040 <TELEMETRY_SetUpdated@plt>
xor    %eax,%eax
call   1060 <TELEMETRY_SetType@plt>
xor    %eax,%eax
call   1030 <UART_Stop@plt>
xor    %eax,%eax
call   10b0 <rcc_peripheral_disable_clock@plt>
xor    %eax,%eax
call   1080 <_usleep@plt>
xor    %eax,%eax
pop    %rcx
jmp    10d0 <rand@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 %18
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 (...) @rand()
br label %18
18: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
define void @PROTO_Stubs(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %15, 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 (...) @rand()
br label %15
15: ; preds = %1, %3
ret void
}