// File: /workspace/github_c_makefile_star2_O0/ccxvii[P]mujs/./jsregexp.c
// Function: jsB_new_RegExp
static void jsB_new_RegExp(js_State *J)
{
	js_Regexp *old;
	const char *pattern;
	int flags;
	int is_clone = 0;

	if (js_isregexp(J, 1)) {
		if (js_isdefined(J, 2))
			js_typeerror(J, "cannot supply flags when creating one RegExp from another");
		old = js_toregexp(J, 1);
		pattern = old->source;
		flags = old->flags;
		is_clone = 1;
	} else if (js_isundefined(J, 1)) {
		pattern = "(?:)";
		flags = 0;
	} else {
		pattern = js_tostring(J, 1);
		flags = 0;
	}

	if (strlen(pattern) == 0)
		pattern = "(?:)";

	if (js_isdefined(J, 2)) {
		const char *s = js_tostring(J, 2);
		int g = 0, i = 0, m = 0;
		while (*s) {
			if (*s == 'g') ++g;
			else if (*s == 'i') ++i;
			else if (*s == 'm') ++m;
			else js_syntaxerror(J, "invalid regular expression flag: '%c'", *s);
			++s;
		}
		if (g > 1) js_syntaxerror(J, "invalid regular expression flag: 'g'");
		if (i > 1) js_syntaxerror(J, "invalid regular expression flag: 'i'");
		if (m > 1) js_syntaxerror(J, "invalid regular expression flag: 'm'");
		if (g) flags |= JS_REGEXP_G;
		if (i) flags |= JS_REGEXP_I;
		if (m) flags |= JS_REGEXP_M;
	}

	js_newregexpx(J, pattern, flags, is_clone);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15360
cmpl $0x0, %eax
je 0x13fcd
movq -0x8(%rbp), %rdi
movl $0x2, %esi
callq 0x150d0
cmpl $0x0, %eax
je 0x13f9b
movq -0x8(%rbp), %rdi
leaq 0x29559(%rip), %rsi     # 0x3d4ed
movb $0x0, %al
callq 0xbfe0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15f20
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x10(%rax), %eax
movl %eax, -0x1c(%rbp)
movl $0x1, -0x20(%rbp)
jmp 0x1400f
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15100
cmpl $0x0, %eax
je 0x13ff4
leaq 0x272cf(%rip), %rax     # 0x3b2b6
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
jmp 0x1400d
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x14b80
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
jmp 0x1400f
movq -0x18(%rbp), %rdi
callq 0x31e0
cmpq $0x0, %rax
jne 0x14029
leaq 0x27291(%rip), %rax     # 0x3b2b6
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl $0x2, %esi
callq 0x150d0
cmpl $0x0, %eax
je 0x14157
movq -0x8(%rbp), %rdi
movl $0x2, %esi
callq 0x14b80
movq %rax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x28(%rbp), %rax
cmpb $0x0, (%rax)
je 0x140e0
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x67, %eax
jne 0x14087
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x140d2
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x69, %eax
jne 0x1409e
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x140d0
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x6d, %eax
jne 0x140b5
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x140ce
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movsbl (%rax), %edx
leaq 0x29460(%rip), %rsi     # 0x3d527
movb $0x0, %al
callq 0xbee0
jmp 0x140d0
jmp 0x140d2
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x14067
cmpl $0x1, -0x2c(%rbp)
jle 0x140f8
movq -0x8(%rbp), %rdi
leaq 0x2945c(%rip), %rsi     # 0x3d54d
movb $0x0, %al
callq 0xbee0
cmpl $0x1, -0x30(%rbp)
jle 0x14110
movq -0x8(%rbp), %rdi
leaq 0x29469(%rip), %rsi     # 0x3d572
movb $0x0, %al
callq 0xbee0
cmpl $0x1, -0x34(%rbp)
jle 0x14128
movq -0x8(%rbp), %rdi
leaq 0x29476(%rip), %rsi     # 0x3d597
movb $0x0, %al
callq 0xbee0
cmpl $0x0, -0x2c(%rbp)
je 0x14137
movl -0x1c(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x30(%rbp)
je 0x14146
movl -0x1c(%rbp), %eax
orl $0x2, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x14155
movl -0x1c(%rbp), %eax
orl $0x4, %eax
movl %eax, -0x1c(%rbp)
jmp 0x14157
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
movl -0x20(%rbp), %ecx
callq 0x133b0
addq $0x40, %rsp
popq %rbp
retq