#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 tag_symbol {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ gen_def_byte();
int /*<<< orphan*/ gen_def_word();
int getlabel();
int /*<<< orphan*/ newline();
int /*<<< orphan*/ number(int *);
int /*<<< orphan*/ output_label_terminator();
int /*<<< orphan*/ output_number(int);
int /*<<< orphan*/ print_label(int);
int /*<<< orphan*/ quoted_char(int *);
scalar_t__ quoted_string(int *, int /*<<< orphan*/ *);
int init(char *symbol_name, int type, int identity, int *dim,
         struct tag_symbol *tag) {
  int value, n;
  if (identity == 3) {
    int x = getlabel();
    gen_def_word();
    print_label(x);
    newline();
    print_label(x);
    output_label_terminator();
    newline();
  }
  if (quoted_string(&n, NULL)) {
    if ((identity == 1) || !(type & (1 << 2)))
      error("found string: must assign to char pointer or array");
    *dim = *dim - n;
    return n;
  }
  if (type & (1 << 2))
    gen_def_byte();
  else
    gen_def_word();
  if (!number(&value) && !quoted_char(&value))
    return 0;
  *dim = *dim - 1;
  output_number(value);
  newline();
  return (type & (1 << 2)) ? 1 : 2;
}


x86 assembly (clang, -O0):
<init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
cmpl   $0x3,-0x18(%rbp)
jne    120a <init+0x5a>
mov    $0x0,%al
call   1050 <getlabel@plt>
mov    %eax,-0x34(%rbp)
mov    $0x0,%al
call   10b0 <gen_def_word@plt>
mov    -0x34(%rbp),%edi
call   1040 <print_label@plt>
mov    $0x0,%al
call   1030 <newline@plt>
mov    -0x34(%rbp),%edi
call   1040 <print_label@plt>
mov    $0x0,%al
call   1090 <output_label_terminator@plt>
mov    $0x0,%al
call   1030 <newline@plt>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1080 <quoted_string@plt>
cmp    $0x0,%rax
je     1260 <init+0xb0>
cmpl   $0x1,-0x18(%rbp)
je     123a <init+0x8a>
mov    -0x14(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
jne    1246 <init+0x96>
lea    0xdbf(%rip),%rdi
call   10c0 <error@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
sub    -0x30(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12e9 <init+0x139>
mov    -0x14(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     127b <init+0xcb>
mov    $0x0,%al
call   10d0 <gen_def_byte@plt>
jmp    1282 <init+0xd2>
mov    $0x0,%al
call   10b0 <gen_def_word@plt>
lea    -0x2c(%rbp),%rdi
call   10a0 <number@plt>
cmp    $0x0,%eax
jne    12b2 <init+0x102>
lea    -0x2c(%rbp),%rdi
call   1070 <quoted_char@plt>
cmp    $0x0,%eax
jne    12b2 <init+0x102>
movl   $0x0,-0x4(%rbp)
jmp    12e9 <init+0x139>
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x2c(%rbp),%edi
call   1060 <output_number@plt>
mov    $0x0,%al
call   1030 <newline@plt>
mov    -0x14(%rbp),%edx
and    $0x4,%edx
mov    $0x2,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %edx,%ebx
mov    %esi,%r15d
cmp    $0x3,%edx
jne    11f7 <init+0x47>
xor    %eax,%eax
call   1050 <getlabel@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   10b0 <gen_def_word@plt>
mov    %ebp,%edi
call   1040 <print_label@plt>
xor    %eax,%eax
call   1030 <newline@plt>
mov    %ebp,%edi
call   1040 <print_label@plt>
xor    %eax,%eax
call   1090 <output_label_terminator@plt>
xor    %eax,%eax
call   1030 <newline@plt>
lea    0x4(%rsp),%rdi
xor    %esi,%esi
call   1080 <quoted_string@plt>
test   %rax,%rax
je     1228 <init+0x78>
cmp    $0x1,%ebx
je     1213 <init+0x63>
and    $0x4,%r15d
jne    121f <init+0x6f>
lea    0xde6(%rip),%rdi
call   10c0 <error@plt>
mov    0x4(%rsp),%eax
sub    %eax,(%r14)
jmp    1277 <init+0xc7>
xor    %eax,%eax
test   $0x4,%r15b
jne    1237 <init+0x87>
call   10b0 <gen_def_word@plt>
jmp    123c <init+0x8c>
call   10d0 <gen_def_byte@plt>
mov    %rsp,%rdi
call   10a0 <number@plt>
test   %eax,%eax
jne    1254 <init+0xa4>
mov    %rsp,%rdi
call   1070 <quoted_char@plt>
test   %eax,%eax
je     1282 <init+0xd2>
and    $0x4,%r15d
addl   $0xffffffff,(%r14)
mov    (%rsp),%edi
call   1060 <output_number@plt>
xor    %eax,%eax
call   1030 <newline@plt>
cmp    $0x1,%r15d
mov    $0x1,%eax
adc    $0x0,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
jmp    1277 <init+0xc7>

LLVM IR (-O0):
%struct.tag_symbol = type { i32 }
@.str = [51 x i8] c"found string: must assign to char pointer or array\00"
define i32 @init(i8* %0, i32 %1, i32 %2, i32* %3, %struct.tag_symbol* %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca %struct.tag_symbol*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i8* %0, i8** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32* %3, i32** %10
store %struct.tag_symbol* %4, %struct.tag_symbol** %11
%15 = load i32, i32* %9
%16 = icmp eq i32 %15, 3
br i1 %16, label %17, label %27
17: ; preds = %5
%18 = call i32 (...) @getlabel()
store i32 %18, i32* %14
%19 = call i32 (...) @gen_def_word()
%20 = load i32, i32* %14
%21 = call i32 @print_label(i32 %20)
%22 = call i32 (...) @newline()
%23 = load i32, i32* %14
%24 = call i32 @print_label(i32 %23)
%25 = call i32 (...) @output_label_terminator()
%26 = call i32 (...) @newline()
br label %27
27: ; preds = %17, %5
%28 = call i64 @quoted_string(i32* %13, i32* null)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %46
30: ; preds = %27
%31 = load i32, i32* %9
%32 = icmp eq i32 %31, 1
br i1 %32, label %37, label %33
33: ; preds = %30
%34 = load i32, i32* %8
%35 = and i32 %34, 4
%36 = icmp ne i32 %35, 0
br i1 %36, label %39, label %37
37: ; preds = %33, %30
%38 = call i32 @error(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
br label %39
39: ; preds = %37, %33
%40 = load i32*, i32** %10
%41 = load i32, i32* %40
%42 = load i32, i32* %13
%43 = sub nsw i32 %41, %42
%44 = load i32*, i32** %10
store i32 %43, i32* %44
%45 = load i32, i32* %13
store i32 %45, i32* %6
br label %74
46: ; preds = %27
%47 = load i32, i32* %8
%48 = and i32 %47, 4
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %46
%51 = call i32 (...) @gen_def_byte()
br label %54
52: ; preds = %46
%53 = call i32 (...) @gen_def_word()
br label %54
54: ; preds = %52, %50
%55 = call i32 @number(i32* %12)
%56 = icmp ne i32 %55, 0
br i1 %56, label %61, label %57
57: ; preds = %54
%58 = call i32 @quoted_char(i32* %12)
%59 = icmp ne i32 %58, 0
br i1 %59, label %61, label %60
60: ; preds = %57
store i32 0, i32* %6
br label %74
61: ; preds = %57, %54
%62 = load i32*, i32** %10
%63 = load i32, i32* %62
%64 = sub nsw i32 %63, 1
%65 = load i32*, i32** %10
store i32 %64, i32* %65
%66 = load i32, i32* %12
%67 = call i32 @output_number(i32 %66)
%68 = call i32 (...) @newline()
%69 = load i32, i32* %8
%70 = and i32 %69, 4
%71 = icmp ne i32 %70, 0
%72 = zext i1 %71 to i64
%73 = select i1 %71, i32 1, i32 2
store i32 %73, i32* %6
br label %74
74: ; preds = %61, %60, %39
%75 = load i32, i32* %6
ret i32 %75
}

LLVM IR (-O2):
%struct.tag_symbol = type { i32 }
@.str = [51 x i8] c"found string: must assign to char pointer or array\00"
define i32 @init(i8* nocapture readnone %0, i32 %1, i32 %2, i32* nocapture %3, %struct.tag_symbol* nocapture readnone %4) {
%6 = alloca i32
%7 = alloca i32
%8 = bitcast i32* %6 to i8*
%9 = bitcast i32* %7 to i8*
%10 = icmp eq i32 %2, 3
br i1 %10, label %11, label %19
11: ; preds = %5
%12 = tail call i32 (...) @getlabel()
%13 = tail call i32 (...) @gen_def_word()
%14 = tail call i32 @print_label(i32 %12)
%15 = tail call i32 (...) @newline()
%16 = tail call i32 @print_label(i32 %12)
%17 = tail call i32 (...) @output_label_terminator()
%18 = tail call i32 (...) @newline()
br label %19
19: ; preds = %11, %5
%20 = call i64 @quoted_string(i32* %7, i32* null)
%21 = icmp eq i64 %20, 0
br i1 %21, label %33, label %22
22: ; preds = %19
%23 = icmp eq i32 %2, 1
%24 = and i32 %1, 4
%25 = icmp eq i32 %24, 0
%26 = or i1 %23, %25
br i1 %26, label %27, label %29
27: ; preds = %22
%28 = call i32 @error(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
br label %29
29: ; preds = %22, %27
%30 = load i32, i32* %3
%31 = load i32, i32* %7
%32 = sub nsw i32 %30, %31
store i32 %32, i32* %3
br label %53
33: ; preds = %19
%34 = and i32 %1, 4
%35 = icmp eq i32 %34, 0
br i1 %35, label %38, label %36
36: ; preds = %33
%37 = call i32 (...) @gen_def_byte()
br label %40
38: ; preds = %33
%39 = call i32 (...) @gen_def_word()
br label %40
40: ; preds = %38, %36
%41 = call i32 @number(i32* %6)
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %40
%44 = call i32 @quoted_char(i32* %6)
%45 = icmp eq i32 %44, 0
br i1 %45, label %53, label %46
46: ; preds = %43, %40
%47 = load i32, i32* %3
%48 = add nsw i32 %47, -1
store i32 %48, i32* %3
%49 = load i32, i32* %6
%50 = call i32 @output_number(i32 %49)
%51 = call i32 (...) @newline()
%52 = select i1 %35, i32 2, i32 1
br label %53
53: ; preds = %43, %46, %29
%54 = phi i32 [ %31, %29 ], [ %52, %46 ], [ 0, %43 ]
ret i32 %54
}