#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*/ printf(char *, ...);
int /*<<< orphan*/ set_reg(unsigned int, int, int, int /*<<< orphan*/);
int init_pwm(void *cmper_base, void *ctrl_base, void *pwm1_base,
             void *pwm2_base, double hz) {
  double clk = 100000000.0f;
  double div = 0.0f;
  int i, j;
  int NearCLKDIV = 7;
  int NearHSPCLKDIV = 7;
  int cmpV = 0;
  const float CLKDIV_div[] = {1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0, 128.0};
  const float HSPCLKDIV_div[] = {1.0, 2.0, 4.0, 6.0, 8.0, 10.0, 12.0, 14.0};
  void *pwm1_epwm;
  void *pwm2_epwm;
  clk /= hz;
  div = clk / 65535.0f;
  if (div > (128 * 14)) {
    printf("value is over than divisor\\\\value : %.3lf\n", div);
    return 0;
  }
  for (i = 0; i < 8; i++) {
    for (j = 0; j < 8; j++) {
      if ((CLKDIV_div[i] * HSPCLKDIV_div[j]) <
              (CLKDIV_div[NearCLKDIV] * HSPCLKDIV_div[NearHSPCLKDIV]) &&
          ((CLKDIV_div[i] * HSPCLKDIV_div[j]) > div)) {
        NearCLKDIV = i;
        NearHSPCLKDIV = j;
      }
    }
  }
  cmpV = (int)((100000000.0 /
                (CLKDIV_div[NearCLKDIV] * HSPCLKDIV_div[NearHSPCLKDIV])) /
               hz);
  pwm1_epwm = pwm1_base + 0x200;
  pwm2_epwm = pwm2_base + 0x200;
  if (!set_reg((unsigned int)(cmper_base + 0x0D4), 2, 32, 0))
    printf("failed to set register - CMPER_EPWMSS0\n");
  if (!set_reg((unsigned int)(cmper_base + 0x0CC), 2, 32, 0))
    printf("failed to set register - CMPER_EPWMSS1\n");
  if (!set_reg((unsigned int)(cmper_base + 0x0D8), 2, 32, 0))
    printf("failed to set register - CMPER_EPWMSS2\n");
  if (!set_reg((unsigned int)(ctrl_base + 0x664), (1 << 2 | 1 << 1 | 1 << 0),
               32, 0))
    printf("failed to set register - CTRL_PWMSS\n");
  if (!set_reg((unsigned int)(pwm2_base + 0x008), (1 << 8 | 1 << 4 | 1 << 0),
               32, 0))
    printf("failed to set register - PWMSS0_CLKCONFIG\n");
  if (!set_reg((unsigned int)(pwm1_base + 0x008), (1 << 8 | 1 << 4 | 1 << 0),
               32, 0))
    printf("failed to set register - PWMSS1_CLKCONFIG\n");
  if (!set_reg((unsigned int)(pwm1_epwm + 0x000),
               (NearCLKDIV << 10) | (NearHSPCLKDIV << 7) | (3 << 4), 16, 0))
    printf("failed to set register - PWMSS1_EPWM_TBCTL\n");
  if (!set_reg((unsigned int)(pwm1_epwm + 0x00A), cmpV, 16, 0))
    printf("failed to set register - PWMSS1_EPWM_TBPRD\n");
  if (!set_reg((unsigned int)(pwm1_epwm + 0x016), 0x12, 16, 0))
    printf("failed to set register - PWMSS1_EPWM_AQCTLA\n");
  if (!set_reg((unsigned int)(pwm1_epwm + 0x018), 0x102, 16, 0))
    printf("failed to set register - PWMSS1_EPWM_AQCTLB\n");
  if (!set_reg((unsigned int)(pwm1_epwm + 0x012), 0, 16, 0))
    printf("failed to set register - PWMSS1_EPWM_CMPA\n");
  if (!set_reg((unsigned int)(pwm1_epwm + 0x014), 0, 16, 0))
    printf("failed to set register - PWMSS1_EPWM_CMPB\n");
  if (!set_reg((unsigned int)(pwm2_epwm + 0x000),
               (NearCLKDIV << 10) | (NearHSPCLKDIV << 7) | (0 << 0) | (0 << 5) |
                   (0 << 4),
               16, 0))
    printf("failed to set register - PWMSS2_EPWM_TBCTL\n");
  if (!set_reg((unsigned int)(pwm2_epwm + 0x00A), cmpV, 16, 0))
    printf("failed to set register - PWMSS2_EPWM_TBPRD\n");
  if (!set_reg((unsigned int)(pwm2_epwm + 0x016), 0x12, 16, 0))
    printf("failed to set register - PWMSS2_EPWM_AQCTLA\n");
  if (!set_reg((unsigned int)(pwm2_epwm + 0x018), 0x102, 16, 0))
    printf("failed to set register - PWMSS2_EPWM_AQCTLB\n");
  if (!set_reg((unsigned int)(pwm2_epwm + 0x012), 0, 16, 0))
    printf("failed to set register - PWMSS2_EPWM_CMPA\n");
  if (!set_reg((unsigned int)(pwm2_epwm + 0x014), 0, 16, 0))
    printf("failed to set register - PWMSS2_EPWM_CMPB\n");
  return 1;
}


x86 assembly (clang, -O0):
<init_pwm>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
movsd  0xec8(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x7,-0x4c(%rbp)
movl   $0x7,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
mov    0xeaf(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0xeac(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    0xea9(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xea6(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xea3(%rip),%rax
mov    %rax,-0xa0(%rbp)
mov    0xe9d(%rip),%rax
mov    %rax,-0x98(%rbp)
mov    0xe97(%rip),%rax
mov    %rax,-0x90(%rbp)
mov    0xe91(%rip),%rax
mov    %rax,-0x88(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  0xe1a(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  0xdfc(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    122d <init_pwm+0x10d>
movsd  -0x40(%rbp),%xmm0
lea    0xe46(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    16f0 <init_pwm+0x5d0>
movl   $0x0,-0x44(%rbp)
cmpl   $0x8,-0x44(%rbp)
jge    12de <init_pwm+0x1be>
movl   $0x0,-0x48(%rbp)
cmpl   $0x8,-0x48(%rbp)
jge    12cb <init_pwm+0x1ab>
movslq -0x44(%rbp),%rax
movss  -0x80(%rbp,%rax,4),%xmm1
movslq -0x48(%rbp),%rax
mulss  -0xa0(%rbp,%rax,4),%xmm1
ff ff
movslq -0x4c(%rbp),%rax
movss  -0x80(%rbp,%rax,4),%xmm0
movslq -0x50(%rbp),%rax
mulss  -0xa0(%rbp,%rax,4),%xmm0
ff ff
ucomiss %xmm1,%xmm0
jbe    12b8 <init_pwm+0x198>
movslq -0x44(%rbp),%rax
movss  -0x80(%rbp,%rax,4),%xmm0
movslq -0x48(%rbp),%rax
mulss  -0xa0(%rbp,%rax,4),%xmm0
ff ff
cvtss2sd %xmm0,%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    12b8 <init_pwm+0x198>
mov    -0x44(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x50(%rbp)
jmp    12bd <init_pwm+0x19d>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1245 <init_pwm+0x125>
jmp    12d0 <init_pwm+0x1b0>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1234 <init_pwm+0x114>
movslq -0x4c(%rbp),%rax
movss  -0x80(%rbp,%rax,4),%xmm0
movslq -0x50(%rbp),%rax
mulss  -0xa0(%rbp,%rax,4),%xmm0
ff ff
cvtss2sd %xmm0,%xmm1
movsd  0xd0f(%rip),%xmm0
divsd  %xmm1,%xmm0
divsd  -0x30(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x54(%rbp)
mov    -0x20(%rbp),%rax
add    $0x200,%rax
mov    %rax,-0xa8(%rbp)
mov    -0x28(%rbp),%rax
add    $0x200,%rax
mov    %rax,-0xb0(%rbp)
mov    -0x10(%rbp),%rax
add    $0xd4,%rax
mov    %eax,%edi
mov    $0x2,%esi
mov    $0x20,%edx
xor    %ecx,%ecx
call   1040 <set_reg@plt>
cmp    $0x0,%eax
jne    1367 <init_pwm+0x247>
lea    0xd2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0xcc,%rax
mov    %eax,%edi
mov    $0x2,%esi
mov    $0x20,%edx
xor    %ecx,%ecx
call   1040 <set_reg@plt>
cmp    $0x0,%eax
jne    139b <init_pwm+0x27b>
lea    0xd1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0xd8,%rax
mov    %eax,%edi
mov    $0x2,%esi
mov    $0x20,%edx
xor    %ecx,%ecx
call   1040 <set_reg@plt>
cmp    $0x0,%eax
jne    13cf <init_pwm+0x2af>
lea    0xd13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x664,%rax
mov    %eax,%edi
mov    $0x7,%esi
mov    $0x20,%edx
xor    %ecx,%ecx
call   1040 <set_reg@plt>
cmp    $0x0,%eax
jne    1403 <init_pwm+0x2e3>
lea    0xd07(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
add    $0x8,%rax
mov    %eax,%edi
mov    $0x111,%esi
mov    $0x20,%edx
xor    %ecx,%ecx
call   1040 <set_reg@plt>
cmp    $0x0,%eax
jne    1435 <init_pwm+0x315>
lea    0xcfa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %eax,%edi
mov    $0x111,%esi
mov    $0x20,%edx
xor    %ecx,%ecx
call   1040 <set_reg@plt>
cmp    $0x0,%eax
jne    1467 <init_pwm+0x347>
lea    0xcf3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xa8(%rbp),%rax
mov    %eax,%edi
mov    -0x4c(%rbp),%esi
shl    $0xa,%esi
mov    -0x50(%rbp),%eax
shl    $0x7,%eax
or     %eax,%esi
or     $0x30,%esi
mov    $0x10,%edx
xor    %ecx,%ecx
call   1040 <set_reg@plt>
cmp    $0x0,%eax
jne    14a4 <init_pwm+0x384>
lea    0xce1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xa8(%rbp),%rax
add    $0xa,%rax
mov    %eax,%edi
mov    -0x54(%rbp),%esi
mov    $0x10,%edx
xor    %ecx,%ecx
call   1040 <set_reg@plt>
cmp    $0x0,%eax
jne    14d7 <init_pwm+0x3b7>
lea    0xcda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xa8(%rbp),%rax
add    $0x16,%rax
mov    %eax,%edi
mov    $0x12,%esi
mov    $0x10,%edx
xor    %ecx,%ecx
call   1040 <set_reg@plt>
cmp    $0x0,%eax
jne    150c <init_pwm+0x3ec>
lea    0xcd1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xa8(%rbp),%rax
add    $0x18,%rax
mov    %eax,%edi
mov    $0x102,%esi
mov    $0x10,%edx
xor    %ecx,%ecx
call   1040 <set_reg@plt>
cmp    $0x0,%eax
jne    1541 <init_pwm+0x421>
lea    0xcc9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xa8(%rbp),%rax
add    $0x12,%rax
mov    %eax,%edi
xor    %ecx,%ecx
mov    $0x10,%edx
mov    %ecx,%esi
call   1040 <set_reg@plt>
cmp    $0x0,%eax
jne    1573 <init_pwm+0x453>
lea    0xcc4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xa8(%rbp),%rax
add    $0x14,%rax
mov    %eax,%edi
xor    %ecx,%ecx
mov    $0x10,%edx
mov    %ecx,%esi
call   1040 <set_reg@plt>
cmp    $0x0,%eax
jne    15a5 <init_pwm+0x485>
lea    0xcbd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xb0(%rbp),%rax
mov    %eax,%edi
mov    -0x4c(%rbp),%esi
shl    $0xa,%esi
mov    -0x50(%rbp),%eax
shl    $0x7,%eax
or     %eax,%esi
or     $0x0,%esi
or     $0x0,%esi
or     $0x0,%esi
mov    $0x10,%edx
xor    %ecx,%ecx
call   1040 <set_reg@plt>
cmp    $0x0,%eax
jne    15e8 <init_pwm+0x4c8>
lea    0xca5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xb0(%rbp),%rax
add    $0xa,%rax
mov    %eax,%edi
mov    -0x54(%rbp),%esi
mov    $0x10,%edx
xor    %ecx,%ecx
call   1040 <set_reg@plt>
cmp    $0x0,%eax
jne    161b <init_pwm+0x4fb>
lea    0xc9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xb0(%rbp),%rax
add    $0x16,%rax
mov    %eax,%edi
mov    $0x12,%esi
mov    $0x10,%edx
xor    %ecx,%ecx
call   1040 <set_reg@plt>
cmp    $0x0,%eax
jne    1650 <init_pwm+0x530>
lea    0xc95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xb0(%rbp),%rax
add    $0x18,%rax
mov    %eax,%edi
mov    $0x102,%esi
mov    $0x10,%edx
xor    %ecx,%ecx
call   1040 <set_reg@plt>
cmp    $0x0,%eax
jne    1685 <init_pwm+0x565>
lea    0xc8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xb0(%rbp),%rax
add    $0x12,%rax
mov    %eax,%edi
xor    %ecx,%ecx
mov    $0x10,%edx
mov    %ecx,%esi
call   1040 <set_reg@plt>
cmp    $0x0,%eax
jne    16b7 <init_pwm+0x597>
lea    0xc88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xb0(%rbp),%rax
add    $0x14,%rax
mov    %eax,%edi
xor    %ecx,%ecx
mov    $0x10,%edx
mov    %ecx,%esi
call   1040 <set_reg@plt>
cmp    $0x0,%eax
jne    16e9 <init_pwm+0x5c9>
lea    0xc81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_pwm>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
movapd %xmm0,%xmm1
movsd  0xeb6(%rip),%xmm0
divsd  %xmm1,%xmm0
divsd  0xeb2(%rip),%xmm0
ucomisd 0xeb2(%rip),%xmm0
jbe    1175 <init_pwm+0x45>
lea    0xf09(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %ebx,%ebx
jmp    16f7 <init_pwm+0x5c7>
mov    %rdi,0x10(%rsp)
mov    %rsi,0x18(%rsp)
movsd  %xmm1,0x20(%rsp)
mov    %rdx,0x28(%rsp)
mov    %rcx,0x30(%rsp)
lea    0xe9a(%rip),%r9
lea    0xeb3(%rip),%rbp
mov    $0x1,%r10d
movss  0xe6c(%rip),%xmm8
mov    $0x2,%r11d
movss  0xe61(%rip),%xmm9
mov    $0x3,%r13d
movss  0xe57(%rip),%xmm3
mov    $0x4,%r8d
movss  0xe4d(%rip),%xmm4
mov    $0x5,%esi
movss  0xe44(%rip),%xmm5
mov    $0x6,%edi
movss  0xe3b(%rip),%xmm6
mov    %r9,%r14
xor    %r15d,%r15d
mov    $0x7,%ebx
mov    $0x7,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movss  (%r14),%xmm7
movslq %r12d,%rax
movss  (%r9,%rax,4),%xmm1
mov    %ebx,%edx
mulss  0x0(%rbp,%rdx,4),%xmm1
ucomiss %xmm7,%xmm1
seta   %dl
xorps  %xmm1,%xmm1
cvtss2sd %xmm7,%xmm1
ucomisd %xmm0,%xmm1
seta   %cl
test   %dl,%cl
cmovne %r15d,%eax
mov    $0x0,%ecx
cmovne %ecx,%ebx
movaps %xmm7,%xmm1
addss  %xmm7,%xmm1
cltq
movss  (%r9,%rax,4),%xmm2
mulss  0x0(%rbp,%rbx,4),%xmm2
ucomiss %xmm1,%xmm2
seta   %cl
cvtss2sd %xmm1,%xmm1
ucomisd %xmm0,%xmm1
seta   %dl
test   %cl,%dl
cmovne %r15d,%eax
cmovne %r10d,%ebx
movaps %xmm7,%xmm1
mulss  %xmm8,%xmm1
cltq
movss  (%r9,%rax,4),%xmm2
mulss  0x0(%rbp,%rbx,4),%xmm2
ucomiss %xmm1,%xmm2
seta   %cl
cvtss2sd %xmm1,%xmm1
ucomisd %xmm0,%xmm1
seta   %dl
test   %cl,%dl
cmovne %r15d,%eax
cmovne %r11d,%ebx
movaps %xmm7,%xmm1
mulss  %xmm9,%xmm1
cltq
movss  (%r9,%rax,4),%xmm2
mulss  0x0(%rbp,%rbx,4),%xmm2
ucomiss %xmm1,%xmm2
seta   %cl
cvtss2sd %xmm1,%xmm1
ucomisd %xmm0,%xmm1
seta   %dl
test   %cl,%dl
cmovne %r15d,%eax
cmovne %r13d,%ebx
movaps %xmm7,%xmm1
mulss  %xmm3,%xmm1
cltq
movss  (%r9,%rax,4),%xmm2
mulss  0x0(%rbp,%rbx,4),%xmm2
ucomiss %xmm1,%xmm2
seta   %cl
cvtss2sd %xmm1,%xmm1
ucomisd %xmm0,%xmm1
seta   %dl
test   %cl,%dl
cmovne %r15d,%eax
cmovne %r8d,%ebx
movaps %xmm7,%xmm1
mulss  %xmm4,%xmm1
cltq
movss  (%r9,%rax,4),%xmm2
mulss  0x0(%rbp,%rbx,4),%xmm2
ucomiss %xmm1,%xmm2
seta   %cl
cvtss2sd %xmm1,%xmm1
ucomisd %xmm0,%xmm1
seta   %dl
test   %cl,%dl
cmovne %r15d,%eax
cmovne %esi,%ebx
movaps %xmm7,%xmm1
mulss  %xmm5,%xmm1
cltq
movss  (%r9,%rax,4),%xmm2
mulss  0x0(%rbp,%rbx,4),%xmm2
ucomiss %xmm1,%xmm2
seta   %cl
cvtss2sd %xmm1,%xmm1
ucomisd %xmm0,%xmm1
seta   %dl
test   %cl,%dl
cmovne %r15d,%eax
cmovne %edi,%ebx
mulss  %xmm6,%xmm7
movslq %eax,%r12
movss  (%r9,%r12,4),%xmm1
mulss  0x0(%rbp,%rbx,4),%xmm1
ucomiss %xmm7,%xmm1
seta   %al
xorps  %xmm1,%xmm1
cvtss2sd %xmm7,%xmm1
ucomisd %xmm0,%xmm1
seta   %cl
test   %al,%cl
cmovne %r15d,%r12d
mov    $0x7,%eax
cmovne %eax,%ebx
add    $0x1,%r15
add    $0x4,%r14
cmp    $0x8,%r15
jne    1210 <init_pwm+0xe0>
movslq %r12d,%r15
mov    %ebx,%r14d
mov    0x10(%rsp),%r13
lea    0xd4(%r13),%edi
mov    $0x2,%esi
mov    $0x20,%edx
xor    %ecx,%ecx
call   1050 <set_reg@plt>
test   %eax,%eax
jne    13e2 <init_pwm+0x2b2>
lea    0xcbe(%rip),%rdi
call   1030 <puts@plt>
lea    0xc47(%rip),%rax
movss  (%rax,%r15,4),%xmm0
movss  %xmm0,0x8(%rsp)
lea    0xcc(%r13),%edi
mov    $0x2,%esi
mov    $0x20,%edx
xor    %ecx,%ecx
call   1050 <set_reg@plt>
test   %eax,%eax
jne    141d <init_pwm+0x2ed>
lea    0xcaa(%rip),%rdi
call   1030 <puts@plt>
movss  0x8(%rsp),%xmm0
mulss  0x0(%rbp,%r14,4),%xmm0
movss  %xmm0,0x8(%rsp)
add    $0xd8,%r13d
mov    %r13d,%edi
mov    $0x2,%esi
mov    $0x20,%edx
xor    %ecx,%ecx
call   1050 <set_reg@plt>
test   %eax,%eax
mov    0x28(%rsp),%rbp
jne    1460 <init_pwm+0x330>
lea    0xc8e(%rip),%rdi
call   1030 <puts@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    0x18(%rsp),%rdi
add    $0x664,%edi
mov    $0x7,%esi
mov    $0x20,%edx
xor    %ecx,%ecx
call   1050 <set_reg@plt>
test   %eax,%eax
mov    0x30(%rsp),%r14
jne    14a1 <init_pwm+0x371>
lea    0xc74(%rip),%rdi
call   1030 <puts@plt>
movsd  0xb57(%rip),%xmm0
divsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0x8(%r14),%edi
mov    $0x111,%esi
mov    $0x20,%edx
xor    %ecx,%ecx
call   1050 <set_reg@plt>
test   %eax,%eax
jne    14da <init_pwm+0x3aa>
lea    0xc5f(%rip),%rdi
call   1030 <puts@plt>
movsd  0x8(%rsp),%xmm0
divsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0x200(%rbp),%r15
lea    0x8(%rbp),%edi
mov    $0x111,%esi
mov    $0x20,%edx
xor    %ecx,%ecx
call   1050 <set_reg@plt>
test   %eax,%eax
jne    1517 <init_pwm+0x3e7>
lea    0xc4c(%rip),%rdi
call   1030 <puts@plt>
cvttsd2si 0x8(%rsp),%r13d
shl    $0xa,%r12d
shl    $0x7,%ebx
or     %r12d,%ebx
lea    0x30(%rbx),%esi
mov    %r15d,%edi
mov    $0x10,%edx
xor    %ecx,%ecx
call   1050 <set_reg@plt>
test   %eax,%eax
jne    154a <init_pwm+0x41a>
lea    0xc43(%rip),%rdi
call   1030 <puts@plt>
lea    0x20a(%rbp),%edi
mov    %r13d,%esi
mov    $0x10,%edx
xor    %ecx,%ecx
call   1050 <set_reg@plt>
test   %eax,%eax
jne    156f <init_pwm+0x43f>
lea    0xc49(%rip),%rdi
call   1030 <puts@plt>
lea    0x216(%rbp),%edi
mov    $0x12,%esi
mov    $0x10,%edx
xor    %ecx,%ecx
call   1050 <set_reg@plt>
test   %eax,%eax
jne    1596 <init_pwm+0x466>
lea    0xc4d(%rip),%rdi
call   1030 <puts@plt>
lea    0x218(%rbp),%edi
mov    $0x102,%esi
mov    $0x10,%edx
xor    %ecx,%ecx
call   1050 <set_reg@plt>
test   %eax,%eax
jne    15bd <init_pwm+0x48d>
lea    0xc52(%rip),%rdi
call   1030 <puts@plt>
lea    0x212(%rbp),%edi
xor    %esi,%esi
mov    $0x10,%edx
xor    %ecx,%ecx
call   1050 <set_reg@plt>
test   %eax,%eax
jne    15e1 <init_pwm+0x4b1>
lea    0xc5a(%rip),%rdi
call   1030 <puts@plt>
lea    0x200(%r14),%r15
add    $0x214,%ebp
mov    %ebp,%edi
xor    %esi,%esi
mov    $0x10,%edx
xor    %ecx,%ecx
call   1050 <set_reg@plt>
test   %eax,%eax
jne    160e <init_pwm+0x4de>
lea    0xc57(%rip),%rdi
call   1030 <puts@plt>
mov    %r15d,%edi
mov    %ebx,%esi
mov    $0x10,%edx
xor    %ecx,%ecx
call   1050 <set_reg@plt>
test   %eax,%eax
jne    162f <init_pwm+0x4ff>
lea    0xc60(%rip),%rdi
call   1030 <puts@plt>
lea    0x20a(%r14),%edi
mov    %r13d,%esi
mov    $0x10,%edx
xor    %ecx,%ecx
call   1050 <set_reg@plt>
test   %eax,%eax
jne    1655 <init_pwm+0x525>
lea    0xc65(%rip),%rdi
call   1030 <puts@plt>
lea    0x216(%r14),%edi
mov    $0x12,%esi
mov    $0x10,%edx
xor    %ecx,%ecx
call   1050 <set_reg@plt>
test   %eax,%eax
jne    167d <init_pwm+0x54d>
lea    0xc68(%rip),%rdi
call   1030 <puts@plt>
lea    0x218(%r14),%edi
mov    $0x102,%esi
mov    $0x10,%edx
xor    %ecx,%ecx
call   1050 <set_reg@plt>
test   %eax,%eax
jne    16a5 <init_pwm+0x575>
lea    0xc6c(%rip),%rdi
call   1030 <puts@plt>
lea    0x212(%r14),%edi
xor    %esi,%esi
mov    $0x10,%edx
xor    %ecx,%ecx
call   1050 <set_reg@plt>
test   %eax,%eax
jne    16ca <init_pwm+0x59a>
lea    0xc73(%rip),%rdi
call   1030 <puts@plt>
add    $0x214,%r14d
mov    %r14d,%edi
xor    %esi,%esi
mov    $0x10,%edx
xor    %ecx,%ecx
call   1050 <set_reg@plt>
mov    $0x1,%ebx
test   %eax,%eax
jne    16f7 <init_pwm+0x5c7>
lea    0xc70(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.init_pwm.CLKDIV_div = [8 x float] [float 1.000000e+00, float 2.000000e+00, float 4.000000e+00, float 8.000000e+00, float 1.600000e+01, float 3.200000e+01, float 6.400000e+01, float 1.280000e+02]
@__const.init_pwm.HSPCLKDIV_div = [8 x float] [float 1.000000e+00, float 2.000000e+00, float 4.000000e+00, float 6.000000e+00, float 8.000000e+00, float 1.000000e+01, float 1.200000e+01, float 1.400000e+01]
@.str = [43 x i8] c"value is over than divisor\\\\value : %.3lf\0A\00"
@.str.1 = [40 x i8] c"failed to set register - CMPER_EPWMSS0\0A\00"
@.str.2 = [40 x i8] c"failed to set register - CMPER_EPWMSS1\0A\00"
@.str.3 = [40 x i8] c"failed to set register - CMPER_EPWMSS2\0A\00"
@.str.4 = [37 x i8] c"failed to set register - CTRL_PWMSS\0A\00"
@.str.5 = [43 x i8] c"failed to set register - PWMSS0_CLKCONFIG\0A\00"
@.str.6 = [43 x i8] c"failed to set register - PWMSS1_CLKCONFIG\0A\00"
@.str.7 = [44 x i8] c"failed to set register - PWMSS1_EPWM_TBCTL\0A\00"
@.str.8 = [44 x i8] c"failed to set register - PWMSS1_EPWM_TBPRD\0A\00"
@.str.9 = [45 x i8] c"failed to set register - PWMSS1_EPWM_AQCTLA\0A\00"
@.str.10 = [45 x i8] c"failed to set register - PWMSS1_EPWM_AQCTLB\0A\00"
@.str.11 = [43 x i8] c"failed to set register - PWMSS1_EPWM_CMPA\0A\00"
@.str.12 = [43 x i8] c"failed to set register - PWMSS1_EPWM_CMPB\0A\00"
@.str.13 = [44 x i8] c"failed to set register - PWMSS2_EPWM_TBCTL\0A\00"
@.str.14 = [44 x i8] c"failed to set register - PWMSS2_EPWM_TBPRD\0A\00"
@.str.15 = [45 x i8] c"failed to set register - PWMSS2_EPWM_AQCTLA\0A\00"
@.str.16 = [45 x i8] c"failed to set register - PWMSS2_EPWM_AQCTLB\0A\00"
@.str.17 = [43 x i8] c"failed to set register - PWMSS2_EPWM_CMPA\0A\00"
@.str.18 = [43 x i8] c"failed to set register - PWMSS2_EPWM_CMPB\0A\00"
define i32 @init_pwm(i8* %0, i8* %1, i8* %2, i8* %3, double %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca [8 x float]
%20 = alloca [8 x float]
%21 = alloca i8*
%22 = alloca i8*
store i8* %0, i8** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store double %4, double* %11
store double 1.000000e+08, double* %12
store double 0.000000e+00, double* %13
store i32 7, i32* %16
store i32 7, i32* %17
store i32 0, i32* %18
%23 = bitcast [8 x float]* %19 to i8*
%24 = bitcast [8 x float]* %20 to i8*
%25 = load double, double* %11
%26 = load double, double* %12
%27 = fdiv double %26, %25
store double %27, double* %12
%28 = load double, double* %12
%29 = fdiv double %28, 6.553500e+04
store double %29, double* %13
%30 = load double, double* %13
%31 = fcmp ogt double %30, 1.792000e+03
br i1 %31, label %32, label %35
32: ; preds = %5
%33 = load double, double* %13
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), double %33)
store i32 0, i32* %6
br label %266
35: ; preds = %5
store i32 0, i32* %14
br label %36
36: ; preds = %84, %35
%37 = load i32, i32* %14
%38 = icmp slt i32 %37, 8
br i1 %38, label %39, label %87
39: ; preds = %36
store i32 0, i32* %15
br label %40
40: ; preds = %80, %39
%41 = load i32, i32* %15
%42 = icmp slt i32 %41, 8
br i1 %42, label %43, label %83
43: ; preds = %40
%44 = load i32, i32* %14
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [8 x float], [8 x float]* %19, i64 0, i64 %45
%47 = load float, float* %46
%48 = load i32, i32* %15
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [8 x float], [8 x float]* %20, i64 0, i64 %49
%51 = load float, float* %50
%52 = fmul float %47, %51
%53 = load i32, i32* %16
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [8 x float], [8 x float]* %19, i64 0, i64 %54
%56 = load float, float* %55
%57 = load i32, i32* %17
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [8 x float], [8 x float]* %20, i64 0, i64 %58
%60 = load float, float* %59
%61 = fmul float %56, %60
%62 = fcmp olt float %52, %61
br i1 %62, label %63, label %79
63: ; preds = %43
%64 = load i32, i32* %14
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [8 x float], [8 x float]* %19, i64 0, i64 %65
%67 = load float, float* %66
%68 = load i32, i32* %15
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [8 x float], [8 x float]* %20, i64 0, i64 %69
%71 = load float, float* %70
%72 = fmul float %67, %71
%73 = fpext float %72 to double
%74 = load double, double* %13
%75 = fcmp ogt double %73, %74
br i1 %75, label %76, label %79
76: ; preds = %63
%77 = load i32, i32* %14
store i32 %77, i32* %16
%78 = load i32, i32* %15
store i32 %78, i32* %17
br label %79
79: ; preds = %76, %63, %43
br label %80
80: ; preds = %79
%81 = load i32, i32* %15
%82 = add nsw i32 %81, 1
store i32 %82, i32* %15
br label %40
83: ; preds = %40
br label %84
84: ; preds = %83
%85 = load i32, i32* %14
%86 = add nsw i32 %85, 1
store i32 %86, i32* %14
br label %36
87: ; preds = %36
%88 = load i32, i32* %16
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [8 x float], [8 x float]* %19, i64 0, i64 %89
%91 = load float, float* %90
%92 = load i32, i32* %17
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [8 x float], [8 x float]* %20, i64 0, i64 %93
%95 = load float, float* %94
%96 = fmul float %91, %95
%97 = fpext float %96 to double
%98 = fdiv double 1.000000e+08, %97
%99 = load double, double* %11
%100 = fdiv double %98, %99
%101 = fptosi double %100 to i32
store i32 %101, i32* %18
%102 = load i8*, i8** %9
%103 = getelementptr i8, i8* %102, i64 512
store i8* %103, i8** %21
%104 = load i8*, i8** %10
%105 = getelementptr i8, i8* %104, i64 512
store i8* %105, i8** %22
%106 = load i8*, i8** %7
%107 = getelementptr i8, i8* %106, i64 212
%108 = ptrtoint i8* %107 to i32
%109 = call i32 @set_reg(i32 %108, i32 2, i32 32, i32 0)
%110 = icmp ne i32 %109, 0
br i1 %110, label %113, label %111
111: ; preds = %87
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
br label %113
113: ; preds = %111, %87
%114 = load i8*, i8** %7
%115 = getelementptr i8, i8* %114, i64 204
%116 = ptrtoint i8* %115 to i32
%117 = call i32 @set_reg(i32 %116, i32 2, i32 32, i32 0)
%118 = icmp ne i32 %117, 0
br i1 %118, label %121, label %119
119: ; preds = %113
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
br label %121
121: ; preds = %119, %113
%122 = load i8*, i8** %7
%123 = getelementptr i8, i8* %122, i64 216
%124 = ptrtoint i8* %123 to i32
%125 = call i32 @set_reg(i32 %124, i32 2, i32 32, i32 0)
%126 = icmp ne i32 %125, 0
br i1 %126, label %129, label %127
127: ; preds = %121
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
br label %129
129: ; preds = %127, %121
%130 = load i8*, i8** %8
%131 = getelementptr i8, i8* %130, i64 1636
%132 = ptrtoint i8* %131 to i32
%133 = call i32 @set_reg(i32 %132, i32 7, i32 32, i32 0)
%134 = icmp ne i32 %133, 0
br i1 %134, label %137, label %135
135: ; preds = %129
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
br label %137
137: ; preds = %135, %129
%138 = load i8*, i8** %10
%139 = getelementptr i8, i8* %138, i64 8
%140 = ptrtoint i8* %139 to i32
%141 = call i32 @set_reg(i32 %140, i32 273, i32 32, i32 0)
%142 = icmp ne i32 %141, 0
br i1 %142, label %145, label %143
143: ; preds = %137
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0))
br label %145
145: ; preds = %143, %137
%146 = load i8*, i8** %9
%147 = getelementptr i8, i8* %146, i64 8
%148 = ptrtoint i8* %147 to i32
%149 = call i32 @set_reg(i32 %148, i32 273, i32 32, i32 0)
%150 = icmp ne i32 %149, 0
br i1 %150, label %153, label %151
151: ; preds = %145
%152 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0))
br label %153
153: ; preds = %151, %145
%154 = load i8*, i8** %21
%155 = getelementptr i8, i8* %154, i64 0
%156 = ptrtoint i8* %155 to i32
%157 = load i32, i32* %16
%158 = shl i32 %157, 10
%159 = load i32, i32* %17
%160 = shl i32 %159, 7
%161 = or i32 %158, %160
%162 = or i32 %161, 48
%163 = call i32 @set_reg(i32 %156, i32 %162, i32 16, i32 0)
%164 = icmp ne i32 %163, 0
br i1 %164, label %167, label %165
165: ; preds = %153
%166 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.7, i64 0, i64 0))
br label %167
167: ; preds = %165, %153
%168 = load i8*, i8** %21
%169 = getelementptr i8, i8* %168, i64 10
%170 = ptrtoint i8* %169 to i32
%171 = load i32, i32* %18
%172 = call i32 @set_reg(i32 %170, i32 %171, i32 16, i32 0)
%173 = icmp ne i32 %172, 0
br i1 %173, label %176, label %174
174: ; preds = %167
%175 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0))
br label %176
176: ; preds = %174, %167
%177 = load i8*, i8** %21
%178 = getelementptr i8, i8* %177, i64 22
%179 = ptrtoint i8* %178 to i32
%180 = call i32 @set_reg(i32 %179, i32 18, i32 16, i32 0)
%181 = icmp ne i32 %180, 0
br i1 %181, label %184, label %182
182: ; preds = %176
%183 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.9, i64 0, i64 0))
br label %184
184: ; preds = %182, %176
%185 = load i8*, i8** %21
%186 = getelementptr i8, i8* %185, i64 24
%187 = ptrtoint i8* %186 to i32
%188 = call i32 @set_reg(i32 %187, i32 258, i32 16, i32 0)
%189 = icmp ne i32 %188, 0
br i1 %189, label %192, label %190
190: ; preds = %184
%191 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.10, i64 0, i64 0))
br label %192
192: ; preds = %190, %184
%193 = load i8*, i8** %21
%194 = getelementptr i8, i8* %193, i64 18
%195 = ptrtoint i8* %194 to i32
%196 = call i32 @set_reg(i32 %195, i32 0, i32 16, i32 0)
%197 = icmp ne i32 %196, 0
br i1 %197, label %200, label %198
198: ; preds = %192
%199 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.11, i64 0, i64 0))
br label %200
200: ; preds = %198, %192
%201 = load i8*, i8** %21
%202 = getelementptr i8, i8* %201, i64 20
%203 = ptrtoint i8* %202 to i32
%204 = call i32 @set_reg(i32 %203, i32 0, i32 16, i32 0)
%205 = icmp ne i32 %204, 0
br i1 %205, label %208, label %206
206: ; preds = %200
%207 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.12, i64 0, i64 0))
br label %208
208: ; preds = %206, %200
%209 = load i8*, i8** %22
%210 = getelementptr i8, i8* %209, i64 0
%211 = ptrtoint i8* %210 to i32
%212 = load i32, i32* %16
%213 = shl i32 %212, 10
%214 = load i32, i32* %17
%215 = shl i32 %214, 7
%216 = or i32 %213, %215
%217 = or i32 %216, 0
%218 = or i32 %217, 0
%219 = or i32 %218, 0
%220 = call i32 @set_reg(i32 %211, i32 %219, i32 16, i32 0)
%221 = icmp ne i32 %220, 0
br i1 %221, label %224, label %222
222: ; preds = %208
%223 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.13, i64 0, i64 0))
br label %224
224: ; preds = %222, %208
%225 = load i8*, i8** %22
%226 = getelementptr i8, i8* %225, i64 10
%227 = ptrtoint i8* %226 to i32
%228 = load i32, i32* %18
%229 = call i32 @set_reg(i32 %227, i32 %228, i32 16, i32 0)
%230 = icmp ne i32 %229, 0
br i1 %230, label %233, label %231
231: ; preds = %224
%232 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.14, i64 0, i64 0))
br label %233
233: ; preds = %231, %224
%234 = load i8*, i8** %22
%235 = getelementptr i8, i8* %234, i64 22
%236 = ptrtoint i8* %235 to i32
%237 = call i32 @set_reg(i32 %236, i32 18, i32 16, i32 0)
%238 = icmp ne i32 %237, 0
br i1 %238, label %241, label %239
239: ; preds = %233
%240 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.15, i64 0, i64 0))
br label %241
241: ; preds = %239, %233
%242 = load i8*, i8** %22
%243 = getelementptr i8, i8* %242, i64 24
%244 = ptrtoint i8* %243 to i32
%245 = call i32 @set_reg(i32 %244, i32 258, i32 16, i32 0)
%246 = icmp ne i32 %245, 0
br i1 %246, label %249, label %247
247: ; preds = %241
%248 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.16, i64 0, i64 0))
br label %249
249: ; preds = %247, %241
%250 = load i8*, i8** %22
%251 = getelementptr i8, i8* %250, i64 18
%252 = ptrtoint i8* %251 to i32
%253 = call i32 @set_reg(i32 %252, i32 0, i32 16, i32 0)
%254 = icmp ne i32 %253, 0
br i1 %254, label %257, label %255
255: ; preds = %249
%256 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.17, i64 0, i64 0))
br label %257
257: ; preds = %255, %249
%258 = load i8*, i8** %22
%259 = getelementptr i8, i8* %258, i64 20
%260 = ptrtoint i8* %259 to i32
%261 = call i32 @set_reg(i32 %260, i32 0, i32 16, i32 0)
%262 = icmp ne i32 %261, 0
br i1 %262, label %265, label %263
263: ; preds = %257
%264 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.18, i64 0, i64 0))
br label %265
265: ; preds = %263, %257
store i32 1, i32* %6
br label %266
266: ; preds = %265, %32
%267 = load i32, i32* %6
ret i32 %267
}

LLVM IR (-O2):
@__const.init_pwm.CLKDIV_div = [8 x float] [float 1.000000e+00, float 2.000000e+00, float 4.000000e+00, float 8.000000e+00, float 1.600000e+01, float 3.200000e+01, float 6.400000e+01, float 1.280000e+02]
@__const.init_pwm.HSPCLKDIV_div = [8 x float] [float 1.000000e+00, float 2.000000e+00, float 4.000000e+00, float 6.000000e+00, float 8.000000e+00, float 1.000000e+01, float 1.200000e+01, float 1.400000e+01]
@.str = [43 x i8] c"value is over than divisor\\\\value : %.3lf\0A\00"
@str = [39 x i8] c"failed to set register - CMPER_EPWMSS0\00"
@str.19 = [39 x i8] c"failed to set register - CMPER_EPWMSS1\00"
@str.20 = [39 x i8] c"failed to set register - CMPER_EPWMSS2\00"
@str.21 = [36 x i8] c"failed to set register - CTRL_PWMSS\00"
@str.22 = [42 x i8] c"failed to set register - PWMSS0_CLKCONFIG\00"
@str.23 = [42 x i8] c"failed to set register - PWMSS1_CLKCONFIG\00"
@str.24 = [43 x i8] c"failed to set register - PWMSS1_EPWM_TBCTL\00"
@str.25 = [43 x i8] c"failed to set register - PWMSS1_EPWM_TBPRD\00"
@str.26 = [44 x i8] c"failed to set register - PWMSS1_EPWM_AQCTLA\00"
@str.27 = [44 x i8] c"failed to set register - PWMSS1_EPWM_AQCTLB\00"
@str.28 = [42 x i8] c"failed to set register - PWMSS1_EPWM_CMPA\00"
@str.29 = [42 x i8] c"failed to set register - PWMSS1_EPWM_CMPB\00"
@str.30 = [43 x i8] c"failed to set register - PWMSS2_EPWM_TBCTL\00"
@str.31 = [43 x i8] c"failed to set register - PWMSS2_EPWM_TBPRD\00"
@str.32 = [44 x i8] c"failed to set register - PWMSS2_EPWM_AQCTLA\00"
@str.33 = [44 x i8] c"failed to set register - PWMSS2_EPWM_AQCTLB\00"
@str.34 = [42 x i8] c"failed to set register - PWMSS2_EPWM_CMPA\00"
@str.35 = [42 x i8] c"failed to set register - PWMSS2_EPWM_CMPB\00"
define i32 @init_pwm(i8* %0, i8* %1, i8* %2, i8* %3, double %4) {
%6 = fdiv double 1.000000e+08, %4
%7 = fdiv double %6, 6.553500e+04
%8 = fcmp ogt double %7, 1.792000e+03
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), double %7)
br label %290
11: ; preds = %5, %11
%12 = phi i64 [ %129, %11 ], [ 0, %5 ]
%13 = phi i32 [ %128, %11 ], [ 7, %5 ]
%14 = phi i32 [ %127, %11 ], [ 7, %5 ]
%15 = getelementptr inbounds [8 x float], [8 x float]* @__const.init_pwm.CLKDIV_div, i64 0, i64 %12
%16 = load float, float* %15
%17 = sext i32 %14 to i64
%18 = getelementptr inbounds [8 x float], [8 x float]* @__const.init_pwm.CLKDIV_div, i64 0, i64 %17
%19 = load float, float* %18
%20 = zext i32 %13 to i64
%21 = getelementptr inbounds [8 x float], [8 x float]* @__const.init_pwm.HSPCLKDIV_div, i64 0, i64 %20
%22 = load float, float* %21
%23 = fmul float %19, %22
%24 = fcmp olt float %16, %23
%25 = fpext float %16 to double
%26 = fcmp olt double %7, %25
%27 = and i1 %26, %24
%28 = trunc i64 %12 to i32
%29 = select i1 %27, i32 %28, i32 %14
%30 = select i1 %27, i32 0, i32 %13
%31 = fmul float %16, 2.000000e+00
%32 = sext i32 %29 to i64
%33 = getelementptr inbounds [8 x float], [8 x float]* @__const.init_pwm.CLKDIV_div, i64 0, i64 %32
%34 = load float, float* %33
%35 = zext i32 %30 to i64
%36 = getelementptr inbounds [8 x float], [8 x float]* @__const.init_pwm.HSPCLKDIV_div, i64 0, i64 %35
%37 = load float, float* %36
%38 = fmul float %34, %37
%39 = fcmp olt float %31, %38
%40 = fpext float %31 to double
%41 = fcmp olt double %7, %40
%42 = and i1 %41, %39
%43 = select i1 %42, i32 %28, i32 %29
%44 = select i1 %42, i32 1, i32 %30
%45 = fmul float %16, 4.000000e+00
%46 = sext i32 %43 to i64
%47 = getelementptr inbounds [8 x float], [8 x float]* @__const.init_pwm.CLKDIV_div, i64 0, i64 %46
%48 = load float, float* %47
%49 = zext i32 %44 to i64
%50 = getelementptr inbounds [8 x float], [8 x float]* @__const.init_pwm.HSPCLKDIV_div, i64 0, i64 %49
%51 = load float, float* %50
%52 = fmul float %48, %51
%53 = fcmp olt float %45, %52
%54 = fpext float %45 to double
%55 = fcmp olt double %7, %54
%56 = and i1 %55, %53
%57 = select i1 %56, i32 %28, i32 %43
%58 = select i1 %56, i32 2, i32 %44
%59 = fmul float %16, 6.000000e+00
%60 = sext i32 %57 to i64
%61 = getelementptr inbounds [8 x float], [8 x float]* @__const.init_pwm.CLKDIV_div, i64 0, i64 %60
%62 = load float, float* %61
%63 = zext i32 %58 to i64
%64 = getelementptr inbounds [8 x float], [8 x float]* @__const.init_pwm.HSPCLKDIV_div, i64 0, i64 %63
%65 = load float, float* %64
%66 = fmul float %62, %65
%67 = fcmp olt float %59, %66
%68 = fpext float %59 to double
%69 = fcmp olt double %7, %68
%70 = and i1 %69, %67
%71 = select i1 %70, i32 %28, i32 %57
%72 = select i1 %70, i32 3, i32 %58
%73 = fmul float %16, 8.000000e+00
%74 = sext i32 %71 to i64
%75 = getelementptr inbounds [8 x float], [8 x float]* @__const.init_pwm.CLKDIV_div, i64 0, i64 %74
%76 = load float, float* %75
%77 = zext i32 %72 to i64
%78 = getelementptr inbounds [8 x float], [8 x float]* @__const.init_pwm.HSPCLKDIV_div, i64 0, i64 %77
%79 = load float, float* %78
%80 = fmul float %76, %79
%81 = fcmp olt float %73, %80
%82 = fpext float %73 to double
%83 = fcmp olt double %7, %82
%84 = and i1 %83, %81
%85 = select i1 %84, i32 %28, i32 %71
%86 = select i1 %84, i32 4, i32 %72
%87 = fmul float %16, 1.000000e+01
%88 = sext i32 %85 to i64
%89 = getelementptr inbounds [8 x float], [8 x float]* @__const.init_pwm.CLKDIV_div, i64 0, i64 %88
%90 = load float, float* %89
%91 = zext i32 %86 to i64
%92 = getelementptr inbounds [8 x float], [8 x float]* @__const.init_pwm.HSPCLKDIV_div, i64 0, i64 %91
%93 = load float, float* %92
%94 = fmul float %90, %93
%95 = fcmp olt float %87, %94
%96 = fpext float %87 to double
%97 = fcmp olt double %7, %96
%98 = and i1 %97, %95
%99 = select i1 %98, i32 %28, i32 %85
%100 = select i1 %98, i32 5, i32 %86
%101 = fmul float %16, 1.200000e+01
%102 = sext i32 %99 to i64
%103 = getelementptr inbounds [8 x float], [8 x float]* @__const.init_pwm.CLKDIV_div, i64 0, i64 %102
%104 = load float, float* %103
%105 = zext i32 %100 to i64
%106 = getelementptr inbounds [8 x float], [8 x float]* @__const.init_pwm.HSPCLKDIV_div, i64 0, i64 %105
%107 = load float, float* %106
%108 = fmul float %104, %107
%109 = fcmp olt float %101, %108
%110 = fpext float %101 to double
%111 = fcmp olt double %7, %110
%112 = and i1 %111, %109
%113 = select i1 %112, i32 %28, i32 %99
%114 = select i1 %112, i32 6, i32 %100
%115 = fmul float %16, 1.400000e+01
%116 = sext i32 %113 to i64
%117 = getelementptr inbounds [8 x float], [8 x float]* @__const.init_pwm.CLKDIV_div, i64 0, i64 %116
%118 = load float, float* %117
%119 = zext i32 %114 to i64
%120 = getelementptr inbounds [8 x float], [8 x float]* @__const.init_pwm.HSPCLKDIV_div, i64 0, i64 %119
%121 = load float, float* %120
%122 = fmul float %118, %121
%123 = fcmp olt float %115, %122
%124 = fpext float %115 to double
%125 = fcmp olt double %7, %124
%126 = and i1 %125, %123
%127 = select i1 %126, i32 %28, i32 %113
%128 = select i1 %126, i32 7, i32 %114
%129 = add nuw nsw i64 %12, 1
%130 = icmp eq i64 %129, 8
br i1 %130, label %131, label %11
131: ; preds = %11
%132 = sext i32 %127 to i64
%133 = getelementptr inbounds [8 x float], [8 x float]* @__const.init_pwm.CLKDIV_div, i64 0, i64 %132
%134 = load float, float* %133
%135 = zext i32 %128 to i64
%136 = getelementptr inbounds [8 x float], [8 x float]* @__const.init_pwm.HSPCLKDIV_div, i64 0, i64 %135
%137 = load float, float* %136
%138 = fmul float %134, %137
%139 = fpext float %138 to double
%140 = fdiv double 1.000000e+08, %139
%141 = fdiv double %140, %4
%142 = fptosi double %141 to i32
%143 = getelementptr i8, i8* %2, i64 512
%144 = getelementptr i8, i8* %3, i64 512
%145 = getelementptr i8, i8* %0, i64 212
%146 = ptrtoint i8* %145 to i64
%147 = trunc i64 %146 to i32
%148 = tail call i32 @set_reg(i32 %147, i32 2, i32 32, i32 0)
%149 = icmp eq i32 %148, 0
br i1 %149, label %150, label %152
150: ; preds = %131
%151 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
br label %152
152: ; preds = %150, %131
%153 = getelementptr i8, i8* %0, i64 204
%154 = ptrtoint i8* %153 to i64
%155 = trunc i64 %154 to i32
%156 = tail call i32 @set_reg(i32 %155, i32 2, i32 32, i32 0)
%157 = icmp eq i32 %156, 0
br i1 %157, label %158, label %160
158: ; preds = %152
%159 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.19, i64 0, i64 0))
br label %160
160: ; preds = %158, %152
%161 = getelementptr i8, i8* %0, i64 216
%162 = ptrtoint i8* %161 to i64
%163 = trunc i64 %162 to i32
%164 = tail call i32 @set_reg(i32 %163, i32 2, i32 32, i32 0)
%165 = icmp eq i32 %164, 0
br i1 %165, label %166, label %168
166: ; preds = %160
%167 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.20, i64 0, i64 0))
br label %168
168: ; preds = %166, %160
%169 = getelementptr i8, i8* %1, i64 1636
%170 = ptrtoint i8* %169 to i64
%171 = trunc i64 %170 to i32
%172 = tail call i32 @set_reg(i32 %171, i32 7, i32 32, i32 0)
%173 = icmp eq i32 %172, 0
br i1 %173, label %174, label %176
174: ; preds = %168
%175 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.21, i64 0, i64 0))
br label %176
176: ; preds = %174, %168
%177 = getelementptr i8, i8* %3, i64 8
%178 = ptrtoint i8* %177 to i64
%179 = trunc i64 %178 to i32
%180 = tail call i32 @set_reg(i32 %179, i32 273, i32 32, i32 0)
%181 = icmp eq i32 %180, 0
br i1 %181, label %182, label %184
182: ; preds = %176
%183 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.22, i64 0, i64 0))
br label %184
184: ; preds = %182, %176
%185 = getelementptr i8, i8* %2, i64 8
%186 = ptrtoint i8* %185 to i64
%187 = trunc i64 %186 to i32
%188 = tail call i32 @set_reg(i32 %187, i32 273, i32 32, i32 0)
%189 = icmp eq i32 %188, 0
br i1 %189, label %190, label %192
190: ; preds = %184
%191 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.23, i64 0, i64 0))
br label %192
192: ; preds = %190, %184
%193 = ptrtoint i8* %143 to i64
%194 = trunc i64 %193 to i32
%195 = shl i32 %127, 10
%196 = shl i32 %128, 7
%197 = or i32 %196, %195
%198 = or i32 %197, 48
%199 = tail call i32 @set_reg(i32 %194, i32 %198, i32 16, i32 0)
%200 = icmp eq i32 %199, 0
br i1 %200, label %201, label %203
201: ; preds = %192
%202 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.24, i64 0, i64 0))
br label %203
203: ; preds = %201, %192
%204 = getelementptr i8, i8* %2, i64 522
%205 = ptrtoint i8* %204 to i64
%206 = trunc i64 %205 to i32
%207 = tail call i32 @set_reg(i32 %206, i32 %142, i32 16, i32 0)
%208 = icmp eq i32 %207, 0
br i1 %208, label %209, label %211
209: ; preds = %203
%210 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.25, i64 0, i64 0))
br label %211
211: ; preds = %209, %203
%212 = getelementptr i8, i8* %2, i64 534
%213 = ptrtoint i8* %212 to i64
%214 = trunc i64 %213 to i32
%215 = tail call i32 @set_reg(i32 %214, i32 18, i32 16, i32 0)
%216 = icmp eq i32 %215, 0
br i1 %216, label %217, label %219
217: ; preds = %211
%218 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.26, i64 0, i64 0))
br label %219
219: ; preds = %217, %211
%220 = getelementptr i8, i8* %2, i64 536
%221 = ptrtoint i8* %220 to i64
%222 = trunc i64 %221 to i32
%223 = tail call i32 @set_reg(i32 %222, i32 258, i32 16, i32 0)
%224 = icmp eq i32 %223, 0
br i1 %224, label %225, label %227
225: ; preds = %219
%226 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.27, i64 0, i64 0))
br label %227
227: ; preds = %225, %219
%228 = getelementptr i8, i8* %2, i64 530
%229 = ptrtoint i8* %228 to i64
%230 = trunc i64 %229 to i32
%231 = tail call i32 @set_reg(i32 %230, i32 0, i32 16, i32 0)
%232 = icmp eq i32 %231, 0
br i1 %232, label %233, label %235
233: ; preds = %227
%234 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.28, i64 0, i64 0))
br label %235
235: ; preds = %233, %227
%236 = getelementptr i8, i8* %2, i64 532
%237 = ptrtoint i8* %236 to i64
%238 = trunc i64 %237 to i32
%239 = tail call i32 @set_reg(i32 %238, i32 0, i32 16, i32 0)
%240 = icmp eq i32 %239, 0
br i1 %240, label %241, label %243
241: ; preds = %235
%242 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.29, i64 0, i64 0))
br label %243
243: ; preds = %241, %235
%244 = ptrtoint i8* %144 to i64
%245 = trunc i64 %244 to i32
%246 = tail call i32 @set_reg(i32 %245, i32 %197, i32 16, i32 0)
%247 = icmp eq i32 %246, 0
br i1 %247, label %248, label %250
248: ; preds = %243
%249 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.30, i64 0, i64 0))
br label %250
250: ; preds = %248, %243
%251 = getelementptr i8, i8* %3, i64 522
%252 = ptrtoint i8* %251 to i64
%253 = trunc i64 %252 to i32
%254 = tail call i32 @set_reg(i32 %253, i32 %142, i32 16, i32 0)
%255 = icmp eq i32 %254, 0
br i1 %255, label %256, label %258
256: ; preds = %250
%257 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.31, i64 0, i64 0))
br label %258
258: ; preds = %256, %250
%259 = getelementptr i8, i8* %3, i64 534
%260 = ptrtoint i8* %259 to i64
%261 = trunc i64 %260 to i32
%262 = tail call i32 @set_reg(i32 %261, i32 18, i32 16, i32 0)
%263 = icmp eq i32 %262, 0
br i1 %263, label %264, label %266
264: ; preds = %258
%265 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.32, i64 0, i64 0))
br label %266
266: ; preds = %264, %258
%267 = getelementptr i8, i8* %3, i64 536
%268 = ptrtoint i8* %267 to i64
%269 = trunc i64 %268 to i32
%270 = tail call i32 @set_reg(i32 %269, i32 258, i32 16, i32 0)
%271 = icmp eq i32 %270, 0
br i1 %271, label %272, label %274
272: ; preds = %266
%273 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.33, i64 0, i64 0))
br label %274
274: ; preds = %272, %266
%275 = getelementptr i8, i8* %3, i64 530
%276 = ptrtoint i8* %275 to i64
%277 = trunc i64 %276 to i32
%278 = tail call i32 @set_reg(i32 %277, i32 0, i32 16, i32 0)
%279 = icmp eq i32 %278, 0
br i1 %279, label %280, label %282
280: ; preds = %274
%281 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.34, i64 0, i64 0))
br label %282
282: ; preds = %280, %274
%283 = getelementptr i8, i8* %3, i64 532
%284 = ptrtoint i8* %283 to i64
%285 = trunc i64 %284 to i32
%286 = tail call i32 @set_reg(i32 %285, i32 0, i32 16, i32 0)
%287 = icmp eq i32 %286, 0
br i1 %287, label %288, label %290
288: ; preds = %282
%289 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.35, i64 0, i64 0))
br label %290
290: ; preds = %282, %288, %9
%291 = phi i32 [ 0, %9 ], [ 1, %288 ], [ 1, %282 ]
ret i32 %291
}