#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*/ mdaq_pwm_init();
int /*<<< orphan*/ mdaq_pwm_setup(unsigned char, unsigned int, unsigned char);
int /*<<< orphan*/ mdaq_pwm_start(unsigned char);
void PWMInit(unsigned char module, unsigned int period,
             unsigned char polarity) {
  module *= 2;
  mdaq_pwm_init();
  mdaq_pwm_setup(module, period, polarity);
  mdaq_pwm_setup(module + 1, period, polarity);
  mdaq_pwm_start(module);
  mdaq_pwm_start(module + 1);
}


x86 assembly (clang, -O0):
<PWMInit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x1,%eax
mov    %al,-0x1(%rbp)
mov    $0x0,%al
call   1050 <mdaq_pwm_init@plt>
mov    -0x1(%rbp),%al
mov    -0x8(%rbp),%esi
movzbl %al,%edi
movzbl -0x9(%rbp),%edx
call   1030 <mdaq_pwm_setup@plt>
movzbl -0x1(%rbp),%eax
add    $0x1,%eax
mov    -0x8(%rbp),%esi
movzbl %al,%edi
movzbl -0x9(%rbp),%edx
call   1030 <mdaq_pwm_setup@plt>
movzbl -0x1(%rbp),%edi
call   1040 <mdaq_pwm_start@plt>
movzbl -0x1(%rbp),%eax
add    $0x1,%eax
movzbl %al,%edi
call   1040 <mdaq_pwm_start@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PWMInit>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r15d
mov    %edi,%ebx
add    %bl,%bl
xor    %eax,%eax
call   1050 <mdaq_pwm_init@plt>
movzbl %bl,%ebx
mov    %ebx,%edi
mov    %r15d,%esi
mov    %r14d,%edx
call   1030 <mdaq_pwm_setup@plt>
lea    0x1(%rbx),%eax
movzbl %al,%ebp
mov    %ebp,%edi
mov    %r15d,%esi
mov    %r14d,%edx
call   1030 <mdaq_pwm_setup@plt>
mov    %ebx,%edi
call   1040 <mdaq_pwm_start@plt>
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <mdaq_pwm_start@plt>

LLVM IR (-O0):
define void @PWMInit(i8 zeroext %0, i32 %1, i8 zeroext %2) {
%4 = alloca i8
%5 = alloca i32
%6 = alloca i8
store i8 %0, i8* %4
store i32 %1, i32* %5
store i8 %2, i8* %6
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
%9 = mul nsw i32 %8, 2
%10 = trunc i32 %9 to i8
store i8 %10, i8* %4
%11 = call i32 (...) @mdaq_pwm_init()
%12 = load i8, i8* %4
%13 = load i32, i32* %5
%14 = load i8, i8* %6
%15 = call i32 @mdaq_pwm_setup(i8 zeroext %12, i32 %13, i8 zeroext %14)
%16 = load i8, i8* %4
%17 = zext i8 %16 to i32
%18 = add nsw i32 %17, 1
%19 = trunc i32 %18 to i8
%20 = load i32, i32* %5
%21 = load i8, i8* %6
%22 = call i32 @mdaq_pwm_setup(i8 zeroext %19, i32 %20, i8 zeroext %21)
%23 = load i8, i8* %4
%24 = call i32 @mdaq_pwm_start(i8 zeroext %23)
%25 = load i8, i8* %4
%26 = zext i8 %25 to i32
%27 = add nsw i32 %26, 1
%28 = trunc i32 %27 to i8
%29 = call i32 @mdaq_pwm_start(i8 zeroext %28)
ret void
}

LLVM IR (-O2):
define void @PWMInit(i8 zeroext %0, i32 %1, i8 zeroext %2) {
%4 = shl i8 %0, 1
%5 = tail call i32 (...) @mdaq_pwm_init()
%6 = tail call i32 @mdaq_pwm_setup(i8 zeroext %4, i32 %1, i8 zeroext %2)
%7 = or i8 %4, 1
%8 = tail call i32 @mdaq_pwm_setup(i8 zeroext %7, i32 %1, i8 zeroext %2)
%9 = tail call i32 @mdaq_pwm_start(i8 zeroext %4)
%10 = tail call i32 @mdaq_pwm_start(i8 zeroext %7)
ret void
}