#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 ln1(char len) {
  char i;
  for (i = 0; i < len; i++) {
    if (i % 12 == 10)
      putchar(42);
    else if (i % 4 == 2)
      putchar(35);
    else
      putchar(46);
  }
  putchar(10);
}


x86 assembly (clang, -O0):
<ln1>:
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    119b <ln1+0x8b>
movsbl -0x2(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
cmp    $0xa,%edx
jne    1156 <ln1+0x46>
mov    $0x2a,%edi
call   1030 <putchar@plt>
jmp    1189 <ln1+0x79>
movsbl -0x2(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x2,%edx
jne    117a <ln1+0x6a>
mov    $0x23,%edi
call   1030 <putchar@plt>
jmp    1184 <ln1+0x74>
mov    $0x2e,%edi
call   1030 <putchar@plt>
jmp    1189 <ln1+0x79>
jmp    118e <ln1+0x7e>
mov    -0x2(%rbp),%al
add    $0x1,%al
mov    %al,-0x2(%rbp)
jmp    1122 <ln1+0x12>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ln1>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
test   %bl,%bl
jle    1170 <ln1+0x60>
xor    %ebp,%ebp
mov    $0x23,%r14d
jmp    113e <ln1+0x2e>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
call   1030 <putchar@plt>
add    $0x1,%bpl
cmp    %bpl,%bl
je     1170 <ln1+0x60>
movzbl %bpl,%ecx
imul   $0xab,%ecx,%eax
shr    $0x9,%eax
and    $0xfffffffc,%eax
lea    (%rax,%rax,2),%edx
add    $0xa,%dl
mov    %ecx,%eax
and    $0x3,%al
cmp    $0x2,%al
mov    $0x2e,%eax
cmove  %r14d,%eax
mov    $0x2a,%edi
cmp    %cl,%dl
je     1130 <ln1+0x20>
mov    %eax,%edi
jmp    1130 <ln1+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @ln1(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
store i8 0, i8* %3
br label %4
4: ; preds = %28, %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 %31
10: ; preds = %4
%11 = load i8, i8* %3
%12 = sext i8 %11 to i32
%13 = srem i32 %12, 12
%14 = icmp eq i32 %13, 10
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = call i32 @putchar(i32 42)
br label %27
17: ; preds = %10
%18 = load i8, i8* %3
%19 = sext i8 %18 to i32
%20 = srem i32 %19, 4
%21 = icmp eq i32 %20, 2
br i1 %21, label %22, label %24
22: ; preds = %17
%23 = call i32 @putchar(i32 35)
br label %26
24: ; preds = %17
%25 = call i32 @putchar(i32 46)
br label %26
26: ; preds = %24, %22
br label %27
27: ; preds = %26, %15
br label %28
28: ; preds = %27
%29 = load i8, i8* %3
%30 = add i8 %29, 1
store i8 %30, i8* %3
br label %4
31: ; preds = %4
%32 = call i32 @putchar(i32 10)
ret void
}

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