#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*/ sscanf(char *, char const *, void *);
scalar_t__ strlen(char const *);
scalar_t__ strstr(char const *, char *);
void cr_parseinfo(const char *info, const char *fld, const char *format,
                  void *storage) {
  if (info) {
    char *str = (char *)strstr(info, (char *)fld);
    if (str) {
      str += strlen(fld) + 1;
      sscanf(str, format, storage);
    }
  }
}


x86 assembly (clang, -O0):
<cr_parseinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     119a <cr_parseinfo+0x6a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strstr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1195 <cr_parseinfo+0x65>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%rax
add    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <sscanf@plt>
jmp    119a <cr_parseinfo+0x6a>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cr_parseinfo>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rdi,%rdi
je     1179 <cr_parseinfo+0x49>
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
call   1050 <strstr@plt>
test   %rax,%rax
je     1179 <cr_parseinfo+0x49>
mov    %rax,%r12
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    (%rax,%r12,1),%rdi
add    $0x1,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <sscanf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @cr_parseinfo(i8* %0, i8* %1, i8* nocapture %2, i8* %3) {
%5 = icmp eq i8* %0, null
br i1 %5, label %15, label %6
6: ; preds = %4
%7 = tail call i64 @strstr(i8* %0, i8* %1)
%8 = icmp eq i64 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %6
%10 = inttoptr i64 %7 to i8*
%11 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%12 = add nsw i64 %11, 1
%13 = getelementptr inbounds i8, i8* %10, i64 %12
%14 = tail call i32 @sscanf(i8* %13, i8* %2, i8* %3)
br label %15
15: ; preds = %6, %9, %4
ret void
}