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

/* 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*/ wvline(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
void cmd_wvline(int nargs, char **args) {
  WINDOW *win;
  int n;
  chtype *ch;
  if (check_arg_count(nargs, 3) == 1)
    return;
  if (sscanf(args[0], "%p", &win) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  ch = (chtype *)args[1];
  if (sscanf(args[2], "%d", &n) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  report_count(1);
  report_return(wvline(win, ch[0], n));
}


x86 assembly (clang, -O0):
<cmd_wvline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x3,%esi
call   1040 <check_arg_count@plt>
cmp    $0x1,%eax
jne    118a <cmd_wvline+0x2a>
jmp    1232 <cmd_wvline+0xd2>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    -0x18(%rbp),%rdx
lea    0xe64(%rip),%rsi
call   1060 <sscanf@plt>
cmp    $0x0,%rax
jne    11c6 <cmd_wvline+0x66>
mov    $0x1,%edi
call   1050 <report_count@plt>
lea    0xe47(%rip),%rdi
call   1070 <report_error@plt>
jmp    1232 <cmd_wvline+0xd2>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe2f(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   1060 <sscanf@plt>
cmp    $0x0,%rax
jne    120f <cmd_wvline+0xaf>
mov    $0x1,%edi
call   1050 <report_count@plt>
lea    0xdfe(%rip),%rdi
call   1070 <report_error@plt>
jmp    1232 <cmd_wvline+0xd2>
mov    $0x1,%edi
call   1050 <report_count@plt>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    (%rax),%esi
mov    -0x1c(%rbp),%edx
call   1080 <wvline@plt>
mov    %eax,%edi
call   1030 <report_return@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_wvline>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    $0x3,%esi
call   1040 <check_arg_count@plt>
cmp    $0x1,%eax
je     11ed <cmd_wvline+0x8d>
mov    (%rbx),%rdi
lea    0xe7d(%rip),%rsi
lea    0x10(%rsp),%rdx
call   1060 <sscanf@plt>
test   %rax,%rax
je     11d7 <cmd_wvline+0x77>
mov    0x8(%rbx),%r14
mov    0x10(%rbx),%rdi
lea    0xe6f(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1060 <sscanf@plt>
mov    %rax,%rbx
mov    $0x1,%edi
call   1050 <report_count@plt>
test   %rbx,%rbx
je     11e1 <cmd_wvline+0x81>
mov    0x10(%rsp),%rdi
mov    (%r14),%esi
mov    0xc(%rsp),%edx
call   1080 <wvline@plt>
mov    %eax,%edi
call   1030 <report_return@plt>
jmp    11ed <cmd_wvline+0x8d>
mov    $0x1,%edi
call   1050 <report_count@plt>
lea    0xe1b(%rip),%rdi
call   1070 <report_error@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

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