#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*/ isalnum(char);
int /*<<< orphan*/ strlen(char const *);
char *strstr(char *, char const *);
char *nhr_response_find_http_field_value(char *received, const char *field) {
  char *sub = strstr(received, field);
  if (!sub) {
    return NULL;
  }
  sub += strlen(field);
  while (!isalnum(*sub)) {
    sub++;
  }
  return sub;
}


x86 assembly (clang, -O0):
<nhr_response_find_http_field_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <strstr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1169 <nhr_response_find_http_field_value+0x39>
movq   $0x0,-0x8(%rbp)
jmp    11bc <nhr_response_find_http_field_value+0x8c>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isalnum@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11a3 <nhr_response_find_http_field_value+0x73>
jmp    11b4 <nhr_response_find_http_field_value+0x84>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1182 <nhr_response_find_http_field_value+0x52>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nhr_response_find_http_field_value>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1050 <strstr@plt>
test   %rax,%rax
je     1173 <nhr_response_find_http_field_value+0x43>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
add    %rax,%rbx
add    $0xffffffffffffffff,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1040 <isalnum@plt>
test   %eax,%eax
je     1160 <nhr_response_find_http_field_value+0x30>
jmp    1175 <nhr_response_find_http_field_value+0x45>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @nhr_response_find_http_field_value(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = call i8* @strstr(i8* %7, i8* %8)
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = icmp ne i8* %10, null
br i1 %11, label %13, label %12
12: ; preds = %2
store i8* null, i8** %3
br label %30
13: ; preds = %2
%14 = load i8*, i8** %5
%15 = call i32 @strlen(i8* %14)
%16 = load i8*, i8** %6
%17 = sext i32 %15 to i64
%18 = getelementptr inbounds i8, i8* %16, i64 %17
store i8* %18, i8** %6
br label %19
19: ; preds = %25, %13
%20 = load i8*, i8** %6
%21 = load i8, i8* %20
%22 = call i32 @isalnum(i8 signext %21)
%23 = icmp ne i32 %22, 0
%24 = xor i1 %23, true
br i1 %24, label %25, label %28
25: ; preds = %19
%26 = load i8*, i8** %6
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %6
br label %19
28: ; preds = %19
%29 = load i8*, i8** %6
store i8* %29, i8** %3
br label %30
30: ; preds = %28, %12
%31 = load i8*, i8** %3
ret i8* %31
}

LLVM IR (-O2):
define i8* @nhr_response_find_http_field_value(i8* %0, i8* %1) {
%3 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %15, label %5
5: ; preds = %2
%6 = tail call i32 @strlen(i8* %1)
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %3, i64 %7
br label %9
9: ; preds = %9, %5
%10 = phi i8* [ %8, %5 ], [ %14, %9 ]
%11 = load i8, i8* %10
%12 = tail call i32 @isalnum(i8 signext %11)
%13 = icmp eq i32 %12, 0
%14 = getelementptr inbounds i8, i8* %10, i64 1
br i1 %13, label %9, label %15
15: ; preds = %9, %2
%16 = phi i8* [ null, %2 ], [ %10, %9 ]
ret i8* %16
}