#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 uint8_t;
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ write_byte_data(int, int, int);
void set_pwm(uint8_t channel, uint16_t on, uint16_t off, uint8_t address) {
  channel -= 1;
  write_byte_data(address, 0x06 + 4 * channel, on & 0xFF);
  write_byte_data(address, 0x07 + 4 * channel, on >> 8);
  write_byte_data(address, 0x08 + 4 * channel, off & 0xFF);
  write_byte_data(address, 0x09 + 4 * channel, off >> 8);
}


x86 assembly (clang, -O0):
<set_pwm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x4(%rbp),%esi
shl    $0x2,%esi
add    $0x6,%esi
mov    -0x8(%rbp),%edx
and    $0xff,%edx
call   1030 <write_byte_data@plt>
mov    -0x10(%rbp),%edi
mov    -0x4(%rbp),%esi
shl    $0x2,%esi
add    $0x7,%esi
mov    -0x8(%rbp),%edx
sar    $0x8,%edx
call   1030 <write_byte_data@plt>
mov    -0x10(%rbp),%edi
mov    -0x4(%rbp),%esi
shl    $0x2,%esi
add    $0x8,%esi
mov    -0xc(%rbp),%edx
and    $0xff,%edx
call   1030 <write_byte_data@plt>
mov    -0x10(%rbp),%edi
mov    -0x4(%rbp),%esi
shl    $0x2,%esi
add    $0x9,%esi
mov    -0xc(%rbp),%edx
sar    $0x8,%edx
call   1030 <write_byte_data@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_pwm>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r15d
mov    %edx,%r14d
mov    %esi,%ebx
mov    %edi,%ebp
lea    0x2(,%rbp,4),%esi
movzbl %bl,%edx
mov    %ecx,%edi
call   1030 <write_byte_data@plt>
lea    0x3(,%rbp,4),%esi
sar    $0x8,%ebx
mov    %r15d,%edi
mov    %ebx,%edx
call   1030 <write_byte_data@plt>
lea    0x4(,%rbp,4),%esi
movzbl %r14b,%edx
mov    %r15d,%edi
call   1030 <write_byte_data@plt>
lea    0x5(,%rbp,4),%esi
sar    $0x8,%r14d
mov    %r15d,%edi
mov    %r14d,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <write_byte_data@plt>

LLVM IR (-O0):
define void @set_pwm(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = sub nsw i32 %9, 1
store i32 %10, i32* %5
%11 = load i32, i32* %8
%12 = load i32, i32* %5
%13 = mul nsw i32 4, %12
%14 = add nsw i32 6, %13
%15 = load i32, i32* %6
%16 = and i32 %15, 255
%17 = call i32 @write_byte_data(i32 %11, i32 %14, i32 %16)
%18 = load i32, i32* %8
%19 = load i32, i32* %5
%20 = mul nsw i32 4, %19
%21 = add nsw i32 7, %20
%22 = load i32, i32* %6
%23 = ashr i32 %22, 8
%24 = call i32 @write_byte_data(i32 %18, i32 %21, i32 %23)
%25 = load i32, i32* %8
%26 = load i32, i32* %5
%27 = mul nsw i32 4, %26
%28 = add nsw i32 8, %27
%29 = load i32, i32* %7
%30 = and i32 %29, 255
%31 = call i32 @write_byte_data(i32 %25, i32 %28, i32 %30)
%32 = load i32, i32* %8
%33 = load i32, i32* %5
%34 = mul nsw i32 4, %33
%35 = add nsw i32 9, %34
%36 = load i32, i32* %7
%37 = ashr i32 %36, 8
%38 = call i32 @write_byte_data(i32 %32, i32 %35, i32 %37)
ret void
}

LLVM IR (-O2):
define void @set_pwm(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = shl i32 %0, 2
%6 = or i32 %5, 2
%7 = and i32 %1, 255
%8 = tail call i32 @write_byte_data(i32 %3, i32 %6, i32 %7)
%9 = or i32 %5, 3
%10 = ashr i32 %1, 8
%11 = tail call i32 @write_byte_data(i32 %3, i32 %9, i32 %10)
%12 = add i32 %5, 4
%13 = and i32 %2, 255
%14 = tail call i32 @write_byte_data(i32 %3, i32 %12, i32 %13)
%15 = add i32 %5, 5
%16 = ashr i32 %2, 8
%17 = tail call i32 @write_byte_data(i32 %3, i32 %15, i32 %16)
ret void
}