#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*/ delhead();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int /*<<< orphan*/ subnode(int);
void popd(char option[]) {
  int index;
  if (option[0] == '\0') {
    delhead();
  } else if (option[0] == '+') {
    sscanf(option + 1, "%d", &index);
    subnode(index);
  } else
    printf("not found\n");
}


x86 assembly (clang, -O0):
<popd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1168 <popd+0x28>
mov    $0x0,%al
call   1050 <delhead@plt>
jmp    11ae <popd+0x6e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
jne    119d <popd+0x5d>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
lea    0xe79(%rip),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <sscanf@plt>
mov    -0xc(%rbp),%edi
call   1060 <subnode@plt>
jmp    11a9 <popd+0x69>
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
jmp    11ae <popd+0x6e>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<popd>:
push   %rax
mov    (%rdi),%al
cmp    $0x2b,%al
je     1153 <popd+0x13>
test   %al,%al
jne    1173 <popd+0x33>
xor    %eax,%eax
pop    %rcx
jmp    1050 <delhead@plt>
add    $0x1,%rdi
lea    0xea2(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1040 <sscanf@plt>
mov    0x4(%rsp),%edi
call   1060 <subnode@plt>
pop    %rax
ret
lea    0xe89(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [11 x i8] c"not found\0A\00"
define void @popd(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 (...) @delhead()
br label %26
11: ; preds = %1
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 43
br i1 %16, label %17, label %23
17: ; preds = %11
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i64 1
%20 = call i32 @sscanf(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%21 = load i32, i32* %3
%22 = call i32 @subnode(i32 %21)
br label %25
23: ; preds = %11
%24 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %25
25: ; preds = %23, %17
br label %26
26: ; preds = %25, %9
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [10 x i8] c"not found\00"
define void @popd(i8* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i8, i8* %0
switch i8 %4, label %12 [
i8 0, label %5
i8 43, label %7
]
5: ; preds = %1
%6 = tail call i32 (...) @delhead()
br label %14
7: ; preds = %1
%8 = getelementptr inbounds i8, i8* %0, i64 1
%9 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = call i32 @subnode(i32 %10)
br label %14
12: ; preds = %1
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
br label %14
14: ; preds = %7, %12, %5
ret void
}