#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ get_line(char *, int /*<<< orphan*/);
int /*<<< orphan*/ local_double_quote_comma_delimited(char *, char);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int main(int argc, char **argv) {
  char buffer[65536];
  char delimiter;
  if (argc < 2) {
    fprintf(stderr, "Usage: %s delimiter [string]\n", argv[0]);
    exit(1);
  }
  delimiter = *argv[1];
  if (argc == 3) {
    local_double_quote_comma_delimited(argv[2], delimiter);
  } else {
    while (get_line(buffer, stdin))
      local_double_quote_comma_delimited(buffer, delimiter);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10020,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1189 <main+0x49>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe86(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%al
mov    %al,-0x10011(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    11bc <main+0x7c>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
movsbl -0x10011(%rbp),%esi
call   1040 <local_double_quote_comma_delimited@plt>
jmp    11fd <main+0xbd>
jmp    11c1 <main+0x81>
lea    -0x10010(%rbp),%rdi
mov    0x2e19(%rip),%rax
mov    (%rax),%esi
call   1030 <get_line@plt>
cmp    $0x0,%rax
je     11f8 <main+0xb8>
lea    -0x10010(%rbp),%rdi
movsbl -0x10011(%rbp),%esi
call   1040 <local_double_quote_comma_delimited@plt>
jmp    11c1 <main+0x81>
jmp    11fd <main+0xbd>
xor    %eax,%eax
add    $0x10020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10000,%rsp
cmp    $0x1,%edi
jle    11b8 <main+0x78>
mov    0x8(%rsi),%rax
mov    (%rax),%bl
cmp    $0x3,%edi
jne    1169 <main+0x29>
mov    0x10(%rsi),%rdi
movsbl %bl,%esi
call   1040 <local_double_quote_comma_delimited@plt>
jmp    11aa <main+0x6a>
mov    0x2e78(%rip),%r14
mov    (%r14),%esi
mov    %rsp,%rdi
call   1030 <get_line@plt>
test   %rax,%rax
je     11aa <main+0x6a>
movsbl %bl,%ebp
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %ebp,%esi
call   1040 <local_double_quote_comma_delimited@plt>
mov    (%r14),%esi
mov    %rbx,%rdi
call   1030 <get_line@plt>
test   %rax,%rax
jne    1190 <main+0x50>
xor    %eax,%eax
add    $0x10000,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2e19(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe35(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c"Usage: %s delimiter [string]\0A\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [65536 x i8]
%7 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %17
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = load i8, i8* %20
store i8 %21, i8* %7
%22 = load i32, i32* %4
%23 = icmp eq i32 %22, 3
br i1 %23, label %24, label %30
24: ; preds = %17
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = load i8, i8* %7
%29 = call i32 @local_double_quote_comma_delimited(i8* %27, i8 signext %28)
br label %41
30: ; preds = %17
br label %31
31: ; preds = %36, %30
%32 = getelementptr inbounds [65536 x i8], [65536 x i8]* %6, i64 0, i64 0
%33 = load i32, i32* @stdin
%34 = call i64 @get_line(i8* %32, i32 %33)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %40
36: ; preds = %31
%37 = getelementptr inbounds [65536 x i8], [65536 x i8]* %6, i64 0, i64 0
%38 = load i8, i8* %7
%39 = call i32 @local_double_quote_comma_delimited(i8* %37, i8 signext %38)
br label %31
40: ; preds = %31
br label %41
41: ; preds = %40, %24
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"Usage: %s delimiter [string]\0A\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [65536 x i8]
%4 = getelementptr inbounds [65536 x i8], [65536 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = load i8, i8* %13
%15 = icmp eq i32 %0, 3
br i1 %15, label %20, label %16
16: ; preds = %11
%17 = load i32, i32* @stdin
%18 = call i64 @get_line(i8* %4, i32 %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %29, label %24
20: ; preds = %11
%21 = getelementptr inbounds i8*, i8** %1, i64 2
%22 = load i8*, i8** %21
%23 = tail call i32 @local_double_quote_comma_delimited(i8* %22, i8 signext %14)
br label %29
24: ; preds = %16, %24
%25 = call i32 @local_double_quote_comma_delimited(i8* %4, i8 signext %14)
%26 = load i32, i32* @stdin
%27 = call i64 @get_line(i8* %4, i32 %26)
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %24
29: ; preds = %24, %16, %20
ret i32 0
}