#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 *, ...);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ stderr;
char *strdup(char const *);
char *strsep(char **, char *);
void print_argify(const char *args) {
  char *name;
  char *str, *ptr;
  str = ptr = strdup(args);
  while ((name = strsep(&str, ","))) {
    fprintf(stderr, " <%s>", name);
  }
  fprintf(stderr, "\n");
  if (ptr != NULL) {
    free(ptr);
  }
}


x86 assembly (clang, -O0):
<print_argify>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <strdup@plt>
mov    %rax,-0x20(%rbp)
mov    %rax,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
lea    0xe98(%rip),%rsi
call   1050 <strsep@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     119b <print_argify+0x5b>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe73(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    115d <print_argify+0x1d>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
lea    0xe5d(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
cmpq   $0x0,-0x20(%rbp)
je     11c6 <print_argify+0x86>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_argify>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
call   1060 <strdup@plt>
mov    %rax,%r14
mov    %rax,0x8(%rsp)
lea    0xe9f(%rip),%rsi
lea    0x8(%rsp),%rdi
call   1050 <strsep@plt>
test   %rax,%rax
je     11b1 <print_argify+0x71>
mov    0x2e69(%rip),%r13
lea    0xe84(%rip),%r15
lea    0xe7b(%rip),%r12
lea    0x8(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13),%edi
mov    %r15,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <strsep@plt>
test   %rax,%rax
jne    1190 <print_argify+0x50>
mov    0x2e28(%rip),%rax
mov    (%rax),%edi
lea    0xe47(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %r14,%r14
je     11d5 <print_argify+0x95>
mov    %r14,%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c",\00"
@stderr = global i32 0
@.str.1 = [6 x i8] c" <%s>\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @print_argify(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i8* @strdup(i8* %6)
store i8* %7, i8** %5
store i8* %7, i8** %4
br label %8
8: ; preds = %11, %1
%9 = call i8* @strsep(i8** %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %9, i8** %3
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %3
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %13)
br label %8
15: ; preds = %8
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%18 = load i8*, i8** %5
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %23
20: ; preds = %15
%21 = load i8*, i8** %5
%22 = call i32 @free(i8* %21)
br label %23
23: ; preds = %20, %15
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c",\00"
@stderr = global i32 0
@.str.1 = [6 x i8] c" <%s>\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @print_argify(i8* nocapture %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = tail call i8* @strdup(i8* %0)
store i8* %4, i8** %2
%5 = call i8* @strsep(i8** %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i8* %5, null
br i1 %6, label %13, label %7
7: ; preds = %1, %7
%8 = phi i8* [ %11, %7 ], [ %5, %1 ]
%9 = load i32, i32* @stderr
%10 = call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%11 = call i8* @strsep(i8** %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %7
13: ; preds = %7, %1
%14 = load i32, i32* @stderr
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i8* %4, null
br i1 %16, label %19, label %17
17: ; preds = %13
%18 = call i32 @free(i8* %4)
br label %19
19: ; preds = %17, %13
ret void
}