#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*/ column_format(int /*<<< orphan*/, int /*<<< orphan*/);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char const *);
int /*<<< orphan*/ strdup(char *);
int /*<<< orphan*/ strlen(char const *);
int /*<<< orphan*/ warnx(char *, char *);
void set_column_format(const char arg[]) {
  char input[1 + strlen(arg)];
  strcpy(input, arg);
  char *p = strchr(input, ',');
  if (!p) {
    warnx("could not parse format argument '%s'", input);
    return;
  }
  *p = '\0';
  column_format(strdup(input), strdup(++p));
}


x86 assembly (clang, -O0):
<set_column_format>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x30(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x30(%rbp),%rdi
mov    $0x2c,%esi
call   1060 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11dd <set_column_format+0x7d>
mov    -0x30(%rbp),%rsi
lea    0xe34(%rip),%rdi
call   1070 <warnx@plt>
movl   $0x1,-0x24(%rbp)
jmp    1212 <set_column_format+0xb2>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
call   1080 <strdup@plt>
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rdi
add    $0x1,%rdi
mov    %rdi,-0x20(%rbp)
call   1080 <strdup@plt>
mov    -0x34(%rbp),%edi
mov    %eax,%esi
call   1050 <column_format@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_column_format>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    $0x2c,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     11c7 <set_column_format+0x67>
mov    %rax,%r14
movb   $0x0,(%rax)
mov    %rbx,%rdi
call   1080 <strdup@plt>
mov    %eax,%ebx
add    $0x1,%r14
mov    %r14,%rdi
call   1080 <strdup@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1050 <column_format@plt>
jmp    11d6 <set_column_format+0x76>
lea    0xe32(%rip),%rdi
mov    %rbx,%rsi
call   1070 <warnx@plt>
lea    -0x10(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [37 x i8] c"could not parse format argument '%s'\00"
define void @set_column_format(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = call i32 @strlen(i8* %7)
%9 = add nsw i32 1, %8
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %3
%12 = alloca i8, i64 %10
store i64 %10, i64* %4
%13 = load i8*, i8** %2
%14 = call i32 @strcpy(i8* %12, i8* %13)
%15 = call i8* @strchr(i8* %12, i8 signext 44)
store i8* %15, i8** %5
%16 = load i8*, i8** %5
%17 = icmp ne i8* %16, null
br i1 %17, label %20, label %18
18: ; preds = %1
%19 = call i32 @warnx(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %12)
store i32 1, i32* %6
br label %27
20: ; preds = %1
%21 = load i8*, i8** %5
store i8 0, i8* %21
%22 = call i32 @strdup(i8* %12)
%23 = load i8*, i8** %5
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %5
%25 = call i32 @strdup(i8* %24)
%26 = call i32 @column_format(i32 %22, i32 %25)
store i32 0, i32* %6
br label %27
27: ; preds = %20, %18
%28 = load i8*, i8** %3
%29 = load i32, i32* %6
switch i32 %29, label %31 [
i32 0, label %30
i32 1, label %30
]
30: ; preds = %27, %27
ret void
31: ; preds = %27
unreachable
}

LLVM IR (-O2):
@.str = [37 x i8] c"could not parse format argument '%s'\00"
define void @set_column_format(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
%6 = call i32 @strcpy(i8* %5, i8* %0)
%7 = call i8* @strchr(i8* %5, i8 signext 44)
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @warnx(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %16
11: ; preds = %1
store i8 0, i8* %7
%12 = call i32 @strdup(i8* %5)
%13 = getelementptr inbounds i8, i8* %7, i64 1
%14 = call i32 @strdup(i8* %13)
%15 = call i32 @column_format(i32 %12, i32 %14)
br label %16
16: ; preds = %11, %9
ret void
}