// File: /workspace/github_c_makefile_star2_O0/aquaxis[P]synverll/src/parser_ir.c
// Function: get_irtype_llvm
int get_irtype_llvm(char *line, char *token)
{
	char *result;
	int level = 0;

	result = calloc(STR_MAX, 1);

	get_token_llvm(line, token);
	strcpy(result, "");

	/*
	 * add/mul演算のみ次の宣言が付く場合がある
	 * nsw: No Signed Wrap
	 * nuw: No UnSigned Wrap
	 */
	if(!strcmp(token, "nsw") || !strcmp(token, "nuw")){
		// nsw, nusについては必要性がわからないため保留
		get_token_llvm(line, token);
	}
	if(!strcmp(token, "nsw") || !strcmp(token, "nuw")){
		// nsw, nusについては必要性がわからないため保留
		get_token_llvm(line, token);
	}

	if(!strcmp(token, "<")){
		// 構造体型
		strcat(result, token);
		level = 1;
		do{
			get_token_llvm(line, token);
			if(!strcmp(token, "")) break;
			if(strlen(result) > 0)strcat(result, " ");
			strcat(result, token);
			if(!strcmp(token,"<")) level++;
			if(!strcmp(token,">")) level--;
			if(!strcmp(token,">*")) level--;
		}while((strcmp(token,">") && strcmp(token,">*")) || (level != 0));
		strcpy(token, result);
	}else if(!strcmp(token, "[")){
		// 構造体型
		strcat(result, token);
		level = 1;
		do{
			get_token_llvm(line, token);
			if(!strcmp(token, "")) break;
			if(strlen(result) > 0)strcat(result, " ");
			strcat(result, token);
			if(!strcmp(token,"[")) level++;
			if(!strcmp(token,"]")) level--;
			if(!strcmp(token,"]*")) level--;
		}while((strcmp(token,"]") && strcmp(token,"]*")) || (level != 0));
		strcpy(token, result);
	}else if(!strcmp(token, "{")){
		// 構造体型
		strcat(result, token);
		level = 1;
		do{
			get_token_llvm(line, token);
			if(!strcmp(token, "")) break;
			if(strlen(result) > 0)strcat(result, " ");
			strcat(result, token);
			if(!strcmp(token,"{")) level++;
			if(!strcmp(token,"}")) level--;
		}while(strcmp(token,"}") || (level != 0));
		strcpy(token, result);
	}else if(!strcmp(token, "getelementptr")){
		// ポインタ
		/*
		 * ToDo:
		 * ポインタはinboundsされていないケースもあるかも
		 */
		strcat(result, token);
		if(strlen(result) > 0)strcat(result, " ");
		// inbounds
		get_token_llvm(line, token);
		if(!strcmp(token, "inbounds")){
			strcat(result, token);
			// type
			get_token_llvm(line, token);
		}
		if(!strcmp(token, "[")){
			strcat(result, token);
			level = 1;
			do{
				get_token_llvm(line, token);
				if(!strcmp(token, "")) break;
				if(strlen(result) > 0)strcat(result, " ");
				strcat(result, token);
				if(!strcmp(token, "[")) level++;
				if(!strcmp(token, "]")) level--;
			}while(strcmp(token,"]") && strcmp(token,"]*") && (level != 0));
		}else if(!strcmp(token, "(")){
			strcat(result, token);
			level = 1;
			do{
				get_token_llvm(line, token);
				if(!strcmp(token, "")) break;
				if(strlen(result) > 0)strcat(result, " ");
				strcat(result, token);
				if(!strcmp(token, "(")) level++;
				if(!strcmp(token, ")")) level--;
			}while(strcmp(token,")") && strcmp(token,")*") && (level != 0));
		}else{
			if(strlen(result) > 0)strcat(result, " ");
			strcat(result, token);
		}
		strcpy(token, result);
	}else{
		// 単独のタイプ
		strcat(result, token);
		strcpy(token, result);
	}

	free(result);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x400, %edi            # imm = 0x400
movl $0x1, %esi
callq 0x10c0
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x11ca0
movq -0x18(%rbp), %rdi
leaq 0x129cf(%rip), %rsi     # 0x14fc1
callq 0x1050
movq -0x10(%rbp), %rdi
leaq 0x10bae(%rip), %rsi     # 0x131b0
callq 0x10d0
cmpl $0x0, %eax
je 0x2621
movq -0x10(%rbp), %rdi
leaq 0x10b9d(%rip), %rsi     # 0x131b4
callq 0x10d0
cmpl $0x0, %eax
jne 0x262e
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x11ca0
movq -0x10(%rbp), %rdi
leaq 0x10b77(%rip), %rsi     # 0x131b0
callq 0x10d0
cmpl $0x0, %eax
je 0x2658
movq -0x10(%rbp), %rdi
leaq 0x10b66(%rip), %rsi     # 0x131b4
callq 0x10d0
cmpl $0x0, %eax
jne 0x2665
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x11ca0
movq -0x10(%rbp), %rdi
leaq 0x10a8c(%rip), %rsi     # 0x130fc
callq 0x10d0
cmpl $0x0, %eax
jne 0x2799
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1150
movl $0x1, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x11ca0
movq -0x10(%rbp), %rdi
leaq 0x12917(%rip), %rsi     # 0x14fc1
callq 0x10d0
cmpl $0x0, %eax
jne 0x26b9
jmp 0x2787
movq -0x18(%rbp), %rdi
callq 0x1070
cmpq $0x0, %rax
jbe 0x26d8
movq -0x18(%rbp), %rdi
leaq 0x10cab(%rip), %rsi     # 0x1337e
callq 0x1150
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1150
movq -0x10(%rbp), %rdi
leaq 0x10a0c(%rip), %rsi     # 0x130fc
callq 0x10d0
cmpl $0x0, %eax
jne 0x2703
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x109f0(%rip), %rsi     # 0x130fe
callq 0x10d0
cmpl $0x0, %eax
jne 0x2721
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x10a8c(%rip), %rsi     # 0x131b8
callq 0x10d0
cmpl $0x0, %eax
jne 0x273f
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x2741
movq -0x10(%rbp), %rdi
leaq 0x109b2(%rip), %rsi     # 0x130fe
callq 0x10d0
cmpl $0x0, %eax
je 0x2772
movq -0x10(%rbp), %rdi
leaq 0x10a57(%rip), %rsi     # 0x131b8
callq 0x10d0
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x1d(%rbp)
jne 0x277c
cmpl $0x0, -0x1c(%rbp)
setne %al
movb %al, -0x1d(%rbp)
movb -0x1d(%rbp), %al
testb $0x1, %al
jne 0x2692
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1050
jmp 0x2cc9
movq -0x10(%rbp), %rdi
leaq 0x10a17(%rip), %rsi     # 0x131bb
callq 0x10d0
cmpl $0x0, %eax
jne 0x28cd
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1150
movl $0x1, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x11ca0
movq -0x10(%rbp), %rdi
leaq 0x127e3(%rip), %rsi     # 0x14fc1
callq 0x10d0
cmpl $0x0, %eax
jne 0x27ed
jmp 0x28bb
movq -0x18(%rbp), %rdi
callq 0x1070
cmpq $0x0, %rax
jbe 0x280c
movq -0x18(%rbp), %rdi
leaq 0x10b77(%rip), %rsi     # 0x1337e
callq 0x1150
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1150
movq -0x10(%rbp), %rdi
leaq 0x10997(%rip), %rsi     # 0x131bb
callq 0x10d0
cmpl $0x0, %eax
jne 0x2837
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x1097b(%rip), %rsi     # 0x131bd
callq 0x10d0
cmpl $0x0, %eax
jne 0x2855
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x1095f(%rip), %rsi     # 0x131bf
callq 0x10d0
cmpl $0x0, %eax
jne 0x2873
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x2875
movq -0x10(%rbp), %rdi
leaq 0x1093d(%rip), %rsi     # 0x131bd
callq 0x10d0
cmpl $0x0, %eax
je 0x28a6
movq -0x10(%rbp), %rdi
leaq 0x1092a(%rip), %rsi     # 0x131bf
callq 0x10d0
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x1e(%rbp)
jne 0x28b0
cmpl $0x0, -0x1c(%rbp)
setne %al
movb %al, -0x1e(%rbp)
movb -0x1e(%rbp), %al
testb $0x1, %al
jne 0x27c6
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1050
jmp 0x2cc7
movq -0x10(%rbp), %rdi
leaq 0x1082a(%rip), %rsi     # 0x13102
callq 0x10d0
cmpl $0x0, %eax
jne 0x29ce
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1150
movl $0x1, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x11ca0
movq -0x10(%rbp), %rdi
leaq 0x126af(%rip), %rsi     # 0x14fc1
callq 0x10d0
cmpl $0x0, %eax
jne 0x2921
jmp 0x29bc
movq -0x18(%rbp), %rdi
callq 0x1070
cmpq $0x0, %rax
jbe 0x2940
movq -0x18(%rbp), %rdi
leaq 0x10a43(%rip), %rsi     # 0x1337e
callq 0x1150
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1150
movq -0x10(%rbp), %rdi
leaq 0x107aa(%rip), %rsi     # 0x13102
callq 0x10d0
cmpl $0x0, %eax
jne 0x296b
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x1078e(%rip), %rsi     # 0x13104
callq 0x10d0
cmpl $0x0, %eax
jne 0x2989
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x298b
movq -0x10(%rbp), %rdi
leaq 0x1076e(%rip), %rsi     # 0x13104
callq 0x10d0
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x1f(%rbp)
jne 0x29b1
cmpl $0x0, -0x1c(%rbp)
setne %al
movb %al, -0x1f(%rbp)
movb -0x1f(%rbp), %al
testb $0x1, %al
jne 0x28fa
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1050
jmp 0x2cc5
movq -0x10(%rbp), %rdi
leaq 0x107e9(%rip), %rsi     # 0x131c2
callq 0x10d0
cmpl $0x0, %eax
jne 0x2ca9
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1150
movq -0x18(%rbp), %rdi
callq 0x1070
cmpq $0x0, %rax
jbe 0x2a13
movq -0x18(%rbp), %rdi
leaq 0x10970(%rip), %rsi     # 0x1337e
callq 0x1150
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x11ca0
movq -0x10(%rbp), %rdi
leaq 0x107a5(%rip), %rsi     # 0x131d0
callq 0x10d0
cmpl $0x0, %eax
jne 0x2a4f
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1150
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x11ca0
movq -0x10(%rbp), %rdi
leaq 0x10761(%rip), %rsi     # 0x131bb
callq 0x10d0
cmpl $0x0, %eax
jne 0x2b5f
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1150
movl $0x1, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x11ca0
movq -0x10(%rbp), %rdi
leaq 0x1252d(%rip), %rsi     # 0x14fc1
callq 0x10d0
cmpl $0x0, %eax
jne 0x2aa3
jmp 0x2b5a
movq -0x18(%rbp), %rdi
callq 0x1070
cmpq $0x0, %rax
jbe 0x2ac2
movq -0x18(%rbp), %rdi
leaq 0x108c1(%rip), %rsi     # 0x1337e
callq 0x1150
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1150
movq -0x10(%rbp), %rdi
leaq 0x106e1(%rip), %rsi     # 0x131bb
callq 0x10d0
cmpl $0x0, %eax
jne 0x2aed
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x106c5(%rip), %rsi     # 0x131bd
callq 0x10d0
cmpl $0x0, %eax
jne 0x2b0b
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x2b0d
movq -0x10(%rbp), %rdi
leaq 0x106a5(%rip), %rsi     # 0x131bd
callq 0x10d0
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x20(%rbp)
je 0x2b4f
movq -0x10(%rbp), %rdi
leaq 0x1068b(%rip), %rsi     # 0x131bf
callq 0x10d0
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x20(%rbp)
je 0x2b4f
cmpl $0x0, -0x1c(%rbp)
setne %al
movb %al, -0x20(%rbp)
movb -0x20(%rbp), %al
testb $0x1, %al
jne 0x2a7c
jmp 0x2c9a
movq -0x10(%rbp), %rdi
leaq 0x10596(%rip), %rsi     # 0x13100
callq 0x10d0
cmpl $0x0, %eax
jne 0x2c6c
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1150
movl $0x1, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x11ca0
movq -0x10(%rbp), %rdi
leaq 0x1241d(%rip), %rsi     # 0x14fc1
callq 0x10d0
cmpl $0x0, %eax
jne 0x2bb3
jmp 0x2c6a
movq -0x18(%rbp), %rdi
callq 0x1070
cmpq $0x0, %rax
jbe 0x2bd2
movq -0x18(%rbp), %rdi
leaq 0x107b1(%rip), %rsi     # 0x1337e
callq 0x1150
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1150
movq -0x10(%rbp), %rdi
leaq 0x10516(%rip), %rsi     # 0x13100
callq 0x10d0
cmpl $0x0, %eax
jne 0x2bfd
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x11511(%rip), %rsi     # 0x14119
callq 0x10d0
cmpl $0x0, %eax
jne 0x2c1b
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x2c1d
movq -0x10(%rbp), %rdi
leaq 0x114f1(%rip), %rsi     # 0x14119
callq 0x10d0
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x21(%rbp)
je 0x2c5f
movq -0x10(%rbp), %rdi
leaq 0x10595(%rip), %rsi     # 0x131d9
callq 0x10d0
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x21(%rbp)
je 0x2c5f
cmpl $0x0, -0x1c(%rbp)
setne %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0x2b8c
jmp 0x2c98
movq -0x18(%rbp), %rdi
callq 0x1070
cmpq $0x0, %rax
jbe 0x2c8b
movq -0x18(%rbp), %rdi
leaq 0x106f8(%rip), %rsi     # 0x1337e
callq 0x1150
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1150
jmp 0x2c9a
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1050
jmp 0x2cc3
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1150
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1050
jmp 0x2cc5
jmp 0x2cc7
jmp 0x2cc9
movq -0x18(%rbp), %rdi
callq 0x1030
xorl %eax, %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)