#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 */
scalar_t__ check(char *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    printf("./fsm <string>\n");
    return 0;
  }
  if (check(argv[1]))
    printf("Good boy.\n");
  else
    printf("Bad boy.\n");
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1158 <main+0x38>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1193 <main+0x73>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <check@plt>
cmp    $0x0,%rax
je     1180 <main+0x60>
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
jmp    118c <main+0x6c>
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jne    114b <main+0x2b>
mov    0x8(%rsi),%rdi
call   1040 <check@plt>
test   %rax,%rax
lea    0xec7(%rip),%rax
lea    0xec9(%rip),%rdi
cmove  %rax,%rdi
mov    $0x1,%ebx
jmp    1154 <main+0x34>
xor    %ebx,%ebx
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"./fsm <string>\0A\00"
@.str.1 = [11 x i8] c"Good boy.\0A\00"
@.str.2 = [10 x i8] c"Bad boy.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %21
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i64 @check(i8* %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %10
%17 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %20
18: ; preds = %10
%19 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %18, %16
store i32 1, i32* %3
br label %21
21: ; preds = %20, %8
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@str = [9 x i8] c"Bad boy.\00"
@str.3 = [10 x i8] c"Good boy.\00"
@str.4 = [15 x i8] c"./fsm <string>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %10
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @check(i8* %6)
%8 = icmp eq i64 %7, 0
%9 = select i1 %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str.3, i64 0, i64 0)
br label %10
10: ; preds = %4, %2
%11 = phi i8* [ getelementptr inbounds ([15 x i8], [15 x i8]* @str.4, i64 0, i64 0), %2 ], [ %9, %4 ]
%12 = phi i32 [ 0, %2 ], [ 1, %4 ]
%13 = tail call i32 @puts(i8* dereferenceable(1) %11)
ret i32 %12
}