#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*/ SCREEN;

/* Variables and functions */
int /*<<< orphan*/ OK;
int check_arg_count(int, int);
int /*<<< orphan*/ delscreen(int /*<<< orphan*/ *);
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_error(char *);
int /*<<< orphan*/ report_return(int /*<<< orphan*/);
scalar_t__ sscanf(char *, char *, int /*<<< orphan*/ **);
void cmd_delscreen(int nargs, char **args) {
  SCREEN *scrn;
  if (check_arg_count(nargs, 1) == 1)
    return;
  if (sscanf(args[0], "%p", &scrn) == 0) {
    report_count(1);
    report_error("BAD ARGUMENT");
    return;
  }
  delscreen(scrn);
  report_count(1);
  report_return(OK);
}


x86 assembly (clang, -O0):
<cmd_delscreen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1040 <check_arg_count@plt>
cmp    $0x1,%eax
jne    118a <cmd_delscreen+0x2a>
jmp    11e7 <cmd_delscreen+0x87>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe68(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1060 <sscanf@plt>
cmp    $0x0,%rax
jne    11c6 <cmd_delscreen+0x66>
mov    $0x1,%edi
call   1050 <report_count@plt>
lea    0xe47(%rip),%rdi
call   1070 <report_error@plt>
jmp    11e7 <cmd_delscreen+0x87>
mov    -0x18(%rbp),%rdi
call   1080 <delscreen@plt>
mov    $0x1,%edi
call   1050 <report_count@plt>
mov    0x2e00(%rip),%rax
mov    (%rax),%edi
call   1030 <report_return@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_delscreen>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    $0x1,%esi
call   1040 <check_arg_count@plt>
cmp    $0x1,%eax
je     11ca <cmd_delscreen+0x6a>
mov    (%rbx),%rdi
lea    0xe7f(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1060 <sscanf@plt>
test   %rax,%rax
je     11b4 <cmd_delscreen+0x54>
mov    0x8(%rsp),%rdi
call   1080 <delscreen@plt>
mov    $0x1,%edi
call   1050 <report_count@plt>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
call   1030 <report_return@plt>
jmp    11ca <cmd_delscreen+0x6a>
mov    $0x1,%edi
call   1050 <report_count@plt>
lea    0xe3e(%rip),%rdi
call   1070 <report_error@plt>
add    $0x10,%rsp
pop    %rbx
ret

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

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