#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*/ i2c_write_reg(int, int);
void set_pwm(int on, int off, int channel) {
  i2c_write_reg((0x06 + 4 * channel), (on & 0xFF));
  i2c_write_reg((0x06 + 1 + 4 * channel), (on >> 8));
  i2c_write_reg((0x06 + 2 + 4 * channel), (off & 0xFF));
  i2c_write_reg((0x06 + 3 + 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    -0xc(%rbp),%edi
shl    $0x2,%edi
add    $0x6,%edi
mov    -0x4(%rbp),%esi
and    $0xff,%esi
call   1030 <i2c_write_reg@plt>
mov    -0xc(%rbp),%edi
shl    $0x2,%edi
add    $0x7,%edi
mov    -0x4(%rbp),%esi
sar    $0x8,%esi
call   1030 <i2c_write_reg@plt>
mov    -0xc(%rbp),%edi
shl    $0x2,%edi
add    $0x8,%edi
mov    -0x8(%rbp),%esi
and    $0xff,%esi
call   1030 <i2c_write_reg@plt>
mov    -0xc(%rbp),%edi
shl    $0x2,%edi
add    $0x9,%edi
mov    -0x8(%rbp),%esi
sar    $0x8,%esi
call   1030 <i2c_write_reg@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_pwm>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%r14d
mov    %edi,%ebp
lea    0x6(,%rbx,4),%edi
movzbl %bpl,%esi
call   1030 <i2c_write_reg@plt>
lea    0x7(,%rbx,4),%edi
sar    $0x8,%ebp
mov    %ebp,%esi
call   1030 <i2c_write_reg@plt>
lea    0x8(,%rbx,4),%edi
movzbl %r14b,%esi
call   1030 <i2c_write_reg@plt>
lea    0x9(,%rbx,4),%edi
sar    $0x8,%r14d
mov    %r14d,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <i2c_write_reg@plt>

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

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