#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*/ fail(char **);
int intfromstr(char *);
int /*<<< orphan*/ list_solved_problems();
scalar_t__ strcmp(char *, char *);
void check_args(int argc, char **argv) {
  if (argc != 2) {
    fail(argv);
  }
  if (strcmp(argv[1], "-l") == 0 || strcmp(argv[1], "--list") == 0) {
    list_solved_problems();
  }
  int problem_number = intfromstr(argv[1]);
  if (problem_number <= 0) {
    fail(argv);
  }
  return;
}


x86 assembly (clang, -O0):
<check_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x4(%rbp)
je     1162 <check_args+0x22>
mov    -0x10(%rbp),%rdi
call   1040 <fail@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe8f(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     119e <check_args+0x5e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe74(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11a5 <check_args+0x65>
mov    $0x0,%al
call   1030 <list_solved_problems@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <intfromstr@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jg     11c8 <check_args+0x88>
mov    -0x10(%rbp),%rdi
call   1040 <fail@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_args>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
je     1151 <check_args+0x11>
mov    %rbx,%rdi
call   1040 <fail@plt>
mov    0x8(%rbx),%rdi
lea    0xea4(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     117b <check_args+0x3b>
mov    0x8(%rbx),%rdi
lea    0xe92(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    1182 <check_args+0x42>
xor    %eax,%eax
call   1030 <list_solved_problems@plt>
mov    0x8(%rbx),%rdi
call   1060 <intfromstr@plt>
test   %eax,%eax
jle    1191 <check_args+0x51>
pop    %rbx
ret
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <fail@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-l\00"
@.str.1 = [7 x i8] c"--list\00"
define void @check_args(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 = icmp ne i32 %6, 2
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8**, i8*** %4
%10 = call i32 @fail(i8** %9)
br label %11
11: ; preds = %8, %2
%12 = load i8**, i8*** %4
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %23, label %17
17: ; preds = %11
%18 = load i8**, i8*** %4
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %17, %11
%24 = call i32 (...) @list_solved_problems()
br label %25
25: ; preds = %23, %17
%26 = load i8**, i8*** %4
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 @intfromstr(i8* %28)
store i32 %29, i32* %5
%30 = load i32, i32* %5
%31 = icmp sle i32 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %25
%33 = load i8**, i8*** %4
%34 = call i32 @fail(i8** %33)
br label %35
35: ; preds = %32, %25
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"-l\00"
@.str.1 = [7 x i8] c"--list\00"
define void @check_args(i32 %0, i8** %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @fail(i8** %1)
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %6
%12 = load i8*, i8** %7
%13 = tail call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11, %6
%16 = tail call i32 (...) @list_solved_problems()
br label %17
17: ; preds = %15, %11
%18 = load i8*, i8** %7
%19 = tail call i32 @intfromstr(i8* %18)
%20 = icmp slt i32 %19, 1
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = tail call i32 @fail(i8** %1)
br label %23
23: ; preds = %21, %17
ret void
}