#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 *, char);
int /*<<< orphan*/ puts(char *);
int strlen(char *);
void ln3(char *s) {
  char i;
  printf("#.%c.", *s);
  for (i = 1; i < strlen(s); i++) {
    if (i % 3 == 1)
      printf("#.%c.", s[i]);
    else
      printf("*.%c.", s[i]);
  }
  if (strlen(s) % 3)
    puts("#");
  else
    puts("*");
}


x86 assembly (clang, -O0):
<ln3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
lea    0xeb9(%rip),%rdi
movsbl (%rax),%esi
call   1050 <printf@plt>
movb   $0x1,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jge    11ce <ln3+0x9e>
movsbl -0x9(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    11a3 <ln3+0x73>
mov    -0x8(%rbp),%rax
movsbq -0x9(%rbp),%rcx
lea    0xe6b(%rip),%rdi
movsbl (%rax,%rcx,1),%esi
call   1050 <printf@plt>
jmp    11bc <ln3+0x8c>
mov    -0x8(%rbp),%rax
movsbq -0x9(%rbp),%rcx
lea    0xe53(%rip),%rdi
movsbl (%rax,%rcx,1),%esi
call   1050 <printf@plt>
jmp    11c1 <ln3+0x91>
mov    -0x9(%rbp),%al
add    $0x1,%al
mov    %al,-0x9(%rbp)
jmp    1153 <ln3+0x23>
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11f9 <ln3+0xc9>
lea    0xe1d(%rip),%rdi
call   1030 <puts@plt>
jmp    1205 <ln3+0xd5>
lea    0xe0e(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ln3>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r15
movsbl (%rdi),%esi
lea    0xebb(%rip),%r14
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
cmp    $0x2,%eax
jl     11bc <ln3+0x8c>
mov    $0x2,%bl
lea    0xea3(%rip),%r12
jmp    1190 <ln3+0x60>
cs nopw 0x0(%rax,%rax,1)
nop
movsbq %al,%rax
movsbl (%r15,%rax,1),%esi
call   1050 <printf@plt>
movsbl %bl,%ebp
mov    %r15,%rdi
call   1040 <strlen@plt>
add    $0x1,%bl
cmp    %ebp,%eax
jle    11bc <ln3+0x8c>
lea    -0x1(%rbx),%eax
movsbl %al,%ecx
imul   $0x56,%ecx,%edx
movzwl %dx,%edx
mov    %edx,%esi
shr    $0xf,%esi
shr    $0x8,%edx
add    %sil,%dl
movzbl %dl,%edx
lea    (%rdx,%rdx,2),%edx
sub    %dl,%cl
mov    %r14,%rdi
cmp    $0x1,%cl
je     1170 <ln3+0x40>
mov    %r12,%rdi
jmp    1170 <ln3+0x40>
mov    %r15,%rdi
call   1040 <strlen@plt>
imul   $0xaaaaaaab,%eax,%eax
add    $0x2aaaaaaa,%eax
cmp    $0x55555555,%eax
lea    0xe33(%rip),%rax
lea    0xe2a(%rip),%rdi
cmovb  %rax,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"#.%c.\00"
@.str.1 = [6 x i8] c"*.%c.\00"
@.str.2 = [2 x i8] c"#\00"
@.str.3 = [2 x i8] c"*\00"
define void @ln3(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 signext %5)
store i8 1, i8* %3
br label %7
7: ; preds = %33, %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = load i8*, i8** %2
%11 = call i32 @strlen(i8* %10)
%12 = icmp slt i32 %9, %11
br i1 %12, label %13, label %36
13: ; preds = %7
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = srem i32 %15, 3
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %25
18: ; preds = %13
%19 = load i8*, i8** %2
%20 = load i8, i8* %3
%21 = sext i8 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 signext %23)
br label %32
25: ; preds = %13
%26 = load i8*, i8** %2
%27 = load i8, i8* %3
%28 = sext i8 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
%30 = load i8, i8* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 signext %30)
br label %32
32: ; preds = %25, %18
br label %33
33: ; preds = %32
%34 = load i8, i8* %3
%35 = add i8 %34, 1
store i8 %35, i8* %3
br label %7
36: ; preds = %7
%37 = load i8*, i8** %2
%38 = call i32 @strlen(i8* %37)
%39 = srem i32 %38, 3
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %36
%42 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %45
43: ; preds = %36
%44 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %45
45: ; preds = %43, %41
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"#.%c.\00"
@.str.1 = [6 x i8] c"*.%c.\00"
@.str.2 = [2 x i8] c"#\00"
@.str.3 = [2 x i8] c"*\00"
define void @ln3(i8* %0) {
%2 = load i8, i8* %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 signext %2)
%4 = tail call i32 @strlen(i8* %0)
%5 = icmp sgt i32 %4, 1
br i1 %5, label %6, label %19
6: ; preds = %1, %6
%7 = phi i8 [ %15, %6 ], [ 1, %1 ]
%8 = srem i8 %7, 3
%9 = icmp eq i8 %8, 1
%10 = sext i8 %7 to i64
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = select i1 %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0)
%14 = tail call i32 @printf(i8* %13, i8 signext %12)
%15 = add i8 %7, 1
%16 = sext i8 %15 to i32
%17 = tail call i32 @strlen(i8* %0)
%18 = icmp sgt i32 %17, %16
br i1 %18, label %6, label %19
19: ; preds = %6, %1
%20 = tail call i32 @strlen(i8* %0)
%21 = srem i32 %20, 3
%22 = icmp eq i32 %21, 0
%23 = select i1 %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%24 = tail call i32 @puts(i8* dereferenceable(1) %23)
ret void
}