#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 */
char *calloc(int, int);
char *charalloc(char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ get_irtype_llvm(char *, char *);
int /*<<< orphan*/ get_token_llvm(char *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int get_pointer_llvm(char *line, char *token) {
  char *result;
  char *line_org;
  result = calloc(1024, 1);
  line_org = charalloc(line);
  get_token_llvm(line_org, token);
  strcpy(result, "");
  get_token_llvm(line_org, token);
  strcpy(result, "");
  if (!strcmp(token, "inbounds")) {
    get_token_llvm(line_org, token);
  } else {
    strcpy(result, token);
    strcpy(token, result);
    free(line_org);
    return 0;
  }
  get_irtype_llvm(line_org, token);
  get_token_llvm(line_org, token);
  strcpy(result, token);
  strcpy(token, result);
  free(line_org);
  free(result);
  return 0;
}


x86 assembly (clang, -O0):
<get_pointer_llvm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    $0x400,%edi
mov    $0x1,%esi
call   1070 <calloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1090 <charalloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <get_token_llvm@plt>
mov    -0x20(%rbp),%rdi
lea    0xe50(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <get_token_llvm@plt>
mov    -0x20(%rbp),%rdi
lea    0xe33(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rdi
lea    0xe1b(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1205 <get_pointer_llvm+0x95>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <get_token_llvm@plt>
jmp    1234 <get_pointer_llvm+0xc4>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
jmp    1281 <get_pointer_llvm+0x111>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <get_irtype_llvm@plt>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <get_token_llvm@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_pointer_llvm>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r15
mov    $0x400,%edi
mov    $0x1,%esi
call   1070 <calloc@plt>
mov    %rax,%r14
mov    %r15,%rdi
call   1090 <charalloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
mov    %rbx,%rsi
call   1060 <get_token_llvm@plt>
lea    0xe5b(%rip),%r12
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <strcpy@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <get_token_llvm@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <strcpy@plt>
lea    0xe2b(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
je     11fc <get_pointer_llvm+0x8c>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
mov    %r15,%r14
jmp    123b <get_pointer_llvm+0xcb>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <get_token_llvm@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <get_irtype_llvm@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <get_token_llvm@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [9 x i8] c"inbounds\00"
define i32 @get_pointer_llvm(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = call i8* @calloc(i32 1024, i32 1)
store i8* %8, i8** %6
%9 = load i8*, i8** %4
%10 = call i8* @charalloc(i8* %9)
store i8* %10, i8** %7
%11 = load i8*, i8** %7
%12 = load i8*, i8** %5
%13 = call i32 @get_token_llvm(i8* %11, i8* %12)
%14 = load i8*, i8** %6
%15 = call i32 @strcpy(i8* %14, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%16 = load i8*, i8** %7
%17 = load i8*, i8** %5
%18 = call i32 @get_token_llvm(i8* %16, i8* %17)
%19 = load i8*, i8** %6
%20 = call i32 @strcpy(i8* %19, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%21 = load i8*, i8** %5
%22 = call i32 @strcmp(i8* %21, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%23 = icmp ne i32 %22, 0
br i1 %23, label %28, label %24
24: ; preds = %2
%25 = load i8*, i8** %7
%26 = load i8*, i8** %5
%27 = call i32 @get_token_llvm(i8* %25, i8* %26)
br label %37
28: ; preds = %2
%29 = load i8*, i8** %6
%30 = load i8*, i8** %5
%31 = call i32 @strcpy(i8* %29, i8* %30)
%32 = load i8*, i8** %5
%33 = load i8*, i8** %6
%34 = call i32 @strcpy(i8* %32, i8* %33)
%35 = load i8*, i8** %7
%36 = call i32 @free(i8* %35)
store i32 0, i32* %3
br label %54
37: ; preds = %24
%38 = load i8*, i8** %7
%39 = load i8*, i8** %5
%40 = call i32 @get_irtype_llvm(i8* %38, i8* %39)
%41 = load i8*, i8** %7
%42 = load i8*, i8** %5
%43 = call i32 @get_token_llvm(i8* %41, i8* %42)
%44 = load i8*, i8** %6
%45 = load i8*, i8** %5
%46 = call i32 @strcpy(i8* %44, i8* %45)
%47 = load i8*, i8** %5
%48 = load i8*, i8** %6
%49 = call i32 @strcpy(i8* %47, i8* %48)
%50 = load i8*, i8** %7
%51 = call i32 @free(i8* %50)
%52 = load i8*, i8** %6
%53 = call i32 @free(i8* %52)
store i32 0, i32* %3
br label %54
54: ; preds = %37, %28
%55 = load i32, i32* %3
ret i32 %55
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [9 x i8] c"inbounds\00"
define i32 @get_pointer_llvm(i8* %0, i8* %1) {
%3 = tail call dereferenceable_or_null(1024) i8* @calloc(i32 1024, i32 1)
%4 = tail call i8* @charalloc(i8* %0)
%5 = tail call i32 @get_token_llvm(i8* %4, i8* %1)
%6 = tail call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @get_token_llvm(i8* %4, i8* %1)
%8 = tail call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = tail call i32 @get_token_llvm(i8* %4, i8* %1)
%13 = tail call i32 @get_irtype_llvm(i8* %4, i8* %1)
%14 = tail call i32 @get_token_llvm(i8* %4, i8* %1)
%15 = tail call i32 @strcpy(i8* %3, i8* %1)
%16 = tail call i32 @strcpy(i8* %1, i8* %3)
%17 = tail call i32 @free(i8* %4)
br label %21
18: ; preds = %2
%19 = tail call i32 @strcpy(i8* %3, i8* %1)
%20 = tail call i32 @strcpy(i8* %1, i8* %3)
br label %21
21: ; preds = %11, %18
%22 = phi i8* [ %3, %11 ], [ %4, %18 ]
%23 = tail call i32 @free(i8* %22)
ret i32 0
}