#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 */
typedef int /*<<< orphan*/ chtype;

/* Variables and functions */
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 *);
int /*<<< orphan*/ vline(int /*<<< orphan*/, int);
void cmd_vline(int nargs, char **args) {
  int count;
  chtype *ch;
  if (check_arg_count(nargs, 2) == 1)
    return;
  ch = (chtype *)args[0];
  if (sscanf(args[1], "%d", &count) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  report_count(1);
  report_return(vline(ch[0], count));
}


x86 assembly (clang, -O0):
<cmd_vline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
call   1040 <check_arg_count@plt>
cmp    $0x1,%eax
jne    118a <cmd_vline+0x2a>
jmp    11f1 <cmd_vline+0x91>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe5c(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1060 <sscanf@plt>
cmp    $0x0,%rax
jne    11d2 <cmd_vline+0x72>
mov    $0x1,%edi
call   1050 <report_count@plt>
lea    0xe3b(%rip),%rdi
call   1070 <report_error@plt>
jmp    11f1 <cmd_vline+0x91>
mov    $0x1,%edi
call   1050 <report_count@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%esi
call   1080 <vline@plt>
mov    %eax,%edi
call   1030 <report_return@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_vline>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    $0x2,%esi
call   1040 <check_arg_count@plt>
cmp    $0x1,%eax
je     11c1 <cmd_vline+0x61>
mov    (%rbx),%r14
mov    0x8(%rbx),%rdi
lea    0xe7c(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1060 <sscanf@plt>
mov    %rax,%rbx
mov    $0x1,%edi
call   1050 <report_count@plt>
test   %rbx,%rbx
je     11b5 <cmd_vline+0x55>
mov    (%r14),%edi
mov    0x4(%rsp),%esi
call   1080 <vline@plt>
mov    %eax,%edi
call   1030 <report_return@plt>
jmp    11c1 <cmd_vline+0x61>
lea    0xe47(%rip),%rdi
call   1070 <report_error@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [13 x i8] c"BAD ARGUMENT\00"
define void @cmd_vline(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = load i32, i32* %3
%8 = call i32 @check_arg_count(i32 %7, i32 2)
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %11
10: ; preds = %2
br label %32
11: ; preds = %2
%12 = load i8**, i8*** %4
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = bitcast i8* %14 to i32*
store i32* %15, i32** %6
%16 = load i8**, i8*** %4
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i64 @sscanf(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %11
%22 = call i32 @report_count(i32 1)
%23 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %32
24: ; preds = %11
%25 = call i32 @report_count(i32 1)
%26 = load i32*, i32** %6
%27 = getelementptr inbounds i32, i32* %26, i64 0
%28 = load i32, i32* %27
%29 = load i32, i32* %5
%30 = call i32 @vline(i32 %28, i32 %29)
%31 = call i32 @report_return(i32 %30)
br label %32
32: ; preds = %24, %21, %10
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [13 x i8] c"BAD ARGUMENT\00"
define void @cmd_vline(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @check_arg_count(i32 %0, i32 2)
%6 = icmp eq i32 %5, 1
br i1 %6, label %22, label %7
7: ; preds = %2
%8 = bitcast i8** %1 to i32**
%9 = load i32*, i32** %8
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = call i64 @sscanf(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%13 = icmp eq i64 %12, 0
%14 = call i32 @report_count(i32 1)
br i1 %13, label %15, label %17
15: ; preds = %7
%16 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %22
17: ; preds = %7
%18 = load i32, i32* %9
%19 = load i32, i32* %3
%20 = call i32 @vline(i32 %18, i32 %19)
%21 = call i32 @report_return(i32 %20)
br label %22
22: ; preds = %2, %17, %15
ret void
}