#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*/ log_debug(char *);
int tokenize_read_delete(char **h_msg, char **h_file_name) {
  char *scanner, *msg;
  msg = *h_msg;
  log_debug("Tokenizing Add/Append command");
  scanner = msg;
  while (*scanner != ' ') {
    if (*scanner == '\0') {
      return 1;
    }
    scanner++;
  }
  if (*scanner == '\0') {
    return 1;
  }
  *scanner = '\0';
  scanner++;
  if (*scanner == '\0') {
    return 1;
  }
  log_debug("Successfully tokenized first part of message");
  log_debug(scanner);
  *h_file_name = scanner;
  return 0;
}


x86 assembly (clang, -O0):
<tokenize_read_delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
lea    0xece(%rip),%rdi
call   1030 <log_debug@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     117c <tokenize_read_delete+0x6c>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    116b <tokenize_read_delete+0x5b>
movl   $0x1,-0x4(%rbp)
jmp    11ee <tokenize_read_delete+0xde>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    113f <tokenize_read_delete+0x2f>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1198 <tokenize_read_delete+0x88>
movl   $0x1,-0x4(%rbp)
jmp    11ee <tokenize_read_delete+0xde>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11c7 <tokenize_read_delete+0xb7>
movl   $0x1,-0x4(%rbp)
jmp    11ee <tokenize_read_delete+0xde>
lea    0xe50(%rip),%rdi
call   1030 <log_debug@plt>
mov    -0x20(%rbp),%rdi
call   1030 <log_debug@plt>
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tokenize_read_delete>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    (%rdi),%rbx
lea    0xedf(%rip),%rdi
call   1030 <log_debug@plt>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rbx
movzbl -0x1(%rbx),%eax
test   %al,%al
je     1164 <tokenize_read_delete+0x54>
cmp    $0x20,%al
jne    1130 <tokenize_read_delete+0x20>
movb   $0x0,-0x1(%rbx)
cmpb   $0x0,(%rbx)
je     1164 <tokenize_read_delete+0x54>
lea    0xece(%rip),%rdi
call   1030 <log_debug@plt>
mov    %rbx,%rdi
call   1030 <log_debug@plt>
mov    %rbx,(%r14)
xor    %eax,%eax
jmp    1169 <tokenize_read_delete+0x59>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Tokenizing Add/Append command\00"
@.str.1 = [45 x i8] c"Successfully tokenized first part of message\00"
define i32 @tokenize_read_delete(i8** %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
store i8** %0, i8*** %4
store i8** %1, i8*** %5
%8 = load i8**, i8*** %4
%9 = load i8*, i8** %8
store i8* %9, i8** %7
%10 = call i32 @log_debug(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%11 = load i8*, i8** %7
store i8* %11, i8** %6
br label %12
12: ; preds = %23, %2
%13 = load i8*, i8** %6
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 32
br i1 %16, label %17, label %26
17: ; preds = %12
%18 = load i8*, i8** %6
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %17
store i32 1, i32* %3
br label %47
23: ; preds = %17
%24 = load i8*, i8** %6
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %6
br label %12
26: ; preds = %12
%27 = load i8*, i8** %6
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %26
store i32 1, i32* %3
br label %47
32: ; preds = %26
%33 = load i8*, i8** %6
store i8 0, i8* %33
%34 = load i8*, i8** %6
%35 = getelementptr inbounds i8, i8* %34, i32 1
store i8* %35, i8** %6
%36 = load i8*, i8** %6
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %41
40: ; preds = %32
store i32 1, i32* %3
br label %47
41: ; preds = %32
%42 = call i32 @log_debug(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%43 = load i8*, i8** %6
%44 = call i32 @log_debug(i8* %43)
%45 = load i8*, i8** %6
%46 = load i8**, i8*** %5
store i8* %45, i8** %46
store i32 0, i32* %3
br label %47
47: ; preds = %41, %40, %31, %22
%48 = load i32, i32* %3
ret i32 %48
}

LLVM IR (-O2):
@.str = [30 x i8] c"Tokenizing Add/Append command\00"
@.str.1 = [45 x i8] c"Successfully tokenized first part of message\00"
define i32 @tokenize_read_delete(i8** nocapture %0, i8** nocapture writeonly %1) {
%3 = load i8*, i8** %0
%4 = tail call i32 @log_debug(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %8, %2
%6 = phi i8* [ %3, %2 ], [ %9, %8 ]
%7 = load i8, i8* %6
switch i8 %7, label %8 [
i8 32, label %10
i8 0, label %17
]
8: ; preds = %5
%9 = getelementptr inbounds i8, i8* %6, i64 1
br label %5
10: ; preds = %5
store i8 0, i8* %6
%11 = getelementptr inbounds i8, i8* %6, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %10
%15 = tail call i32 @log_debug(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%16 = tail call i32 @log_debug(i8* %11)
store i8* %11, i8** %1
br label %17
17: ; preds = %5, %10, %14
%18 = phi i32 [ 0, %14 ], [ 1, %10 ], [ 1, %5 ]
ret i32 %18
}