#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 */
char *AdvanceToBlank(char *);
char *AdvanceToNonBlank(char *);
int /*<<< orphan*/ RecordNewCachedOaddrInfo(char *, char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
char *strstr(char *, char *);
void HandleNew(char *line) {
  char *ptr = strstr(line, "cachedRegBindings");
  char *endPtr;
  printf("%s\n", line);
  printf("** New cachedRegBindings:\n");
  if (ptr == NULL) {
    printf("** error could not find cachedRegBindings\n");
    exit(-1);
  }
  ptr = AdvanceToBlank(ptr);
  ptr = AdvanceToNonBlank(ptr);
  endPtr = AdvanceToBlank(ptr);
  RecordNewCachedOaddrInfo(ptr, endPtr);
}


x86 assembly (clang, -O0):
<HandleNew>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1080 <strstr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpq   $0x0,-0x10(%rbp)
jne    11c3 <HandleNew+0x63>
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rdi
call   1050 <AdvanceToBlank@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <AdvanceToNonBlank@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <AdvanceToBlank@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <RecordNewCachedOaddrInfo@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HandleNew>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xec4(%rip),%rsi
call   1080 <strstr@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe7b(%rip),%rdi
call   1030 <puts@plt>
test   %r14,%r14
je     11bc <HandleNew+0x5c>
mov    %r14,%rdi
call   1050 <AdvanceToBlank@plt>
mov    %rax,%rdi
call   1040 <AdvanceToNonBlank@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <AdvanceToBlank@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1070 <RecordNewCachedOaddrInfo@plt>
lea    0xe57(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"cachedRegBindings\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [27 x i8] c"** New cachedRegBindings:\0A\00"
@.str.3 = [43 x i8] c"** error could not find cachedRegBindings\0A\00"
define void @HandleNew(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @strstr(i8* %5, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i8* %6, i8** %3
%7 = load i8*, i8** %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%10 = load i8*, i8** %3
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @exit(i32 -1)
unreachable
15: ; preds = %1
%16 = load i8*, i8** %3
%17 = call i8* @AdvanceToBlank(i8* %16)
store i8* %17, i8** %3
%18 = load i8*, i8** %3
%19 = call i8* @AdvanceToNonBlank(i8* %18)
store i8* %19, i8** %3
%20 = load i8*, i8** %3
%21 = call i8* @AdvanceToBlank(i8* %20)
store i8* %21, i8** %4
%22 = load i8*, i8** %3
%23 = load i8*, i8** %4
%24 = call i32 @RecordNewCachedOaddrInfo(i8* %22, i8* %23)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"cachedRegBindings\00"
@str = [26 x i8] c"** New cachedRegBindings:\00"
@str.4 = [42 x i8] c"** error could not find cachedRegBindings\00"
define void @HandleNew(i8* %0) {
%2 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) %0)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%5 = icmp eq i8* %2, null
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.4, i64 0, i64 0))
%8 = tail call i32 @exit(i32 -1)
unreachable
9: ; preds = %1
%10 = tail call i8* @AdvanceToBlank(i8* %2)
%11 = tail call i8* @AdvanceToNonBlank(i8* %10)
%12 = tail call i8* @AdvanceToBlank(i8* %11)
%13 = tail call i32 @RecordNewCachedOaddrInfo(i8* %11, i8* %12)
ret void
}