#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*/ *gets(char *);
scalar_t__ isCorrectISBN(int *);
scalar_t__ parseISBN(char *, int *);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  char line[80 + 1];
  int ISBN[10];
  while (gets(line) != NULL) {
    if (parseISBN(line, ISBN) && isCorrectISBN(ISBN))
      printf("%s is correct.\n", line);
    else
      printf("%s is incorrect.\n", line);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
call   1040 <gets@plt>
cmp    $0x0,%rax
je     11bf <main+0x7f>
lea    -0x60(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1060 <parseISBN@plt>
cmp    $0x0,%rax
je     11aa <main+0x6a>
lea    -0x90(%rbp),%rdi
call   1050 <isCorrectISBN@plt>
cmp    $0x0,%rax
je     11aa <main+0x6a>
lea    -0x60(%rbp),%rsi
lea    0xe60(%rip),%rdi
call   1030 <printf@plt>
jmp    11ba <main+0x7a>
lea    -0x60(%rbp),%rsi
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
jmp    1152 <main+0x12>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x88,%rsp
lea    0x30(%rsp),%rdi
call   1040 <gets@plt>
test   %rax,%rax
je     11ba <main+0x7a>
lea    0x30(%rsp),%rbx
mov    %rsp,%r14
lea    0xea4(%rip),%r15
lea    0xe8d(%rip),%r12
jmp    1198 <main+0x58>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <gets@plt>
test   %rax,%rax
je     11ba <main+0x7a>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <parseISBN@plt>
test   %rax,%rax
je     1180 <main+0x40>
mov    %r14,%rdi
call   1050 <isCorrectISBN@plt>
mov    %r12,%rdi
test   %rax,%rax
jne    1183 <main+0x43>
jmp    1180 <main+0x40>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [16 x i8] c"%s is correct.\0A\00"
@.str.1 = [18 x i8] c"%s is incorrect.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [81 x i8]
%3 = alloca [10 x i32]
store i32 0, i32* %1
br label %4
4: ; preds = %23, %0
%5 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%6 = call i32* @gets(i8* %5)
%7 = icmp ne i32* %6, null
br i1 %7, label %8, label %24
8: ; preds = %4
%9 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%11 = call i64 @parseISBN(i8* %9, i32* %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %20
13: ; preds = %8
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%15 = call i64 @isCorrectISBN(i32* %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%19 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %18)
br label %23
20: ; preds = %13, %8
%21 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%22 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %20, %17
br label %4
24: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"%s is correct.\0A\00"
@.str.1 = [18 x i8] c"%s is incorrect.\0A\00"
define i32 @main() {
%1 = alloca [81 x i8]
%2 = alloca [10 x i32]
%3 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 0
%4 = bitcast [10 x i32]* %2 to i8*
%5 = call i32* @gets(i8* %3)
%6 = icmp eq i32* %5, null
br i1 %6, label %21, label %7
7: ; preds = %0
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
br label %9
9: ; preds = %7, %16
%10 = call i64 @parseISBN(i8* %3, i32* %8)
%11 = icmp eq i64 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = call i64 @isCorrectISBN(i32* %8)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %12, %9
br label %16
16: ; preds = %12, %15
%17 = phi i8* [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), %15 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), %12 ]
%18 = call i32 @printf(i8* %17, i8* %3)
%19 = call i32* @gets(i8* %3)
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %9
21: ; preds = %16, %0
ret i32 0
}