#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*/ putchar(int);
void ln2(char len) {
  char i;
  for (i = 0; i < len; i++) {
    if (i % 12 == 9 || i % 12 == 11)
      putchar(42);
    else if (i % 2)
      putchar(35);
    else
      putchar(46);
  }
  putchar(10);
}


x86 assembly (clang, -O0):
<ln2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movb   $0x0,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
movsbl -0x1(%rbp),%ecx
cmp    %ecx,%eax
jge    11b0 <ln2+0xa0>
movsbl -0x2(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
cmp    $0x9,%edx
je     115c <ln2+0x4c>
movsbl -0x2(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
cmp    $0xb,%edx
jne    116b <ln2+0x5b>
mov    $0x2a,%edi
call   1030 <putchar@plt>
jmp    119e <ln2+0x8e>
movsbl -0x2(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     118f <ln2+0x7f>
mov    $0x23,%edi
call   1030 <putchar@plt>
jmp    1199 <ln2+0x89>
mov    $0x2e,%edi
call   1030 <putchar@plt>
jmp    119e <ln2+0x8e>
jmp    11a3 <ln2+0x93>
mov    -0x2(%rbp),%al
add    $0x1,%al
mov    %al,-0x2(%rbp)
jmp    1122 <ln2+0x12>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ln2>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
test   %bl,%bl
jle    116d <ln2+0x5d>
xor    %ebp,%ebp
mov    $0xaaaaaaab,%r14d
mov    $0x2e,%r15d
jmp    113d <ln2+0x2d>
nopl   (%rax)
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    %bpl,%bl
je     116d <ln2+0x5d>
mov    %ebp,%eax
imul   %r14,%rax
shr    $0x23,%rax
shl    $0x2,%eax
lea    (%rax,%rax,2),%eax
mov    %ebp,%ecx
sub    %eax,%ecx
mov    $0x2a,%edi
or     $0x2,%ecx
cmp    $0xb,%ecx
je     1130 <ln2+0x20>
test   $0x1,%bpl
mov    $0x23,%edi
cmove  %r15d,%edi
jmp    1130 <ln2+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @ln2(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
store i8 0, i8* %3
br label %4
4: ; preds = %33, %1
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp slt i32 %6, %8
br i1 %9, label %10, label %36
10: ; preds = %4
%11 = load i8, i8* %3
%12 = sext i8 %11 to i32
%13 = srem i32 %12, 12
%14 = icmp eq i32 %13, 9
br i1 %14, label %20, label %15
15: ; preds = %10
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = srem i32 %17, 12
%19 = icmp eq i32 %18, 11
br i1 %19, label %20, label %22
20: ; preds = %15, %10
%21 = call i32 @putchar(i32 42)
br label %32
22: ; preds = %15
%23 = load i8, i8* %3
%24 = sext i8 %23 to i32
%25 = srem i32 %24, 2
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %22
%28 = call i32 @putchar(i32 35)
br label %31
29: ; preds = %22
%30 = call i32 @putchar(i32 46)
br label %31
31: ; preds = %29, %27
br label %32
32: ; preds = %31, %20
br label %33
33: ; preds = %32
%34 = load i8, i8* %3
%35 = add i8 %34, 1
store i8 %35, i8* %3
br label %4
36: ; preds = %4
%37 = call i32 @putchar(i32 10)
ret void
}

LLVM IR (-O2):
define void @ln2(i8 signext %0) {
%2 = icmp sgt i8 %0, 0
br i1 %2, label %3, label %16
3: ; preds = %1, %11
%4 = phi i8 [ %14, %11 ], [ 0, %1 ]
%5 = urem i8 %4, 12
%6 = zext i8 %5 to i32
switch i32 %6, label %7 [
i32 9, label %11
i32 11, label %11
]
7: ; preds = %3
%8 = and i8 %4, 1
%9 = icmp eq i8 %8, 0
%10 = select i1 %9, i32 46, i32 35
br label %11
11: ; preds = %7, %3, %3
%12 = phi i32 [ 42, %3 ], [ 42, %3 ], [ %10, %7 ]
%13 = tail call i32 @putchar(i32 %12)
%14 = add nuw nsw i8 %4, 1
%15 = icmp eq i8 %14, %0
br i1 %15, label %16, label %3
16: ; preds = %11, %1
%17 = tail call i32 @putchar(i32 10)
ret void
}