#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 */
struct _asm_context {
  int dummy;
};

/* Variables and functions */
scalar_t__ expect_token_s(struct _asm_context *, char *);
int parse_db(struct _asm_context *, int /*<<< orphan*/);
int parse_dc16(struct _asm_context *);
int parse_dc32(struct _asm_context *);
int parse_dc64(struct _asm_context *);
int /*<<< orphan*/ print_error_unexp(char *, struct _asm_context *);
scalar_t__ strcasecmp(char *, char *);
int /*<<< orphan*/ tokens_get(struct _asm_context *, char *, int);
int parse_dc(struct _asm_context *asm_context) {
  char token[512];
  if (expect_token_s(asm_context, ".") != 0) {
    return -1;
  }
  tokens_get(asm_context, token, 512);
  if (strcasecmp(token, "b") == 0) {
    return parse_db(asm_context, 0);
  }
  if (strcasecmp(token, "w") == 0) {
    return parse_dc16(asm_context);
  }
  if (strcasecmp(token, "l") == 0) {
    return parse_dc32(asm_context);
  }
  if (strcasecmp(token, "d") == 0) {
    return parse_dc64(asm_context);
  }
  print_error_unexp(token, asm_context);
  return -1;
}


x86 assembly (clang, -O0):
<parse_dc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe66(%rip),%rsi
call   1040 <expect_token_s@plt>
cmp    $0x0,%rax
je     11b5 <parse_dc+0x35>
movl   $0xffffffff,-0x4(%rbp)
jmp    129b <parse_dc+0x11b>
mov    -0x10(%rbp),%rdi
lea    -0x210(%rbp),%rsi
mov    $0x200,%edx
call   10a0 <tokens_get@plt>
lea    -0x210(%rbp),%rdi
lea    0xe2a(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11fa <parse_dc+0x7a>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1060 <parse_db@plt>
mov    %eax,-0x4(%rbp)
jmp    129b <parse_dc+0x11b>
lea    -0x210(%rbp),%rdi
lea    0xdfc(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1228 <parse_dc+0xa8>
mov    -0x10(%rbp),%rdi
call   1070 <parse_dc16@plt>
mov    %eax,-0x4(%rbp)
jmp    129b <parse_dc+0x11b>
lea    -0x210(%rbp),%rdi
lea    0xdd0(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1256 <parse_dc+0xd6>
mov    -0x10(%rbp),%rdi
call   1090 <parse_dc32@plt>
mov    %eax,-0x4(%rbp)
jmp    129b <parse_dc+0x11b>
lea    -0x210(%rbp),%rdi
lea    0xda4(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1284 <parse_dc+0x104>
mov    -0x10(%rbp),%rdi
call   1050 <parse_dc64@plt>
mov    %eax,-0x4(%rbp)
jmp    129b <parse_dc+0x11b>
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <print_error_unexp@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_dc>:
push   %rbp
push   %r14
push   %rbx
sub    $0x200,%rsp
mov    %rdi,%rbx
lea    0xe6b(%rip),%rsi
call   1040 <expect_token_s@plt>
mov    $0xffffffff,%ebp
test   %rax,%rax
je     11b2 <parse_dc+0x32>
mov    %ebp,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x200,%edx
call   10a0 <tokens_get@plt>
lea    0xe36(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1222 <parse_dc+0xa2>
lea    0xe24(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1233 <parse_dc+0xb3>
lea    0xe12(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1242 <parse_dc+0xc2>
lea    0xe00(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1251 <parse_dc+0xd1>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1080 <print_error_unexp@plt>
jmp    11a4 <parse_dc+0x24>
mov    %rbx,%rdi
xor    %esi,%esi
call   1060 <parse_db@plt>
mov    %eax,%ebp
jmp    11a4 <parse_dc+0x24>
mov    %rbx,%rdi
call   1070 <parse_dc16@plt>
mov    %eax,%ebp
jmp    11a4 <parse_dc+0x24>
mov    %rbx,%rdi
call   1090 <parse_dc32@plt>
mov    %eax,%ebp
jmp    11a4 <parse_dc+0x24>
mov    %rbx,%rdi
call   1050 <parse_dc64@plt>
mov    %eax,%ebp
jmp    11a4 <parse_dc+0x24>

LLVM IR (-O0):
%struct._asm_context = type { i32 }
@.str = [2 x i8] c".\00"
@.str.1 = [2 x i8] c"b\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [2 x i8] c"l\00"
@.str.4 = [2 x i8] c"d\00"
define i32 @parse_dc(%struct._asm_context* %0) {
%2 = alloca i32
%3 = alloca %struct._asm_context*
%4 = alloca [512 x i8]
store %struct._asm_context* %0, %struct._asm_context** %3
%5 = load %struct._asm_context*, %struct._asm_context** %3
%6 = call i64 @expect_token_s(%struct._asm_context* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 -1, i32* %2
br label %44
9: ; preds = %1
%10 = load %struct._asm_context*, %struct._asm_context** %3
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%12 = call i32 @tokens_get(%struct._asm_context* %10, i8* %11, i32 512)
%13 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%14 = call i64 @strcasecmp(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %9
%17 = load %struct._asm_context*, %struct._asm_context** %3
%18 = call i32 @parse_db(%struct._asm_context* %17, i32 0)
store i32 %18, i32* %2
br label %44
19: ; preds = %9
%20 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%21 = call i64 @strcasecmp(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load %struct._asm_context*, %struct._asm_context** %3
%25 = call i32 @parse_dc16(%struct._asm_context* %24)
store i32 %25, i32* %2
br label %44
26: ; preds = %19
%27 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%28 = call i64 @strcasecmp(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %26
%31 = load %struct._asm_context*, %struct._asm_context** %3
%32 = call i32 @parse_dc32(%struct._asm_context* %31)
store i32 %32, i32* %2
br label %44
33: ; preds = %26
%34 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%35 = call i64 @strcasecmp(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %40
37: ; preds = %33
%38 = load %struct._asm_context*, %struct._asm_context** %3
%39 = call i32 @parse_dc64(%struct._asm_context* %38)
store i32 %39, i32* %2
br label %44
40: ; preds = %33
%41 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%42 = load %struct._asm_context*, %struct._asm_context** %3
%43 = call i32 @print_error_unexp(i8* %41, %struct._asm_context* %42)
store i32 -1, i32* %2
br label %44
44: ; preds = %40, %37, %30, %23, %16, %8
%45 = load i32, i32* %2
ret i32 %45
}

LLVM IR (-O2):
%struct._asm_context = type { i32 }
@.str = [2 x i8] c".\00"
@.str.1 = [2 x i8] c"b\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [2 x i8] c"l\00"
@.str.4 = [2 x i8] c"d\00"
define i32 @parse_dc(%struct._asm_context* %0) {
%2 = alloca [512 x i8]
%3 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%4 = tail call i64 @expect_token_s(%struct._asm_context* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %29
6: ; preds = %1
%7 = call i32 @tokens_get(%struct._asm_context* %0, i8* %3, i32 512)
%8 = call i64 @strcasecmp(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = call i32 @parse_db(%struct._asm_context* %0, i32 0)
br label %29
12: ; preds = %6
%13 = call i64 @strcasecmp(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @parse_dc16(%struct._asm_context* %0)
br label %29
17: ; preds = %12
%18 = call i64 @strcasecmp(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @parse_dc32(%struct._asm_context* %0)
br label %29
22: ; preds = %17
%23 = call i64 @strcasecmp(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 @parse_dc64(%struct._asm_context* %0)
br label %29
27: ; preds = %22
%28 = call i32 @print_error_unexp(i8* %3, %struct._asm_context* %0)
br label %29
29: ; preds = %1, %27, %25, %20, %15, %10
%30 = phi i32 [ %11, %10 ], [ %16, %15 ], [ %21, %20 ], [ %26, %25 ], [ -1, %27 ], [ -1, %1 ]
ret i32 %30
}