#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*/ add_item(char *);
int /*<<< orphan*/ atoi(char *);
scalar_t__ is_int(char *);
int /*<<< orphan*/ list_items();
int /*<<< orphan*/ remove_item(int /*<<< orphan*/);
int main(int argc, char **argv) {
  if (argc == 2) {
    if (is_int(argv[1])) {
      remove_item(atoi(argv[1]));
    } else {
      add_item(argv[1]);
    }
    return 0;
  }
  list_items();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    11b9 <main+0x69>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <is_int@plt>
cmp    $0x0,%rax
je     11a0 <main+0x50>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,%edi
call   1050 <remove_item@plt>
jmp    11ad <main+0x5d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <add_item@plt>
movl   $0x0,-0x4(%rbp)
jmp    11c7 <main+0x77>
mov    $0x0,%al
call   1070 <list_items@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jne    1179 <main+0x29>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1040 <is_int@plt>
mov    0x8(%rbx),%rdi
test   %rax,%rax
je     1182 <main+0x32>
call   1060 <atoi@plt>
mov    %eax,%edi
call   1050 <remove_item@plt>
jmp    1187 <main+0x37>
xor    %eax,%eax
call   1070 <list_items@plt>
jmp    1187 <main+0x37>
call   1030 <add_item@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 2
br i1 %7, label %8, label %26
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i64 @is_int(i8* %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %8
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @atoi(i8* %17)
%19 = call i32 @remove_item(i32 %18)
br label %25
20: ; preds = %8
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @add_item(i8* %23)
br label %25
25: ; preds = %20, %14
store i32 0, i32* %3
br label %28
26: ; preds = %2
%27 = call i32 (...) @list_items()
store i32 0, i32* %3
br label %28
28: ; preds = %26, %25
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %15
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @is_int(i8* %6)
%8 = icmp eq i64 %7, 0
%9 = load i8*, i8** %5
br i1 %8, label %13, label %10
10: ; preds = %4
%11 = tail call i32 @atoi(i8* %9)
%12 = tail call i32 @remove_item(i32 %11)
br label %17
13: ; preds = %4
%14 = tail call i32 @add_item(i8* %9)
br label %17
15: ; preds = %2
%16 = tail call i32 (...) @list_items()
br label %17
17: ; preds = %10, %13, %15
ret i32 0
}