#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
char *ptr_to_define(char *pointer_type) {
  if (!strcmp(pointer_type, "unique")) {
    return "NDR_POINTER_UNIQUE";
  } else if (!strcmp(pointer_type, "ref")) {
    return "NDR_POINTER_REF";
  } else if (!strcmp(pointer_type, "ptr")) {
    return "NDR_POINTER_PTR";
  }
  fprintf(stderr, "prt_to_define, 	weirdo pointer :%s\n", pointer_type);
  exit(10);
}


x86 assembly (clang, -O0):
<ptr_to_define>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1165 <ptr_to_define+0x35>
lea    0xeab(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e4 <ptr_to_define+0xb4>
mov    -0x10(%rbp),%rdi
lea    0xeaa(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    118e <ptr_to_define+0x5e>
lea    0xe99(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e4 <ptr_to_define+0xb4>
mov    -0x10(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11b7 <ptr_to_define+0x87>
lea    0xe84(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e4 <ptr_to_define+0xb4>
jmp    11bc <ptr_to_define+0x8c>
jmp    11c1 <ptr_to_define+0x91>
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe6d(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xa,%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ptr_to_define>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1173 <ptr_to_define+0x43>
lea    0xecf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     117c <ptr_to_define+0x4c>
lea    0xed0(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
jne    1185 <ptr_to_define+0x55>
lea    0xec1(%rip),%rax
pop    %rbx
ret
lea    0xe8d(%rip),%rax
pop    %rbx
ret
lea    0xe9b(%rip),%rax
pop    %rbx
ret
mov    0x2e54(%rip),%rax
mov    (%rax),%edi
lea    0xead(%rip),%rsi
mov    %rbx,%rdx
call   1040 <fprintf@plt>
mov    $0xa,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"unique\00"
@.str.1 = [19 x i8] c"NDR_POINTER_UNIQUE\00"
@.str.2 = [4 x i8] c"ref\00"
@.str.3 = [16 x i8] c"NDR_POINTER_REF\00"
@.str.4 = [4 x i8] c"ptr\00"
@.str.5 = [16 x i8] c"NDR_POINTER_PTR\00"
@stderr = global i32 0
@.str.6 = [36 x i8] c"prt_to_define, \09weirdo pointer :%s\0A\00"
define i8* @ptr_to_define(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @strcmp(i8* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i32 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %25
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i32 @strcmp(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp ne i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %8
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %25
13: ; preds = %8
%14 = load i8*, i8** %3
%15 = call i32 @strcmp(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%16 = icmp ne i32 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %13
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %25
18: ; preds = %13
br label %19
19: ; preds = %18
br label %20
20: ; preds = %19
%21 = load i32, i32* @stderr
%22 = load i8*, i8** %3
%23 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), i8* %22)
%24 = call i32 @exit(i32 10)
unreachable
25: ; preds = %17, %12, %7
%26 = load i8*, i8** %2
ret i8* %26
}

LLVM IR (-O2):
@.str = [7 x i8] c"unique\00"
@.str.1 = [19 x i8] c"NDR_POINTER_UNIQUE\00"
@.str.2 = [4 x i8] c"ref\00"
@.str.3 = [16 x i8] c"NDR_POINTER_REF\00"
@.str.4 = [4 x i8] c"ptr\00"
@.str.5 = [16 x i8] c"NDR_POINTER_PTR\00"
@stderr = global i32 0
@.str.6 = [36 x i8] c"prt_to_define, \09weirdo pointer :%s\0A\00"
define i8* @ptr_to_define(i8* %0) {
%2 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %4
%8 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), i8* %0)
%13 = tail call i32 @exit(i32 10)
unreachable
14: ; preds = %7, %4, %1
%15 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), %1 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), %7 ]
ret i8* %15
}