#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 hash_entry {
  int dummy;
};
struct compile_state {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ define_macro(struct compile_state *, struct hash_entry *,
                                char const *, int /*<<< orphan*/, int,
                                int /*<<< orphan*/);
int /*<<< orphan*/ internal_error(struct compile_state *, int /*<<< orphan*/,
                                  char *);
struct hash_entry *lookup(struct compile_state *, char const *,
                          int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
void register_builtin_macro(struct compile_state *state, const char *name,
                            const char *value) {
  struct hash_entry *ident;
  if (value[0] == '(') {
    internal_error(state, 0, "Builtin macros with arguments not supported");
  }
  ident = lookup(state, name, strlen(name));
  define_macro(state, ident, value, strlen(value), -1, 0);
}


x86 assembly (clang, -O0):
<register_builtin_macro>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x28,%eax
jne    1176 <register_builtin_macro+0x36>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
lea    0xe8f(%rip),%rdx
call   1050 <internal_error@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    %eax,%edx
call   1040 <lookup@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    %eax,%ecx
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1060 <define_macro@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<register_builtin_macro>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r14
cmpb   $0x28,(%rdx)
jne    1164 <register_builtin_macro+0x24>
lea    0xea6(%rip),%rdx
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <internal_error@plt>
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %eax,%edx
call   1040 <lookup@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %eax,%ecx
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
pop    %rbx
pop    %r14
pop    %r15
jmp    1060 <define_macro@plt>

LLVM IR (-O0):
%struct.compile_state = type { i32 }
%struct.hash_entry = type { i32 }
@.str = [44 x i8] c"Builtin macros with arguments not supported\00"
define void @register_builtin_macro(%struct.compile_state* %0, i8* %1, i8* %2) {
%4 = alloca %struct.compile_state*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca %struct.hash_entry*
store %struct.compile_state* %0, %struct.compile_state** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %6
%9 = getelementptr inbounds i8, i8* %8, i64 0
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 40
br i1 %12, label %13, label %16
13: ; preds = %3
%14 = load %struct.compile_state*, %struct.compile_state** %4
%15 = call i32 @internal_error(%struct.compile_state* %14, i32 0, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %13, %3
%17 = load %struct.compile_state*, %struct.compile_state** %4
%18 = load i8*, i8** %5
%19 = load i8*, i8** %5
%20 = call i32 @strlen(i8* %19)
%21 = call %struct.hash_entry* @lookup(%struct.compile_state* %17, i8* %18, i32 %20)
store %struct.hash_entry* %21, %struct.hash_entry** %7
%22 = load %struct.compile_state*, %struct.compile_state** %4
%23 = load %struct.hash_entry*, %struct.hash_entry** %7
%24 = load i8*, i8** %6
%25 = load i8*, i8** %6
%26 = call i32 @strlen(i8* %25)
%27 = call i32 @define_macro(%struct.compile_state* %22, %struct.hash_entry* %23, i8* %24, i32 %26, i32 -1, i32 0)
ret void
}

LLVM IR (-O2):
%struct.compile_state = type { i32 }
%struct.hash_entry = type { i32 }
@.str = [44 x i8] c"Builtin macros with arguments not supported\00"
define void @register_builtin_macro(%struct.compile_state* %0, i8* %1, i8* %2) {
%4 = load i8, i8* %2
%5 = icmp eq i8 %4, 40
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @internal_error(%struct.compile_state* %0, i32 0, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
%9 = tail call i32 @strlen(i8* %1)
%10 = tail call %struct.hash_entry* @lookup(%struct.compile_state* %0, i8* %1, i32 %9)
%11 = tail call i32 @strlen(i8* %2)
%12 = tail call i32 @define_macro(%struct.compile_state* %0, %struct.hash_entry* %10, i8* %2, i32 %11, i32 -1, i32 0)
ret void
}