#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int sscanf(char const *, char *, int *, int *);
int /*<<< orphan*/ stderr;
void plan(const char *line, int *a, int *b) {
  assert(line != NULL);
  assert(a != NULL);
  assert(b != NULL);
  if (*b != -1) {
    fprintf(stderr, "syntax error: duplicate plan: %s\n", line);
    exit(1);
  }
  if (2 != sscanf(line, "%d..%d", a, b)) {
    fprintf(stderr, "syntax error: missing a..b\n");
    exit(1);
  }
  if (*a < 0 && *b < *a) {
    fprintf(stderr, "error: invalid plan: %d..%d\n", *a, *b);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<plan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpq   $0x0,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x18(%rbp),%rax
cmpl   $0xffffffff,(%rax)
je     11bc <plan+0x7c>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe55(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe53(%rip),%rsi
call   1050 <sscanf@plt>
mov    %eax,%ecx
mov    $0x2,%eax
cmp    %ecx,%eax
je     1204 <plan+0xc4>
mov    0x2df6(%rip),%rax
mov    (%rax),%edi
lea    0xe36(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jge    1250 <plan+0x110>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    1250 <plan+0x110>
mov    0x2db6(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
lea    0xe06(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plan>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %edi,%edi
test   %r15,%r15
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
cmpl   $0xffffffff,(%rbx)
jne    11aa <plan+0x6a>
lea    0xe9e(%rip),%rsi
mov    %r15,%rdi
mov    %r14,%rdx
mov    %rbx,%rcx
call   1050 <sscanf@plt>
cmp    $0x2,%eax
jne    11ce <plan+0x8e>
mov    (%r14),%edx
test   %edx,%edx
jns    11a4 <plan+0x64>
mov    (%rbx),%ecx
cmp    %edx,%ecx
jl     11ef <plan+0xaf>
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
lea    0xe46(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    0x2e0b(%rip),%rax
mov    (%rax),%edi
lea    0xe4b(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    0x2dea(%rip),%rax
mov    (%rax),%edi
lea    0xe46(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"syntax error: duplicate plan: %s\0A\00"
@.str.1 = [7 x i8] c"%d..%d\00"
@.str.2 = [28 x i8] c"syntax error: missing a..b\0A\00"
@.str.3 = [29 x i8] c"error: invalid plan: %d..%d\0A\00"
define void @plan(i8* %0, i32* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i32*, i32** %5
%12 = icmp ne i32* %11, null
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load i32*, i32** %6
%16 = icmp ne i32* %15, null
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = load i32*, i32** %6
%20 = load i32, i32* %19
%21 = icmp ne i32 %20, -1
br i1 %21, label %22, label %27
22: ; preds = %3
%23 = load i32, i32* @stderr
%24 = load i8*, i8** %4
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %24)
%26 = call i32 @exit(i32 1)
unreachable
27: ; preds = %3
%28 = load i8*, i8** %4
%29 = load i32*, i32** %5
%30 = load i32*, i32** %6
%31 = call i32 @sscanf(i8* %28, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %29, i32* %30)
%32 = icmp ne i32 2, %31
br i1 %32, label %33, label %37
33: ; preds = %27
%34 = load i32, i32* @stderr
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%36 = call i32 @exit(i32 1)
unreachable
37: ; preds = %27
%38 = load i32*, i32** %5
%39 = load i32, i32* %38
%40 = icmp slt i32 %39, 0
br i1 %40, label %41, label %55
41: ; preds = %37
%42 = load i32*, i32** %6
%43 = load i32, i32* %42
%44 = load i32*, i32** %5
%45 = load i32, i32* %44
%46 = icmp slt i32 %43, %45
br i1 %46, label %47, label %55
47: ; preds = %41
%48 = load i32, i32* @stderr
%49 = load i32*, i32** %5
%50 = load i32, i32* %49
%51 = load i32*, i32** %6
%52 = load i32, i32* %51
%53 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %50, i32 %52)
%54 = call i32 @exit(i32 1)
unreachable
55: ; preds = %41, %37
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"syntax error: duplicate plan: %s\0A\00"
@.str.1 = [7 x i8] c"%d..%d\00"
@.str.2 = [28 x i8] c"syntax error: missing a..b\0A\00"
@.str.3 = [29 x i8] c"error: invalid plan: %d..%d\0A\00"
define void @plan(i8* %0, i32* %1, i32* %2) {
%4 = icmp ne i8* %0, null
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = icmp ne i32* %1, null
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = icmp ne i32* %2, null
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, -1
br i1 %14, label %19, label %15
15: ; preds = %3
%16 = load i32, i32* @stderr
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %0)
%18 = tail call i32 @exit(i32 1)
unreachable
19: ; preds = %3
%20 = tail call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%21 = icmp eq i32 %20, 2
br i1 %21, label %26, label %22
22: ; preds = %19
%23 = load i32, i32* @stderr
%24 = tail call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%25 = tail call i32 @exit(i32 1)
unreachable
26: ; preds = %19
%27 = load i32, i32* %1
%28 = icmp slt i32 %27, 0
br i1 %28, label %29, label %36
29: ; preds = %26
%30 = load i32, i32* %2
%31 = icmp slt i32 %30, %27
br i1 %31, label %32, label %36
32: ; preds = %29
%33 = load i32, i32* @stderr
%34 = tail call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %27, i32 %30)
%35 = tail call i32 @exit(i32 1)
unreachable
36: ; preds = %29, %26
ret void
}