#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*/ gen_immediate();
int /*<<< orphan*/ newline();
scalar_t__ number(int *);
int /*<<< orphan*/ output_number(int);
int /*<<< orphan*/ print_label(int);
scalar_t__ quoted_char(int *);
scalar_t__ quoted_string(int /*<<< orphan*/ *, int *);
int constant(int val[]) {
  if (number(val))
    gen_immediate();
  else if (quoted_char(val))
    gen_immediate();
  else if (quoted_string(NULL, val)) {
    gen_immediate();
    print_label(val[0]);
    newline();
    return 1;
  } else
    return (0);
  output_number(val[0]);
  newline();
  return (1);
}


x86 assembly (clang, -O0):
<constant>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <number@plt>
cmp    $0x0,%rax
je     119b <constant+0x2b>
mov    $0x0,%al
call   1090 <gen_immediate@plt>
jmp    1207 <constant+0x97>
mov    -0x10(%rbp),%rdi
call   1060 <quoted_char@plt>
cmp    $0x0,%rax
je     11ba <constant+0x4a>
mov    $0x0,%al
call   1090 <gen_immediate@plt>
jmp    1202 <constant+0x92>
mov    -0x10(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1070 <quoted_string@plt>
cmp    $0x0,%rax
je     11f6 <constant+0x86>
mov    $0x0,%al
call   1090 <gen_immediate@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1040 <print_label@plt>
mov    $0x0,%al
call   1030 <newline@plt>
movl   $0x1,-0x4(%rbp)
jmp    1220 <constant+0xb0>
movl   $0x0,-0x4(%rbp)
jmp    1220 <constant+0xb0>
jmp    1207 <constant+0x97>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1050 <output_number@plt>
mov    $0x0,%al
call   1030 <newline@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<constant>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1080 <number@plt>
test   %rax,%rax
jne    118e <constant+0x1e>
mov    %r14,%rdi
call   1060 <quoted_char@plt>
test   %rax,%rax
je     11b3 <constant+0x43>
xor    %eax,%eax
call   1090 <gen_immediate@plt>
mov    (%r14),%edi
call   1050 <output_number@plt>
xor    %eax,%eax
call   1030 <newline@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %ebx,%ebx
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <quoted_string@plt>
test   %rax,%rax
je     11a9 <constant+0x39>
xor    %eax,%eax
call   1090 <gen_immediate@plt>
mov    (%r14),%edi
call   1040 <print_label@plt>
jmp    119d <constant+0x2d>

LLVM IR (-O0):
define i32 @constant(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = call i64 @number(i32* %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 (...) @gen_immediate()
br label %28
9: ; preds = %1
%10 = load i32*, i32** %3
%11 = call i64 @quoted_char(i32* %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 (...) @gen_immediate()
br label %27
15: ; preds = %9
%16 = load i32*, i32** %3
%17 = call i64 @quoted_string(i32* null, i32* %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %26
19: ; preds = %15
%20 = call i32 (...) @gen_immediate()
%21 = load i32*, i32** %3
%22 = getelementptr inbounds i32, i32* %21, i64 0
%23 = load i32, i32* %22
%24 = call i32 @print_label(i32 %23)
%25 = call i32 (...) @newline()
store i32 1, i32* %2
br label %34
26: ; preds = %15
store i32 0, i32* %2
br label %34
27: ; preds = %13
br label %28
28: ; preds = %27, %7
%29 = load i32*, i32** %3
%30 = getelementptr inbounds i32, i32* %29, i64 0
%31 = load i32, i32* %30
%32 = call i32 @output_number(i32 %31)
%33 = call i32 (...) @newline()
store i32 1, i32* %2
br label %34
34: ; preds = %28, %26, %19
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
define i32 @constant(i32* %0) {
%2 = tail call i64 @number(i32* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %14
4: ; preds = %1
%5 = tail call i64 @quoted_char(i32* %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = tail call i64 @quoted_string(i32* null, i32* %0)
%9 = icmp eq i64 %8, 0
br i1 %9, label %20, label %10
10: ; preds = %7
%11 = tail call i32 (...) @gen_immediate()
%12 = load i32, i32* %0
%13 = tail call i32 @print_label(i32 %12)
br label %18
14: ; preds = %4, %1
%15 = tail call i32 (...) @gen_immediate()
%16 = load i32, i32* %0
%17 = tail call i32 @output_number(i32 %16)
br label %18
18: ; preds = %10, %14
%19 = tail call i32 (...) @newline()
br label %20
20: ; preds = %18, %7
%21 = phi i32 [ 0, %7 ], [ 1, %18 ]
ret i32 %21
}