#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*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
int strlen(char *);
char *check_call_string(char *callback, const char *name) {
  char *tmp_ptr = callback;
  if (strlen(callback) > 256) {
    fprintf(stderr, "ERROR nmon: ignoring %s - too long\n", name);
    return (char *)NULL;
  }
  for (; *tmp_ptr != '\0' && *tmp_ptr != ' ' && *tmp_ptr != '&'; ++tmp_ptr)
    ;
  *tmp_ptr = '\0';
  if (tmp_ptr == callback)
    return (char *)NULL;
  else
    return callback;
}


x86 assembly (clang, -O0):
<check_call_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x100,%eax
jle    1172 <check_call_string+0x52>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xea0(%rip),%rsi
call   1040 <fprintf@plt>
movq   $0x0,-0x8(%rbp)
jmp    1201 <check_call_string+0xe1>
jmp    1177 <check_call_string+0x57>
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x21(%rbp)
je     11b1 <check_call_string+0x91>
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x21(%rbp)
je     11b1 <check_call_string+0x91>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x26,%eax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    11c1 <check_call_string+0xa1>
jmp    11d7 <check_call_string+0xb7>
jmp    11c6 <check_call_string+0xa6>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1177 <check_call_string+0x57>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    11f9 <check_call_string+0xd9>
movq   $0x0,-0x8(%rbp)
jmp    1201 <check_call_string+0xe1>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_call_string>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    $0x100,%eax
jle    1152 <check_call_string+0x32>
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
lea    0xeba(%rip),%rsi
mov    %r14,%rdx
call   1040 <fprintf@plt>
xor    %ebx,%ebx
jmp    117f <check_call_string+0x5f>
xor    %eax,%eax
movabs $0x4100000001,%rcx
jmp    1164 <check_call_string+0x44>
add    $0x1,%rax
movzbl (%rbx,%rax,1),%edx
cmp    $0x26,%rdx
ja     1160 <check_call_string+0x40>
bt     %rdx,%rcx
jae    1160 <check_call_string+0x40>
movb   $0x0,(%rbx,%rax,1)
test   %rax,%rax
cmove  %rax,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [36 x i8] c"ERROR nmon: ignoring %s - too long\0A\00"
define i8* @check_call_string(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
store i8* %7, i8** %6
%8 = load i8*, i8** %4
%9 = call i32 @strlen(i8* %8)
%10 = icmp sgt i32 %9, 256
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %5
%14 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %13)
store i8* null, i8** %3
br label %45
15: ; preds = %2
br label %16
16: ; preds = %34, %15
%17 = load i8*, i8** %6
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %31
21: ; preds = %16
%22 = load i8*, i8** %6
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 32
br i1 %25, label %26, label %31
26: ; preds = %21
%27 = load i8*, i8** %6
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %29, 38
br label %31
31: ; preds = %26, %21, %16
%32 = phi i1 [ false, %21 ], [ false, %16 ], [ %30, %26 ]
br i1 %32, label %33, label %37
33: ; preds = %31
br label %34
34: ; preds = %33
%35 = load i8*, i8** %6
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %6
br label %16
37: ; preds = %31
%38 = load i8*, i8** %6
store i8 0, i8* %38
%39 = load i8*, i8** %6
%40 = load i8*, i8** %4
%41 = icmp eq i8* %39, %40
br i1 %41, label %42, label %43
42: ; preds = %37
store i8* null, i8** %3
br label %45
43: ; preds = %37
%44 = load i8*, i8** %4
store i8* %44, i8** %3
br label %45
45: ; preds = %43, %42, %11
%46 = load i8*, i8** %3
ret i8* %46
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [36 x i8] c"ERROR nmon: ignoring %s - too long\0A\00"
define i8* @check_call_string(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = icmp sgt i32 %3, 256
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %16
8: ; preds = %2, %11
%9 = phi i8* [ %12, %11 ], [ %0, %2 ]
%10 = load i8, i8* %9
switch i8 %10, label %11 [
i8 0, label %13
i8 32, label %13
i8 38, label %13
]
11: ; preds = %8
%12 = getelementptr inbounds i8, i8* %9, i64 1
br label %8
13: ; preds = %8, %8, %8
store i8 0, i8* %9
%14 = icmp eq i8* %9, %0
%15 = select i1 %14, i8* null, i8* %0
br label %16
16: ; preds = %13, %5
%17 = phi i8* [ null, %5 ], [ %15, %13 ]
ret i8* %17
}