#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*/ mvhline(int, int, int /*<<< orphan*/, 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_mvhline(int nargs, char **args) {
  int y, x, n;
  chtype *ch;
  if (check_arg_count(nargs, 4) == 1)
    return;
  if (sscanf(args[0], "%d", &y) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  if (sscanf(args[1], "%d", &x) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  ch = (chtype *)args[2];
  if (sscanf(args[3], "%d", &n) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  report_count(1);
  report_return(mvhline(y, x, ch[0], n));
}


x86 assembly (clang, -O0):
<cmd_mvhline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x4,%esi
call   1040 <check_arg_count@plt>
cmp    $0x1,%eax
jne    118a <cmd_mvhline+0x2a>
jmp    1271 <cmd_mvhline+0x111>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe68(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1060 <sscanf@plt>
cmp    $0x0,%rax
jne    11c6 <cmd_mvhline+0x66>
mov    $0x1,%edi
call   1050 <report_count@plt>
lea    0xe47(%rip),%rdi
call   1070 <report_error@plt>
jmp    1271 <cmd_mvhline+0x111>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe2b(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1060 <sscanf@plt>
cmp    $0x0,%rax
jne    1203 <cmd_mvhline+0xa3>
mov    $0x1,%edi
call   1050 <report_count@plt>
lea    0xe0a(%rip),%rdi
call   1070 <report_error@plt>
jmp    1271 <cmd_mvhline+0x111>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xde2(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   1060 <sscanf@plt>
cmp    $0x0,%rax
jne    124c <cmd_mvhline+0xec>
mov    $0x1,%edi
call   1050 <report_count@plt>
lea    0xdc1(%rip),%rdi
call   1070 <report_error@plt>
jmp    1271 <cmd_mvhline+0x111>
mov    $0x1,%edi
call   1050 <report_count@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x28(%rbp),%rax
mov    (%rax),%edx
mov    -0x1c(%rbp),%ecx
call   1080 <mvhline@plt>
mov    %eax,%edi
call   1030 <report_return@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_mvhline>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    $0x4,%esi
call   1040 <check_arg_count@plt>
cmp    $0x1,%eax
je     120e <cmd_mvhline+0xae>
mov    (%rbx),%rdi
lea    0xe79(%rip),%rsi
lea    0x14(%rsp),%rdx
call   1060 <sscanf@plt>
test   %rax,%rax
je     11f8 <cmd_mvhline+0x98>
mov    0x8(%rbx),%rdi
lea    0xe5f(%rip),%rsi
lea    0x10(%rsp),%rdx
call   1060 <sscanf@plt>
test   %rax,%rax
je     11f8 <cmd_mvhline+0x98>
mov    0x10(%rbx),%r14
mov    0x18(%rbx),%rdi
lea    0xe41(%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     1202 <cmd_mvhline+0xa2>
mov    0x14(%rsp),%edi
mov    0x10(%rsp),%esi
mov    (%r14),%edx
mov    0xc(%rsp),%ecx
call   1080 <mvhline@plt>
mov    %eax,%edi
call   1030 <report_return@plt>
jmp    120e <cmd_mvhline+0xae>
mov    $0x1,%edi
call   1050 <report_count@plt>
lea    0xdfa(%rip),%rdi
call   1070 <report_error@plt>
add    $0x18,%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_mvhline(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%9 = load i32, i32* %3
%10 = call i32 @check_arg_count(i32 %9, i32 4)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %13
12: ; preds = %2
br label %54
13: ; preds = %2
%14 = load i8**, i8*** %4
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i64 @sscanf(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %13
%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 %54
22: ; preds = %13
%23 = load i8**, i8*** %4
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i64 @sscanf(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %22
%29 = call i32 @report_count(i32 1)
%30 = call i32 @report_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %54
31: ; preds = %22
%32 = load i8**, i8*** %4
%33 = getelementptr inbounds i8*, i8** %32, i64 2
%34 = load i8*, i8** %33
%35 = bitcast i8* %34 to i32*
store i32* %35, i32** %8
%36 = load i8**, i8*** %4
%37 = getelementptr inbounds i8*, i8** %36, i64 3
%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 = %31
%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 %54
44: ; preds = %31
%45 = call i32 @report_count(i32 1)
%46 = load i32, i32* %5
%47 = load i32, i32* %6
%48 = load i32*, i32** %8
%49 = getelementptr inbounds i32, i32* %48, i64 0
%50 = load i32, i32* %49
%51 = load i32, i32* %7
%52 = call i32 @mvhline(i32 %46, i32 %47, i32 %50, i32 %51)
%53 = call i32 @report_return(i32 %52)
br label %54
54: ; preds = %44, %41, %28, %19, %12
ret void
}

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