#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 getPWMBit(int);
int /*<<< orphan*/ printf(char *, ...);
void dumpPWMBuffer(void) {
  int i;
  printf("Dumping PWM output buffer:\n");
  for (i = 0; i < 1016 * 32; i++) {
    printf("%d", getPWMBit(i));
    if (i != 0 && i % 72 == 71) {
      printf("\n");
    } else if (i % 3 == 2) {
      if (i % 8 == 7) {
        printf(" ");
      } else {
        printf(":");
      }
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<dumpPWMBuffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x7f00,-0x4(%rbp)
jge    11f9 <dumpPWMBuffer+0xd9>
mov    -0x4(%rbp),%edi
call   1040 <getPWMBit@plt>
mov    %eax,%esi
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x4(%rbp)
je     1193 <dumpPWMBuffer+0x73>
mov    -0x4(%rbp),%eax
mov    $0x48,%ecx
cltd
idiv   %ecx
cmp    $0x47,%edx
jne    1193 <dumpPWMBuffer+0x73>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e6 <dumpPWMBuffer+0xc6>
mov    -0x4(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x2,%edx
jne    11e1 <dumpPWMBuffer+0xc1>
mov    -0x4(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x7,%edx
jne    11ce <dumpPWMBuffer+0xae>
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11dc <dumpPWMBuffer+0xbc>
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e1 <dumpPWMBuffer+0xc1>
jmp    11e6 <dumpPWMBuffer+0xc6>
jmp    11eb <dumpPWMBuffer+0xcb>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113d <dumpPWMBuffer+0x1d>
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dumpPWMBuffer>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xeb5(%rip),%rdi
call   1040 <puts@plt>
lea    0xea6(%rip),%r15
mov    $0x20,%r14d
xor    %ebp,%ebp
jmp    1180 <dumpPWMBuffer+0x40>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    $0x7f00,%ebp
je     11dc <dumpPWMBuffer+0x9c>
movzwl %bp,%ebx
mov    %ebp,%edi
call   1060 <getPWMBit@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
test   %ebp,%ebp
je     11b7 <dumpPWMBuffer+0x77>
imul   $0xe38f,%ebx,%eax
shr    $0x16,%eax
lea    (%rax,%rax,8),%eax
lea    0x47(,%rax,8),%eax
mov    $0xa,%edi
cmp    %bx,%ax
je     1170 <dumpPWMBuffer+0x30>
imul   $0xaaab,%ebx,%eax
shr    $0x11,%eax
lea    (%rax,%rax,2),%eax
add    $0x2,%eax
cmp    %bp,%ax
jne    1175 <dumpPWMBuffer+0x35>
mov    %ebp,%eax
not    %eax
test   $0x7,%al
mov    $0x3a,%edi
cmove  %r14d,%edi
jmp    1170 <dumpPWMBuffer+0x30>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"Dumping PWM output buffer:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [2 x i8] c":\00"
define void @dumpPWMBuffer() {
%1 = alloca i32
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %3
3: ; preds = %33, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 32512
br i1 %5, label %6, label %36
6: ; preds = %3
%7 = load i32, i32* %1
%8 = call i32 @getPWMBit(i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %1
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %6
%13 = load i32, i32* %1
%14 = srem i32 %13, 72
%15 = icmp eq i32 %14, 71
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %32
18: ; preds = %12, %6
%19 = load i32, i32* %1
%20 = srem i32 %19, 3
%21 = icmp eq i32 %20, 2
br i1 %21, label %22, label %31
22: ; preds = %18
%23 = load i32, i32* %1
%24 = srem i32 %23, 8
%25 = icmp eq i32 %24, 7
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %30
28: ; preds = %22
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %30
30: ; preds = %28, %26
br label %31
31: ; preds = %30, %18
br label %32
32: ; preds = %31, %16
br label %33
33: ; preds = %32
%34 = load i32, i32* %1
%35 = add nsw i32 %34, 1
store i32 %35, i32* %1
br label %3
36: ; preds = %3
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [27 x i8] c"Dumping PWM output buffer:\00"
define void @dumpPWMBuffer() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %0, %21
%3 = phi i32 [ 0, %0 ], [ %22, %21 ]
%4 = tail call i32 @getPWMBit(i32 %3)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = icmp ne i32 %3, 0
%7 = trunc i32 %3 to i16
%8 = urem i16 %7, 72
%9 = icmp eq i16 %8, 71
%10 = and i1 %6, %9
br i1 %10, label %18, label %11
11: ; preds = %2
%12 = urem i16 %7, 3
%13 = icmp eq i16 %12, 2
br i1 %13, label %14, label %21
14: ; preds = %11
%15 = and i32 %3, 7
%16 = icmp eq i32 %15, 7
%17 = select i1 %16, i32 32, i32 58
br label %18
18: ; preds = %14, %2
%19 = phi i32 [ 10, %2 ], [ %17, %14 ]
%20 = tail call i32 @putchar(i32 %19)
br label %21
21: ; preds = %18, %11
%22 = add nuw nsw i32 %3, 1
%23 = icmp eq i32 %22, 32512
br i1 %23, label %24, label %2
24: ; preds = %21
%25 = tail call i32 @putchar(i32 10)
ret void
}