#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;

/* Variables and functions */
int /*<<< orphan*/ mswait(int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ pwm_enable(int /*<<< orphan*/, int);
int /*<<< orphan*/ pwm_reset_pin(int /*<<< orphan*/);
int /*<<< orphan*/ pwm_set_clock_freq(int);
int /*<<< orphan*/ pwm_set_data(int /*<<< orphan*/, int);
int /*<<< orphan*/ pwm_set_mode(int /*<<< orphan*/, int);
int /*<<< orphan*/ pwm_set_pin(int /*<<< orphan*/);
int /*<<< orphan*/ pwm_set_range(int /*<<< orphan*/, int);
void pwm(uint8_t pin) {
  pwm_reset_pin(pin);
  puts("generating a pulse ...");
  pwm_set_pin(pin);
  pwm_set_clock_freq(192);
  mswait(25);
  pwm_enable(pin, 1);
  pwm_set_mode(pin, 1);
  pwm_set_range(pin, 1000);
  pwm_set_data(pin, 100);
  mswait(2000);
  pwm_reset_pin(pin);
}


x86 assembly (clang, -O0):
<pwm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1080 <pwm_reset_pin@plt>
lea    0xe56(%rip),%rdi
call   1030 <puts@plt>
mov    -0x4(%rbp),%edi
call   10a0 <pwm_set_pin@plt>
mov    $0xc0,%edi
call   1050 <pwm_set_clock_freq@plt>
mov    $0x19,%edi
call   10b0 <mswait@plt>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1070 <pwm_enable@plt>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1060 <pwm_set_mode@plt>
mov    -0x4(%rbp),%edi
mov    $0x3e8,%esi
call   1040 <pwm_set_range@plt>
mov    -0x4(%rbp),%edi
mov    $0x64,%esi
call   1090 <pwm_set_data@plt>
mov    $0x7d0,%edi
call   10b0 <mswait@plt>
mov    -0x4(%rbp),%edi
call   1080 <pwm_reset_pin@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pwm>:
push   %rbx
mov    %edi,%ebx
call   1080 <pwm_reset_pin@plt>
lea    0xe61(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
call   10a0 <pwm_set_pin@plt>
mov    $0xc0,%edi
call   1050 <pwm_set_clock_freq@plt>
mov    $0x19,%edi
call   10b0 <mswait@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1070 <pwm_enable@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1060 <pwm_set_mode@plt>
mov    %ebx,%edi
mov    $0x3e8,%esi
call   1040 <pwm_set_range@plt>
mov    %ebx,%edi
mov    $0x64,%esi
call   1090 <pwm_set_data@plt>
mov    $0x7d0,%edi
call   10b0 <mswait@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1080 <pwm_reset_pin@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"generating a pulse ...\00"
define void @pwm(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @pwm_reset_pin(i32 %3)
%5 = call i32 @puts(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* %2
%7 = call i32 @pwm_set_pin(i32 %6)
%8 = call i32 @pwm_set_clock_freq(i32 192)
%9 = call i32 @mswait(i32 25)
%10 = load i32, i32* %2
%11 = call i32 @pwm_enable(i32 %10, i32 1)
%12 = load i32, i32* %2
%13 = call i32 @pwm_set_mode(i32 %12, i32 1)
%14 = load i32, i32* %2
%15 = call i32 @pwm_set_range(i32 %14, i32 1000)
%16 = load i32, i32* %2
%17 = call i32 @pwm_set_data(i32 %16, i32 100)
%18 = call i32 @mswait(i32 2000)
%19 = load i32, i32* %2
%20 = call i32 @pwm_reset_pin(i32 %19)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"generating a pulse ...\00"
define void @pwm(i32 %0) {
%2 = tail call i32 @pwm_reset_pin(i32 %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @pwm_set_pin(i32 %0)
%5 = tail call i32 @pwm_set_clock_freq(i32 192)
%6 = tail call i32 @mswait(i32 25)
%7 = tail call i32 @pwm_enable(i32 %0, i32 1)
%8 = tail call i32 @pwm_set_mode(i32 %0, i32 1)
%9 = tail call i32 @pwm_set_range(i32 %0, i32 1000)
%10 = tail call i32 @pwm_set_data(i32 %0, i32 100)
%11 = tail call i32 @mswait(i32 2000)
%12 = tail call i32 @pwm_reset_pin(i32 %0)
ret void
}