#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*/ internal_error(char *, char *);
int /*<<< orphan*/ isspace(char);
char *string_copy(char *);
char *strtok(int /*<<< orphan*/ *, char *);
char *create_help_msg(char *s) {
  if (*s != '|')
    internal_error("| help msg expected: %s", s);
  s = strtok(NULL, "\"");
  if (s != NULL && !isspace(*s))
    internal_error("| help msg expected: %s", s);
  s = strtok(NULL, "\"");
  if (s == NULL)
    return NULL;
  else
    return string_copy(s);
}


x86 assembly (clang, -O0):
<create_help_msg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7c,%eax
je     116c <create_help_msg+0x2c>
mov    -0x10(%rbp),%rsi
lea    0xe99(%rip),%rdi
call   1040 <internal_error@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xea1(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11b0 <create_help_msg+0x70>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
jne    11b0 <create_help_msg+0x70>
mov    -0x10(%rbp),%rsi
lea    0xe55(%rip),%rdi
call   1040 <internal_error@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe5d(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11dc <create_help_msg+0x9c>
movq   $0x0,-0x8(%rbp)
jmp    11e9 <create_help_msg+0xa9>
mov    -0x10(%rbp),%rdi
call   1060 <string_copy@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_help_msg>:
push   %rbx
cmpb   $0x7c,(%rdi)
je     1155 <create_help_msg+0x15>
mov    %rdi,%rsi
lea    0xeb0(%rip),%rdi
call   1040 <internal_error@plt>
lea    0xebc(%rip),%rsi
xor    %edi,%edi
call   1050 <strtok@plt>
test   %rax,%rax
je     1186 <create_help_msg+0x46>
mov    %rax,%rbx
movsbl (%rax),%edi
call   1030 <isspace@plt>
test   %eax,%eax
jne    1186 <create_help_msg+0x46>
lea    0xe82(%rip),%rdi
mov    %rbx,%rsi
call   1040 <internal_error@plt>
lea    0xe8b(%rip),%rsi
xor    %edi,%edi
call   1050 <strtok@plt>
test   %rax,%rax
je     11a2 <create_help_msg+0x62>
mov    %rax,%rdi
pop    %rbx
jmp    1060 <string_copy@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"| help msg expected: %s\00"
@.str.1 = [2 x i8] c"\22\00"
define i8* @create_help_msg(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 124
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i32 @internal_error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %11
11: ; preds = %8, %1
%12 = call i8* @strtok(i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %12, i8** %3
%13 = load i8*, i8** %3
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %23
15: ; preds = %11
%16 = load i8*, i8** %3
%17 = load i8, i8* %16
%18 = call i32 @isspace(i8 signext %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %15
%21 = load i8*, i8** %3
%22 = call i32 @internal_error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %20, %15, %11
%24 = call i8* @strtok(i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %24, i8** %3
%25 = load i8*, i8** %3
%26 = icmp eq i8* %25, null
br i1 %26, label %27, label %28
27: ; preds = %23
store i8* null, i8** %2
br label %31
28: ; preds = %23
%29 = load i8*, i8** %3
%30 = call i8* @string_copy(i8* %29)
store i8* %30, i8** %2
br label %31
31: ; preds = %28, %27
%32 = load i8*, i8** %2
ret i8* %32
}

LLVM IR (-O2):
@.str = [24 x i8] c"| help msg expected: %s\00"
@.str.1 = [2 x i8] c"\22\00"
define i8* @create_help_msg(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 124
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @internal_error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %6
6: ; preds = %4, %1
%7 = tail call i8* @strtok(i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i8* %7, null
br i1 %8, label %15, label %9
9: ; preds = %6
%10 = load i8, i8* %7
%11 = tail call i32 @isspace(i8 signext %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = tail call i32 @internal_error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %15
15: ; preds = %13, %9, %6
%16 = tail call i8* @strtok(i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i8* %16, null
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = tail call i8* @string_copy(i8* %16)
br label %20
20: ; preds = %15, %18
%21 = phi i8* [ %19, %18 ], [ null, %15 ]
ret i8* %21
}