#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*/ putchar(char);
void first(size_t len) {
  printf("..#..");
  for (int i = 1; i < len; i++)
    printf(i % 3 == 2 ? ".*.." : ".#..");
  putchar('\n');
}


x86 assembly (clang, -O0):
<first>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0xc(%rbp)
movslq -0xc(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    1180 <first+0x60>
mov    -0xc(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
lea    0xea2(%rip),%rdi
lea    0xea0(%rip),%rax
cmp    $0x2,%edx
cmove  %rax,%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113f <first+0x1f>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<first>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r13
lea    0xecb(%rip),%rdi
call   1040 <printf@plt>
cmp    $0x2,%r13
jb     119a <first+0x7a>
add    $0xffffffffffffffff,%r13
mov    $0x1,%ebp
mov    $0xaaaaaaab,%r14d
lea    0xeb0(%rip),%r15
lea    0xea4(%rip),%r12
mov    $0x1,%ebx
jmp    1181 <first+0x61>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
call   1040 <printf@plt>
add    $0xffffffff,%ebx
add    $0x1,%ebp
add    $0xffffffffffffffff,%r13
je     119a <first+0x7a>
mov    %ebp,%eax
imul   %r14,%rax
shr    $0x21,%rax
lea    (%rax,%rax,2),%eax
mov    %r15,%rdi
add    %ebx,%eax
je     1170 <first+0x50>
mov    %r12,%rdi
jmp    1170 <first+0x50>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"..#..\00"
@.str.1 = [5 x i8] c".*..\00"
@.str.2 = [5 x i8] c".#..\00"
define void @first(i64 %0) {
%2 = alloca i64
%3 = alloca i32
store i64 %0, i64* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %5
5: ; preds = %17, %1
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = load i64, i64* %2
%9 = icmp ult i64 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %5
%11 = load i32, i32* %3
%12 = srem i32 %11, 3
%13 = icmp eq i32 %12, 2
%14 = zext i1 %13 to i64
%15 = select i1 %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%16 = call i32 @printf(i8* %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %5
20: ; preds = %5
%21 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"..#..\00"
@.str.1 = [5 x i8] c".*..\00"
@.str.2 = [5 x i8] c".#..\00"
define void @first(i64 %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = icmp ugt i64 %0, 1
br i1 %3, label %6, label %4
4: ; preds = %6, %1
%5 = tail call i32 @putchar(i8 signext 10)
ret void
6: ; preds = %1, %6
%7 = phi i64 [ %13, %6 ], [ 1, %1 ]
%8 = trunc i64 %7 to i32
%9 = urem i32 %8, 3
%10 = icmp eq i32 %9, 2
%11 = select i1 %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%12 = tail call i32 @printf(i8* dereferenceable(1) %11)
%13 = add nuw i64 %7, 1
%14 = icmp eq i64 %13, %0
br i1 %14, label %4, label %6
}