#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 con_num(char *, int, char, int);
scalar_t__ is_at_other_spot(char *, int, char, int);
int check_stars(char *str) {
  int star;
  int i;
  int con;
  star = 0;
  i = 0;
  con = 0;
  while (i < 20) {
    if (str[i] == '#') {
      if (is_at_other_spot(str, i, '#', 4)) {
        con = con_num(str, i, '#', 4) + con;
        star++;
      } else
        return (0);
    }
    i++;
  }
  if ((star == 4) && (con >= 6))
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<check_stars>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x14,-0x18(%rbp)
jge    11c9 <check_stars+0xa9>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x23,%eax
jne    11bb <check_stars+0x9b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    $0x23,%edx
mov    $0x4,%ecx
call   1030 <is_at_other_spot@plt>
cmp    $0x0,%rax
je     11aa <check_stars+0x8a>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    $0x23,%edx
mov    $0x4,%ecx
call   1040 <con_num@plt>
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b6 <check_stars+0x96>
movl   $0x0,-0x4(%rbp)
jmp    11f0 <check_stars+0xd0>
jmp    11bb <check_stars+0x9b>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1141 <check_stars+0x21>
cmpl   $0x4,-0x14(%rbp)
jne    11e9 <check_stars+0xc9>
cmpl   $0x6,-0x1c(%rbp)
jl     11e9 <check_stars+0xc9>
movl   $0x1,-0x4(%rbp)
jmp    11f0 <check_stars+0xd0>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_stars>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
xor    %r15d,%r15d
xor    %ebp,%ebp
jmp    114a <check_stars+0x2a>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbx
cmp    $0x14,%rbx
je     1186 <check_stars+0x66>
cmpb   $0x23,(%r14,%rbx,1)
jne    1140 <check_stars+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x23,%edx
mov    $0x4,%ecx
call   1030 <is_at_other_spot@plt>
test   %rax,%rax
je     119a <check_stars+0x7a>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x23,%edx
mov    $0x4,%ecx
call   1040 <con_num@plt>
add    %eax,%r15d
add    $0x1,%ebp
jmp    1140 <check_stars+0x20>
cmp    $0x4,%ebp
sete   %al
cmp    $0x6,%r15d
setge  %cl
and    %al,%cl
movzbl %cl,%eax
jmp    119c <check_stars+0x7c>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @check_stars(i8* %0) {
br label %2
2: ; preds = %1, %17
%3 = phi i64 [ 0, %1 ], [ %20, %17 ]
%4 = phi i32 [ 0, %1 ], [ %19, %17 ]
%5 = phi i32 [ 0, %1 ], [ %18, %17 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %3
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 35
br i1 %8, label %9, label %17
9: ; preds = %2
%10 = trunc i64 %3 to i32
%11 = tail call i64 @is_at_other_spot(i8* %0, i32 %10, i8 signext 35, i32 4)
%12 = icmp eq i64 %11, 0
br i1 %12, label %27, label %13
13: ; preds = %9
%14 = tail call i32 @con_num(i8* %0, i32 %10, i8 signext 35, i32 4)
%15 = add nsw i32 %14, %4
%16 = add nsw i32 %5, 1
br label %17
17: ; preds = %13, %2
%18 = phi i32 [ %16, %13 ], [ %5, %2 ]
%19 = phi i32 [ %15, %13 ], [ %4, %2 ]
%20 = add nuw nsw i64 %3, 1
%21 = icmp eq i64 %20, 20
br i1 %21, label %22, label %2
22: ; preds = %17
%23 = icmp eq i32 %18, 4
%24 = icmp sgt i32 %19, 5
%25 = select i1 %23, i1 %24, i1 false
%26 = zext i1 %25 to i32
br label %27
27: ; preds = %9, %22
%28 = phi i32 [ %26, %22 ], [ 0, %9 ]
ret i32 %28
}