#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*/ error(char *);
int /*<<< orphan*/ setvar(char *, char *, int /*<<< orphan*/);
int unsetcmd(int, char **);
int setvarcmd(int argc, char **argv) {
  if (argc <= 2)
    return unsetcmd(argc, argv);
  else if (argc == 3)
    setvar(argv[1], argv[2], 0);
  else
    error("List assignment not implemented");
  return 0;
}


x86 assembly (clang, -O0):
<setvarcmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jg     115d <setvarcmd+0x2d>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <unsetcmd@plt>
mov    %eax,-0x4(%rbp)
jmp    119b <setvarcmd+0x6b>
cmpl   $0x3,-0x8(%rbp)
jne    1183 <setvarcmd+0x53>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
xor    %edx,%edx
call   1040 <setvar@plt>
jmp    118f <setvarcmd+0x5f>
lea    0xe76(%rip),%rdi
call   1050 <error@plt>
jmp    1194 <setvarcmd+0x64>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setvarcmd>:
cmp    $0x2,%edi
jg     113a <setvarcmd+0xa>
jmp    1030 <unsetcmd@plt>
push   %rax
cmp    $0x3,%edi
jne    1151 <setvarcmd+0x21>
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
xor    %edx,%edx
call   1040 <setvar@plt>
jmp    115d <setvarcmd+0x2d>
lea    0xea8(%rip),%rdi
call   1050 <error@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"List assignment not implemented\00"
define i32 @setvarcmd(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp sle i32 %6, 2
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @unsetcmd(i32 %9, i8** %10)
store i32 %11, i32* %3
br label %27
12: ; preds = %2
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, 3
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = call i32 @setvar(i8* %18, i8* %21, i32 0)
br label %25
23: ; preds = %12
%24 = call i32 @error(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %25
25: ; preds = %23, %15
br label %26
26: ; preds = %25
store i32 0, i32* %3
br label %27
27: ; preds = %26, %8
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@.str = [32 x i8] c"List assignment not implemented\00"
define i32 @setvarcmd(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @unsetcmd(i32 %0, i8** %1)
br label %16
6: ; preds = %2
%7 = icmp eq i32 %0, 3
br i1 %7, label %8, label %14
8: ; preds = %6
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @setvar(i8* %10, i8* %12, i32 0)
br label %16
14: ; preds = %6
%15 = tail call i32 @error(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14, %8, %4
%17 = phi i32 [ %5, %4 ], [ 0, %8 ], [ 0, %14 ]
ret i32 %17
}