#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*/ border(int, int, int, int, int, int, int, int);
int check_arg_count(int, int);
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_error(char *);
int /*<<< orphan*/ report_return(int /*<<< orphan*/);
scalar_t__ sscanf(char *, char *, int *);
void cmd_border(int nargs, char **args) {
  int ls, rs, ts, bs, tl, tr, bl, br;
  if (check_arg_count(nargs, 8) == 1)
    return;
  if (sscanf(args[0], "%d", &ls) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  if (sscanf(args[1], "%d", &rs) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  if (sscanf(args[2], "%d", &ts) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  if (sscanf(args[3], "%d", &bs) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  if (sscanf(args[4], "%d", &tl) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  if (sscanf(args[5], "%d", &tr) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  if (sscanf(args[6], "%d", &bl) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  if (sscanf(args[7], "%d", &br) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  report_count(1);
  report_return(border(ls, rs, ts, bs, tl, tr, bl, br));
}


x86 assembly (clang, -O0):
<cmd_border>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x8,%esi
call   1050 <check_arg_count@plt>
cmp    $0x1,%eax
jne    118a <cmd_border+0x2a>
jmp    13aa <cmd_border+0x24a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe68(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1070 <sscanf@plt>
cmp    $0x0,%rax
jne    11c6 <cmd_border+0x66>
mov    $0x1,%edi
call   1060 <report_count@plt>
lea    0xe47(%rip),%rdi
call   1080 <report_error@plt>
jmp    13aa <cmd_border+0x24a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe2b(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1070 <sscanf@plt>
cmp    $0x0,%rax
jne    1203 <cmd_border+0xa3>
mov    $0x1,%edi
call   1060 <report_count@plt>
lea    0xe0a(%rip),%rdi
call   1080 <report_error@plt>
jmp    13aa <cmd_border+0x24a>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdee(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   1070 <sscanf@plt>
cmp    $0x0,%rax
jne    1240 <cmd_border+0xe0>
mov    $0x1,%edi
call   1060 <report_count@plt>
lea    0xdcd(%rip),%rdi
call   1080 <report_error@plt>
jmp    13aa <cmd_border+0x24a>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xdb1(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1070 <sscanf@plt>
cmp    $0x0,%rax
jne    127d <cmd_border+0x11d>
mov    $0x1,%edi
call   1060 <report_count@plt>
lea    0xd90(%rip),%rdi
call   1080 <report_error@plt>
jmp    13aa <cmd_border+0x24a>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
lea    0xd74(%rip),%rsi
lea    -0x24(%rbp),%rdx
call   1070 <sscanf@plt>
cmp    $0x0,%rax
jne    12ba <cmd_border+0x15a>
mov    $0x1,%edi
call   1060 <report_count@plt>
lea    0xd53(%rip),%rdi
call   1080 <report_error@plt>
jmp    13aa <cmd_border+0x24a>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
lea    0xd37(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1070 <sscanf@plt>
cmp    $0x0,%rax
jne    12f7 <cmd_border+0x197>
mov    $0x1,%edi
call   1060 <report_count@plt>
lea    0xd16(%rip),%rdi
call   1080 <report_error@plt>
jmp    13aa <cmd_border+0x24a>
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rdi
lea    0xcfa(%rip),%rsi
lea    -0x2c(%rbp),%rdx
call   1070 <sscanf@plt>
cmp    $0x0,%rax
jne    1334 <cmd_border+0x1d4>
mov    $0x1,%edi
call   1060 <report_count@plt>
lea    0xcd9(%rip),%rdi
call   1080 <report_error@plt>
jmp    13aa <cmd_border+0x24a>
mov    -0x10(%rbp),%rax
mov    0x38(%rax),%rdi
lea    0xcbd(%rip),%rsi
lea    -0x30(%rbp),%rdx
call   1070 <sscanf@plt>
cmp    $0x0,%rax
jne    1371 <cmd_border+0x211>
mov    $0x1,%edi
call   1060 <report_count@plt>
lea    0xc9c(%rip),%rdi
call   1080 <report_error@plt>
jmp    13aa <cmd_border+0x24a>
mov    $0x1,%edi
call   1060 <report_count@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x24(%rbp),%r8d
mov    -0x28(%rbp),%r9d
mov    -0x2c(%rbp),%r10d
mov    -0x30(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <border@plt>
mov    %eax,%edi
call   1040 <report_return@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_border>:
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
mov    $0x8,%esi
call   1050 <check_arg_count@plt>
cmp    $0x1,%eax
je     12b4 <cmd_border+0x154>
mov    (%rbx),%rdi
lea    0xe7b(%rip),%rsi
lea    0x1c(%rsp),%rdx
call   1070 <sscanf@plt>
test   %rax,%rax
je     129e <cmd_border+0x13e>
mov    0x8(%rbx),%rdi
lea    0xe5d(%rip),%rsi
lea    0x18(%rsp),%rdx
call   1070 <sscanf@plt>
test   %rax,%rax
je     129e <cmd_border+0x13e>
mov    0x10(%rbx),%rdi
lea    0xe3f(%rip),%rsi
lea    0x14(%rsp),%rdx
call   1070 <sscanf@plt>
test   %rax,%rax
je     129e <cmd_border+0x13e>
mov    0x18(%rbx),%rdi
lea    0xe21(%rip),%rsi
lea    0x10(%rsp),%rdx
call   1070 <sscanf@plt>
test   %rax,%rax
je     129e <cmd_border+0x13e>
mov    0x20(%rbx),%rdi
lea    0xe03(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1070 <sscanf@plt>
test   %rax,%rax
je     129e <cmd_border+0x13e>
mov    0x28(%rbx),%rdi
lea    0xde5(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1070 <sscanf@plt>
test   %rax,%rax
je     129e <cmd_border+0x13e>
mov    0x30(%rbx),%rdi
lea    0xdcb(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1070 <sscanf@plt>
test   %rax,%rax
je     129e <cmd_border+0x13e>
mov    0x38(%rbx),%rdi
lea    0xdb1(%rip),%rsi
mov    %rsp,%rdx
call   1070 <sscanf@plt>
mov    %rax,%rbx
mov    $0x1,%edi
call   1060 <report_count@plt>
test   %rbx,%rbx
je     12a8 <cmd_border+0x148>
mov    0x1c(%rsp),%edi
mov    0x18(%rsp),%esi
mov    0x14(%rsp),%edx
mov    0x10(%rsp),%ecx
mov    0xc(%rsp),%r8d
mov    0x8(%rsp),%r9d
mov    0x4(%rsp),%eax
mov    (%rsp),%ebx
push   %rbx
push   %rax
call   1030 <border@plt>
add    $0x10,%rsp
mov    %eax,%edi
call   1040 <report_return@plt>
jmp    12b4 <cmd_border+0x154>
mov    $0x1,%edi
call   1060 <report_count@plt>
lea    0xd54(%rip),%rdi
call   1080 <report_error@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [13 x i8] c"BAD ARGUMENT\00"
define void @cmd_border(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%13 = load i32, i32* %3
%14 = call i32 @check_arg_count(i32 %13, i32 8)
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %17
16: ; preds = %2
br label %101
17: ; preds = %2
%18 = load i8**, i8*** %4
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i64 @sscanf(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %17
%24 = call i32 @report_count(i32 1)
%25 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %101
26: ; preds = %17
%27 = load i8**, i8*** %4
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i64 @sscanf(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %26
%33 = call i32 @report_count(i32 1)
%34 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %101
35: ; preds = %26
%36 = load i8**, i8*** %4
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
%39 = call i64 @sscanf(i8* %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %35
%42 = call i32 @report_count(i32 1)
%43 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %101
44: ; preds = %35
%45 = load i8**, i8*** %4
%46 = getelementptr inbounds i8*, i8** %45, i64 3
%47 = load i8*, i8** %46
%48 = call i64 @sscanf(i8* %47, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %8)
%49 = icmp eq i64 %48, 0
br i1 %49, label %50, label %53
50: ; preds = %44
%51 = call i32 @report_count(i32 1)
%52 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %101
53: ; preds = %44
%54 = load i8**, i8*** %4
%55 = getelementptr inbounds i8*, i8** %54, i64 4
%56 = load i8*, i8** %55
%57 = call i64 @sscanf(i8* %56, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %53
%60 = call i32 @report_count(i32 1)
%61 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %101
62: ; preds = %53
%63 = load i8**, i8*** %4
%64 = getelementptr inbounds i8*, i8** %63, i64 5
%65 = load i8*, i8** %64
%66 = call i64 @sscanf(i8* %65, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %10)
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %71
68: ; preds = %62
%69 = call i32 @report_count(i32 1)
%70 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %101
71: ; preds = %62
%72 = load i8**, i8*** %4
%73 = getelementptr inbounds i8*, i8** %72, i64 6
%74 = load i8*, i8** %73
%75 = call i64 @sscanf(i8* %74, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %11)
%76 = icmp eq i64 %75, 0
br i1 %76, label %77, label %80
77: ; preds = %71
%78 = call i32 @report_count(i32 1)
%79 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %101
80: ; preds = %71
%81 = load i8**, i8*** %4
%82 = getelementptr inbounds i8*, i8** %81, i64 7
%83 = load i8*, i8** %82
%84 = call i64 @sscanf(i8* %83, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %12)
%85 = icmp eq i64 %84, 0
br i1 %85, label %86, label %89
86: ; preds = %80
%87 = call i32 @report_count(i32 1)
%88 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %101
89: ; preds = %80
%90 = call i32 @report_count(i32 1)
%91 = load i32, i32* %5
%92 = load i32, i32* %6
%93 = load i32, i32* %7
%94 = load i32, i32* %8
%95 = load i32, i32* %9
%96 = load i32, i32* %10
%97 = load i32, i32* %11
%98 = load i32, i32* %12
%99 = call i32 @border(i32 %91, i32 %92, i32 %93, i32 %94, i32 %95, i32 %96, i32 %97, i32 %98)
%100 = call i32 @report_return(i32 %99)
br label %101
101: ; preds = %89, %86, %77, %68, %59, %50, %41, %32, %23, %16
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [13 x i8] c"BAD ARGUMENT\00"
define void @cmd_border(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = bitcast i32* %3 to i8*
%12 = bitcast i32* %4 to i8*
%13 = bitcast i32* %5 to i8*
%14 = bitcast i32* %6 to i8*
%15 = bitcast i32* %7 to i8*
%16 = bitcast i32* %8 to i8*
%17 = bitcast i32* %9 to i8*
%18 = bitcast i32* %10 to i8*
%19 = tail call i32 @check_arg_count(i32 %0, i32 8)
%20 = icmp eq i32 %19, 1
br i1 %20, label %95, label %21
21: ; preds = %2
%22 = load i8*, i8** %1
%23 = call i64 @sscanf(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %21
%26 = call i32 @report_count(i32 1)
%27 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %95
28: ; preds = %21
%29 = getelementptr inbounds i8*, i8** %1, i64 1
%30 = load i8*, i8** %29
%31 = call i64 @sscanf(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %28
%34 = call i32 @report_count(i32 1)
%35 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %95
36: ; preds = %28
%37 = getelementptr inbounds i8*, i8** %1, i64 2
%38 = load i8*, i8** %37
%39 = call i64 @sscanf(i8* %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %36
%42 = call i32 @report_count(i32 1)
%43 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %95
44: ; preds = %36
%45 = getelementptr inbounds i8*, i8** %1, i64 3
%46 = load i8*, i8** %45
%47 = call i64 @sscanf(i8* %46, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %44
%50 = call i32 @report_count(i32 1)
%51 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %95
52: ; preds = %44
%53 = getelementptr inbounds i8*, i8** %1, i64 4
%54 = load i8*, i8** %53
%55 = call i64 @sscanf(i8* %54, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %60
57: ; preds = %52
%58 = call i32 @report_count(i32 1)
%59 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %95
60: ; preds = %52
%61 = getelementptr inbounds i8*, i8** %1, i64 5
%62 = load i8*, i8** %61
%63 = call i64 @sscanf(i8* %62, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %8)
%64 = icmp eq i64 %63, 0
br i1 %64, label %65, label %68
65: ; preds = %60
%66 = call i32 @report_count(i32 1)
%67 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %95
68: ; preds = %60
%69 = getelementptr inbounds i8*, i8** %1, i64 6
%70 = load i8*, i8** %69
%71 = call i64 @sscanf(i8* %70, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%72 = icmp eq i64 %71, 0
br i1 %72, label %73, label %76
73: ; preds = %68
%74 = call i32 @report_count(i32 1)
%75 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %95
76: ; preds = %68
%77 = getelementptr inbounds i8*, i8** %1, i64 7
%78 = load i8*, i8** %77
%79 = call i64 @sscanf(i8* %78, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %10)
%80 = icmp eq i64 %79, 0
%81 = call i32 @report_count(i32 1)
br i1 %80, label %82, label %84
82: ; preds = %76
%83 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %95
84: ; preds = %76
%85 = load i32, i32* %3
%86 = load i32, i32* %4
%87 = load i32, i32* %5
%88 = load i32, i32* %6
%89 = load i32, i32* %7
%90 = load i32, i32* %8
%91 = load i32, i32* %9
%92 = load i32, i32* %10
%93 = call i32 @border(i32 %85, i32 %86, i32 %87, i32 %88, i32 %89, i32 %90, i32 %91, i32 %92)
%94 = call i32 @report_return(i32 %93)
br label %95
95: ; preds = %2, %84, %82, %73, %65, %57, %49, %41, %33, %25
ret void
}