#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 */
char *getarg(char *, char *);
char *gettxt_fig(char *);
scalar_t__ isdigit(char);
char *getname(char *s, char *t) {
  if ((s = getarg(s, t)) == NULL)
    *t = '\0';
  else if (*t == '"')
    *t++ = '\0';
  else {
    if (!(isdigit(*t) || *t == '-'))
      *t = '\0';
    t = gettxt_fig(s);
  }
  return (t);
}


x86 assembly (clang, -O0):
<getname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <getarg@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
jne    1167 <getname+0x37>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
jmp    11cd <getname+0x9d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    118e <getname+0x5e>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x0,(%rax)
jmp    11c8 <getname+0x98>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
jne    11bb <getname+0x8b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
je     11bb <getname+0x8b>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
call   1040 <gettxt_fig@plt>
mov    %rax,-0x10(%rbp)
jmp    11cd <getname+0x9d>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getname>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1050 <getarg@plt>
test   %rax,%rax
je     1153 <getname+0x23>
mov    %rax,%r14
mov    (%rbx),%al
cmp    $0x22,%al
jne    1161 <getname+0x31>
movb   $0x0,(%rbx)
add    $0x1,%rbx
jmp    1156 <getname+0x26>
movb   $0x0,(%rbx)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %rax,%rax
jne    1176 <getname+0x46>
cmpb   $0x2d,(%rbx)
je     1176 <getname+0x46>
movb   $0x0,(%rbx)
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <gettxt_fig@plt>

LLVM IR (-O0):
define i8* @getname(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i8* @getarg(i8* %5, i8* %6)
store i8* %7, i8** %3
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i8*, i8** %4
store i8 0, i8* %10
br label %35
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 34
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %4
store i8 0, i8* %17
br label %34
19: ; preds = %11
%20 = load i8*, i8** %4
%21 = load i8, i8* %20
%22 = call i64 @isdigit(i8 signext %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %31, label %24
24: ; preds = %19
%25 = load i8*, i8** %4
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 45
br i1 %28, label %31, label %29
29: ; preds = %24
%30 = load i8*, i8** %4
store i8 0, i8* %30
br label %31
31: ; preds = %29, %24, %19
%32 = load i8*, i8** %3
%33 = call i8* @gettxt_fig(i8* %32)
store i8* %33, i8** %4
br label %34
34: ; preds = %31, %16
br label %35
35: ; preds = %34, %9
%36 = load i8*, i8** %4
ret i8* %36
}

LLVM IR (-O2):
define i8* @getname(i8* %0, i8* %1) {
%3 = tail call i8* @getarg(i8* %0, i8* %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %6
5: ; preds = %2
store i8 0, i8* %1
br label %20
6: ; preds = %2
%7 = load i8, i8* %1
%8 = icmp eq i8 %7, 34
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = getelementptr inbounds i8, i8* %1, i64 1
store i8 0, i8* %1
br label %20
11: ; preds = %6
%12 = tail call i64 @isdigit(i8 signext %7)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = load i8, i8* %1
%16 = icmp eq i8 %15, 45
br i1 %16, label %18, label %17
17: ; preds = %14
store i8 0, i8* %1
br label %18
18: ; preds = %17, %14, %11
%19 = tail call i8* @gettxt_fig(i8* %3)
br label %20
20: ; preds = %9, %18, %5
%21 = phi i8* [ %1, %5 ], [ %10, %9 ], [ %19, %18 ]
ret i8* %21
}