#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*/ cerr(char *);
char *get_word(char **k) {
  char *c = *k;
  char *d = c;
  if (!c)
    cerr("Argument expected");
  while (*c && *c != ',')
    c++;
  if (!*c)
    c = ((void *)0);
  else
    *c++ = 0;
  *k = c;
  return d;
}


x86 assembly (clang, -O0):
<get_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1146 <get_word+0x36>
lea    0xebf(%rip),%rdi
call   1030 <cerr@plt>
jmp    114b <get_word+0x3b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     1170 <get_word+0x60>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2c,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1180 <get_word+0x70>
jmp    1191 <get_word+0x81>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    114b <get_word+0x3b>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    11ab <get_word+0x9b>
movq   $0x0,-0x10(%rbp)
jmp    11bd <get_word+0xad>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_word>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rbx
test   %rbx,%rbx
jne    112b <get_word+0x1b>
lea    0xeda(%rip),%rdi
call   1030 <cerr@plt>
lea    0x1(%rbx),%rax
nop
movzbl -0x1(%rax),%ecx
test   %cl,%cl
je     1143 <get_word+0x33>
cmp    $0x2c,%cl
je     1147 <get_word+0x37>
add    $0x1,%rax
jmp    1130 <get_word+0x20>
xor    %eax,%eax
jmp    114b <get_word+0x3b>
movb   $0x0,-0x1(%rax)
mov    %rax,(%r14)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Argument expected\00"
define i8* @get_word(i8** %0) {
%2 = alloca i8**
%3 = alloca i8*
%4 = alloca i8*
store i8** %0, i8*** %2
%5 = load i8**, i8*** %2
%6 = load i8*, i8** %5
store i8* %6, i8** %3
%7 = load i8*, i8** %3
store i8* %7, i8** %4
%8 = load i8*, i8** %3
%9 = icmp ne i8* %8, null
br i1 %9, label %12, label %10
10: ; preds = %1
%11 = call i32 @cerr(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %1
br label %13
13: ; preds = %25, %12
%14 = load i8*, i8** %3
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %13
%19 = load i8*, i8** %3
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 44
br label %23
23: ; preds = %18, %13
%24 = phi i1 [ false, %13 ], [ %22, %18 ]
br i1 %24, label %25, label %28
25: ; preds = %23
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %3
br label %13
28: ; preds = %23
%29 = load i8*, i8** %3
%30 = load i8, i8* %29
%31 = icmp ne i8 %30, 0
br i1 %31, label %33, label %32
32: ; preds = %28
store i8* null, i8** %3
br label %36
33: ; preds = %28
%34 = load i8*, i8** %3
%35 = getelementptr inbounds i8, i8* %34, i32 1
store i8* %35, i8** %3
store i8 0, i8* %34
br label %36
36: ; preds = %33, %32
%37 = load i8*, i8** %3
%38 = load i8**, i8*** %2
store i8* %37, i8** %38
%39 = load i8*, i8** %4
ret i8* %39
}

LLVM IR (-O2):
@.str = [18 x i8] c"Argument expected\00"
define i8* @get_word(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @cerr(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
br label %7
7: ; preds = %6, %10
%8 = phi i8* [ %11, %10 ], [ %2, %6 ]
%9 = load i8, i8* %8
switch i8 %9, label %10 [
i8 0, label %14
i8 44, label %12
]
10: ; preds = %7
%11 = getelementptr inbounds i8, i8* %8, i64 1
br label %7
12: ; preds = %7
%13 = getelementptr inbounds i8, i8* %8, i64 1
store i8 0, i8* %8
br label %14
14: ; preds = %7, %12
%15 = phi i8* [ %13, %12 ], [ null, %7 ]
store i8* %15, i8** %0
ret i8* %2
}