#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 */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;
typedef int /*<<< orphan*/ timer;
typedef int /*<<< orphan*/ reset;
typedef int /*<<< orphan*/ channel;

/* Variables and functions */
int /*<<< orphan*/ pwm_set_channel_duty_cycle(int /*<<< orphan*/,
                                              int /*<<< orphan*/,
                                              int /*<<< orphan*/);
size_t usart_in_waiting();
int /*<<< orphan*/ usart_read(int /*<<< orphan*/ *, int);
void rpc_pwm_set_channel_duty_cycle(void) {
  uint8_t timer;
  uint8_t channel;
  uint16_t reset;
  size_t argsize = sizeof(timer) + sizeof(channel) + sizeof(reset);
  while (usart_in_waiting() < argsize)
    ;
  usart_read(&timer, sizeof(timer));
  usart_read(&channel, sizeof(channel));
  usart_read(&reset, sizeof(reset));
  pwm_set_channel_duty_cycle(timer, channel, reset);
}


x86 assembly (clang, -O0):
<rpc_pwm_set_channel_duty_cycle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0xc,-0x18(%rbp)
mov    $0x0,%al
call   1040 <usart_in_waiting@plt>
cmp    -0x18(%rbp),%rax
jae    1156 <rpc_pwm_set_channel_duty_cycle+0x26>
jmp    1140 <rpc_pwm_set_channel_duty_cycle+0x10>
lea    -0x4(%rbp),%rdi
mov    $0x4,%esi
call   1030 <usart_read@plt>
lea    -0x8(%rbp),%rdi
mov    $0x4,%esi
call   1030 <usart_read@plt>
lea    -0xc(%rbp),%rdi
mov    $0x4,%esi
call   1030 <usart_read@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1050 <pwm_set_channel_duty_cycle@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rpc_pwm_set_channel_duty_cycle>:
sub    $0x18,%rsp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1040 <usart_in_waiting@plt>
cmp    $0xc,%rax
jb     1140 <rpc_pwm_set_channel_duty_cycle+0x10>
lea    0x14(%rsp),%rdi
mov    $0x4,%esi
call   1030 <usart_read@plt>
lea    0x10(%rsp),%rdi
mov    $0x4,%esi
call   1030 <usart_read@plt>
lea    0xc(%rsp),%rdi
mov    $0x4,%esi
call   1030 <usart_read@plt>
mov    0x14(%rsp),%edi
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
call   1050 <pwm_set_channel_duty_cycle@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @rpc_pwm_set_channel_duty_cycle() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
store i64 12, i64* %4
br label %5
5: ; preds = %9, %0
%6 = call i64 (...) @usart_in_waiting()
%7 = load i64, i64* %4
%8 = icmp ult i64 %6, %7
br i1 %8, label %9, label %10
9: ; preds = %5
br label %5
10: ; preds = %5
%11 = call i32 @usart_read(i32* %1, i32 4)
%12 = call i32 @usart_read(i32* %2, i32 4)
%13 = call i32 @usart_read(i32* %3, i32 4)
%14 = load i32, i32* %1
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = call i32 @pwm_set_channel_duty_cycle(i32 %14, i32 %15, i32 %16)
ret void
}

LLVM IR (-O2):
define void @rpc_pwm_set_channel_duty_cycle() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
br label %7
7: ; preds = %7, %0
%8 = tail call i64 (...) @usart_in_waiting()
%9 = icmp ult i64 %8, 12
br i1 %9, label %7, label %10
10: ; preds = %7
%11 = call i32 @usart_read(i32* %1, i32 4)
%12 = call i32 @usart_read(i32* %2, i32 4)
%13 = call i32 @usart_read(i32* %3, i32 4)
%14 = load i32, i32* %1
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = call i32 @pwm_set_channel_duty_cycle(i32 %14, i32 %15, i32 %16)
ret void
}