// File: /workspace/github_c_makefile_star2_O0/martintopholm[P]xping/http.c
// Function: probe_new
struct probe *
probe_new(const char *line, void *owner)
{
	struct probe *prb;
	union addr sa;
	int salen;
	int port;
	regmatch_t match[RE_MAX];
	char forced[512];
	char *end;
	int i, j;

	if (regexec(&re_target, line, RE_MAX, match, 0) != 0) {
		fprintf(stderr, "probe_add: can't parse %.128s\n", line);
		return NULL;
	}

	prb = calloc(1, sizeof(*prb));
	if (prb == NULL) {
		perror("probe_add: calloc");
		return (prb);
	}
	prb->owner = owner;

	if (line[match[RE_PROTO].rm_so + 4] == 's') {
#ifdef WITH_SSL
		long ssl_options;
		prb->ssl_ctx = SSL_CTX_new(SSLv23_method());
		if (prb->ssl_ctx == NULL) {
			perror("probe_add: SSL_CTX_new");
			return NULL;
		}
		ssl_options = SSL_CTX_get_options(prb->ssl_ctx);
		ssl_options |= SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1;
		SSL_CTX_set_options(prb->ssl_ctx, ssl_options);
#else /* !WITH_SSL */
		free(prb);
		fprintf(stderr, "probe_add: ssl support not compiled in\n");
		return NULL;
#endif /* WITH_SSL */
	}

	strncat(prb->host, line + match[RE_HOST].rm_so,
	    MIN(sizeof(prb->host) - 1,
	    match[RE_HOST].rm_eo - match[RE_HOST].rm_so));
	if (match[RE_PORT].rm_so  != -1)
		port = strtol(line + match[RE_PORT].rm_so + 1, &end, 10);
#ifdef WITH_SSL
	else if (prb->ssl_ctx != NULL)
		port = 443;
#endif /* !WITH_SSL */
	else
		port = 80;

	/* prb->query NULL termination is provided by calloc */
	if (match[RE_URL].rm_so != -1)
		for (i = match[RE_URL].rm_so, j = 0; i < match[RE_URL].rm_eo &&
		    j + 3 < sizeof(prb->query) - 1; i++) {
			const char *src = &line[i];
			if (uri_chars[(unsigned char)*src])
				prb->query[j++] = *src;
			else if (*src == ' ')
				prb->query[j++] = '+';
			else
				prb->query[j++] = '%',
				    prb->query[j++] = to_hex(*src >> 4),
				    prb->query[j++] = to_hex(*src & 0xf);
		}
	else
		prb->query[0] = '/';

	/*
	 * Check for presence of forced address e.g. example.com[127.0.0.1].
	 * If present parse the address or return an error. Otherwise
	 * check the hostname for an ip literal, if it doesn't parse
	 * leave it to target_add to resolve.
	 */
	salen = sizeof(sa);
	if (match[RE_FORCED].rm_so != -1) {
		forced[0] = '\0';
		strncat(forced, line + match[RE_FORCED].rm_so,
		    MIN(sizeof(forced) - 1,
		    match[RE_FORCED].rm_eo - match[RE_FORCED].rm_so));
		if (evutil_parse_sockaddr_port(forced, &sa.sa, &salen) == 0) {
			sa(prb)->sa_family = sa.sa.sa_family;
			if (sa.sa.sa_family == AF_INET6) {
				memcpy(&sin6(prb)->sin6_addr,
				    &sa.sin6.sin6_addr,
				    sizeof(sin6(prb)->sin6_addr));
			} else {
				memcpy(&sin(prb)->sin_addr, &sa.sin.sin_addr,
				    sizeof(sin(prb)->sin_addr));
			}
			prb->resolved = 1;
		} else {
			fprintf(stderr, "probe_add: can't parse %.128s\n",
			    line);
			free(prb);
			return NULL;
		}
	} else {
		salen = sizeof(sa);
		if (evutil_parse_sockaddr_port(prb->host, &sa.sa,
		    &salen) == 0) {
			sa(prb)->sa_family = sa.sa.sa_family;
			if (sa.sa.sa_family == AF_INET6) {
				memcpy(&sin6(prb)->sin6_addr,
				    &sa.sin6.sin6_addr,
				    sizeof(sin6(prb)->sin6_addr));
			} else {
				memcpy(&sin(prb)->sin_addr, &sa.sin.sin_addr,
				    sizeof(sin(prb)->sin_addr));
			}
			prb->resolved = 1;
		} else {
			prb->dnstask = dnstask_new(prb->host, resolved, prb);
			if (prb->dnstask == NULL) {
				free(prb);
				return NULL;
			}
		}
	}
	sin(prb)->sin_port = htons(port);
	return (prb);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2e0, %rsp            # imm = 0x2E0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x90(%rbp), %rcx
leaq 0x5f4b(%rip), %rdi      # 0x92d0
movl $0x8, %edx
xorl %r8d, %r8d
callq 0x2290
cmpl $0x0, %eax
je 0x33c0
movq 0x5c3a(%rip), %rax      # 0x8fd8
movq (%rax), %rdi
movq -0x10(%rbp), %rdx
leaq 0x2eb6(%rip), %rsi      # 0x6262
movb $0x0, %al
callq 0x2320
movq $0x0, -0x8(%rbp)
jmp 0x3836
movl $0x1, %edi
movl $0xb8, %esi
callq 0x2130
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x33f3
leaq 0x2ea0(%rip), %rdi      # 0x6281
callq 0x2190
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3836
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0xb0(%rax)
movq -0x10(%rbp), %rax
movl -0x88(%rbp), %ecx
addl $0x4, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x73, %eax
jne 0x3449
movq -0x20(%rbp), %rdi
callq 0x2260
movq 0x5bad(%rip), %rax      # 0x8fd8
movq (%rax), %rdi
leaq 0x2e5e(%rip), %rsi      # 0x6293
movb $0x0, %al
callq 0x2320
movq $0x0, -0x8(%rbp)
jmp 0x3836
movq -0x20(%rbp), %rax
movq %rax, -0x2b8(%rbp)
movq -0x10(%rbp), %rax
movslq -0x78(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x2b0(%rbp)
movl -0x74(%rbp), %eax
subl -0x78(%rbp), %eax
movslq %eax, %rcx
movl $0x3f, %eax
cmpq %rcx, %rax
jae 0x3487
movl $0x3f, %eax
movq %rax, -0x2c0(%rbp)
jmp 0x3496
movl -0x74(%rbp), %eax
subl -0x78(%rbp), %eax
cltq
movq %rax, -0x2c0(%rbp)
movq -0x2b0(%rbp), %rsi
movq -0x2b8(%rbp), %rdi
movq -0x2c0(%rbp), %rdx
callq 0x2140
cmpl $-0x1, -0x60(%rbp)
je 0x34db
movq -0x10(%rbp), %rdi
movslq -0x60(%rbp), %rax
addq %rax, %rdi
addq $0x1, %rdi
leaq -0x298(%rbp), %rsi
movl $0xa, %edx
callq 0x2300
movl %eax, -0x44(%rbp)
jmp 0x34e2
movl $0x50, -0x44(%rbp)
cmpl $-0x1, -0x58(%rbp)
je 0x3656
movl -0x58(%rbp), %eax
movl %eax, -0x29c(%rbp)
movl $0x0, -0x2a0(%rbp)
movl -0x29c(%rbp), %ecx
xorl %eax, %eax
cmpl -0x54(%rbp), %ecx
movb %al, -0x2c1(%rbp)
jge 0x352a
movl -0x2a0(%rbp), %eax
addl $0x3, %eax
cltq
cmpq $0x3f, %rax
setb %al
movb %al, -0x2c1(%rbp)
movb -0x2c1(%rbp), %al
testb $0x1, %al
jne 0x3539
jmp 0x3654
movq -0x10(%rbp), %rax
movslq -0x29c(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x2a8(%rbp)
movq -0x2a8(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x2daf(%rip), %rax      # 0x6310
cmpb $0x0, (%rax,%rcx)
je 0x3591
movq -0x2a8(%rbp), %rax
movb (%rax), %dl
movq -0x20(%rbp), %rax
movl -0x2a0(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x2a0(%rbp)
movslq %ecx, %rcx
movb %dl, 0x60(%rax,%rcx)
jmp 0x363e
movq -0x2a8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x20, %eax
jne 0x35bf
movq -0x20(%rbp), %rax
movl -0x2a0(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x2a0(%rbp)
movslq %ecx, %rcx
movb $0x2b, 0x60(%rax,%rcx)
jmp 0x363c
movq -0x20(%rbp), %rax
movl -0x2a0(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x2a0(%rbp)
movslq %ecx, %rcx
movb $0x25, 0x60(%rax,%rcx)
movq -0x2a8(%rbp), %rax
movsbl (%rax), %edi
sarl $0x4, %edi
callq 0x3850
movb %al, %dl
movq -0x20(%rbp), %rax
movl -0x2a0(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x2a0(%rbp)
movslq %ecx, %rcx
movb %dl, 0x60(%rax,%rcx)
movq -0x2a8(%rbp), %rax
movsbl (%rax), %edi
andl $0xf, %edi
callq 0x3850
movb %al, %dl
movq -0x20(%rbp), %rax
movl -0x2a0(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x2a0(%rbp)
movslq %ecx, %rcx
movb %dl, 0x60(%rax,%rcx)
jmp 0x363e
jmp 0x3640
movl -0x29c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x29c(%rbp)
jmp 0x34ff
jmp 0x365e
movq -0x20(%rbp), %rax
movb $0x2f, 0x60(%rax)
movl $0x1c, -0x40(%rbp)
cmpl $-0x1, -0x68(%rbp)
je 0x3772
movb $0x0, -0x290(%rbp)
leaq -0x290(%rbp), %rax
movq %rax, -0x2d8(%rbp)
movq -0x10(%rbp), %rax
movslq -0x68(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x2d0(%rbp)
movl -0x64(%rbp), %eax
subl -0x68(%rbp), %eax
movslq %eax, %rcx
movl $0x1ff, %eax            # imm = 0x1FF
cmpq %rcx, %rax
jae 0x36b7
movl $0x1ff, %eax            # imm = 0x1FF
movq %rax, -0x2e0(%rbp)
jmp 0x36c6
movl -0x64(%rbp), %eax
subl -0x68(%rbp), %eax
cltq
movq %rax, -0x2e0(%rbp)
movq -0x2d0(%rbp), %rsi
movq -0x2d8(%rbp), %rdi
movq -0x2e0(%rbp), %rdx
callq 0x2140
leaq -0x290(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x20b0
cmpl $0x0, %eax
jne 0x373b
movw -0x3c(%rbp), %cx
movq -0x20(%rbp), %rax
movw %cx, 0x44(%rax)
movzwl -0x3c(%rbp), %eax
cmpl $0xa, %eax
jne 0x3724
movq -0x20(%rbp), %rax
movq -0x34(%rbp), %rcx
movq %rcx, 0x4c(%rax)
movq -0x2c(%rbp), %rcx
movq %rcx, 0x54(%rax)
jmp 0x372e
movq -0x20(%rbp), %rax
movl -0x38(%rbp), %ecx
movl %ecx, 0x48(%rax)
movq -0x20(%rbp), %rax
movl $0x1, 0x40(%rax)
jmp 0x376d
movq 0x5896(%rip), %rax      # 0x8fd8
movq (%rax), %rdi
movq -0x10(%rbp), %rdx
leaq 0x2b12(%rip), %rsi      # 0x6262
movb $0x0, %al
callq 0x2320
movq -0x20(%rbp), %rdi
callq 0x2260
movq $0x0, -0x8(%rbp)
jmp 0x3836
jmp 0x3818
movl $0x1c, -0x40(%rbp)
movq -0x20(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x20b0
cmpl $0x0, %eax
jne 0x37d1
movw -0x3c(%rbp), %cx
movq -0x20(%rbp), %rax
movw %cx, 0x44(%rax)
movzwl -0x3c(%rbp), %eax
cmpl $0xa, %eax
jne 0x37ba
movq -0x20(%rbp), %rax
movq -0x34(%rbp), %rcx
movq %rcx, 0x4c(%rax)
movq -0x2c(%rbp), %rcx
movq %rcx, 0x54(%rax)
jmp 0x37c4
movq -0x20(%rbp), %rax
movl -0x38(%rbp), %ecx
movl %ecx, 0x48(%rax)
movq -0x20(%rbp), %rax
movl $0x1, 0x40(%rax)
jmp 0x3816
movq -0x20(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x90(%rip), %rsi        # 0x3870
callq 0x4e30
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0xa8(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0xa8(%rax)
jne 0x3814
movq -0x20(%rbp), %rdi
callq 0x2260
movq $0x0, -0x8(%rbp)
jmp 0x3836
jmp 0x3816
jmp 0x3818
movl -0x44(%rbp), %eax
movzwl %ax, %edi
callq 0x2040
movw %ax, %cx
movq -0x20(%rbp), %rax
movw %cx, 0x46(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x2e0, %rsp            # imm = 0x2E0
popq %rbp
retq
nopw %cs:(%rax,%rax)