setvarcmd(argc, argv) 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     115f <setvarcmd+0x2f>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <unsetcmd@plt>
mov    %eax,-0x4(%rbp)
jmp    11a1 <setvarcmd+0x71>
cmpl   $0x3,-0x8(%rbp)
jne    1187 <setvarcmd+0x57>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
xor    %edx,%edx
mov    $0x0,%al
call   1040 <setvar@plt>
jmp    1195 <setvarcmd+0x65>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1050 <error@plt>
jmp    119a <setvarcmd+0x6a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setvarcmd>:
cmp    $0x2,%edi
jg     113c <setvarcmd+0xc>
xor    %eax,%eax
jmp    1030 <unsetcmd@plt>
push   %rax
cmp    $0x3,%edi
jne    1155 <setvarcmd+0x25>
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
xor    %edx,%edx
xor    %eax,%eax
call   1040 <setvar@plt>
jmp    1163 <setvarcmd+0x33>
lea    0xea4(%rip),%rdi
xor    %eax,%eax
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 (i32, i8**, ...) bitcast (i32 (...)* @unsetcmd to i32 (i32, i8**, ...)*)(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 (i8*, i8*, i32, ...) bitcast (i32 (...)* @setvar to i32 (i8*, i8*, i32, ...)*)(i8* %18, i8* %21, i32 0)
br label %25
23: ; preds = %12
%24 = call i32 (i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, ...)*)(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 (i32, i8**, ...) bitcast (i32 (...)* @unsetcmd to i32 (i32, i8**, ...)*)(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 (i8*, i8*, i32, ...) bitcast (i32 (...)* @setvar to i32 (i8*, i8*, i32, ...)*)(i8* %10, i8* %12, i32 0)
br label %16
14: ; preds = %6
%15 = tail call i32 (i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, ...)*)(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
}