#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*/ output_prog_name(char *);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ puts(char *);
int smartsplit(char *, char *, char **);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ usage(char *);
int main(int argc, char *argv[]) {
  int retval;
  retval = 0;
  switch (argc) {
  case 2: {
    int success;
    char ifs;
    char *str;
    success = smartsplit(argv[1], &ifs, &str);
    if (success)
      puts(str);
    else {
      output_prog_name(argv[0]);
      fprintf(stderr, ": all separators used\n");
      retval = 1;
    }
  } break;
  case 3:
    if (strcmp(argv[1], "-ifs") == 0) {
      char ifs;
      smartsplit(argv[2], &ifs, 0);
      putchar(ifs);
    } else {
      usage(argv[0]);
      retval = 1;
    }
    break;
  default:
    usage(argv[0]);
    retval = 2;
    break;
  }
  return retval;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x30(%rbp)
sub    $0x2,%eax
je     11b2 <main+0x42>
jmp    11a1 <main+0x31>
mov    -0x30(%rbp),%eax
sub    $0x3,%eax
je     120f <main+0x9f>
jmp    1267 <main+0xf7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x19(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1080 <smartsplit@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     11e2 <main+0x72>
mov    -0x28(%rbp),%rdi
call   1040 <puts@plt>
jmp    120a <main+0x9a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <output_prog_name@plt>
mov    0x2deb(%rip),%rax
mov    (%rax),%edi
lea    0xe02(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0x1,-0x14(%rbp)
jmp    127a <main+0x10a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdf9(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    124f <main+0xdf>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    -0x29(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1080 <smartsplit@plt>
movsbl -0x29(%rbp),%edi
call   1030 <putchar@plt>
jmp    1262 <main+0xf2>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <usage@plt>
movl   $0x1,-0x14(%rbp)
jmp    127a <main+0x10a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <usage@plt>
movl   $0x2,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
je     11a7 <main+0x37>
cmp    $0x2,%edi
jne    11ca <main+0x5a>
mov    0x8(%rbx),%rdi
lea    0x7(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1080 <smartsplit@plt>
test   %eax,%eax
je     11d9 <main+0x69>
mov    0x8(%rsp),%rdi
call   1040 <puts@plt>
xor    %ebx,%ebx
jmp    1219 <main+0xa9>
mov    0x8(%rbx),%rdi
lea    0xe65(%rip),%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11fd <main+0x8d>
mov    (%rbx),%rdi
call   1090 <usage@plt>
mov    $0x1,%ebx
jmp    1219 <main+0xa9>
mov    (%rbx),%rdi
call   1090 <usage@plt>
mov    $0x2,%ebx
jmp    1219 <main+0xa9>
mov    (%rbx),%rdi
call   1070 <output_prog_name@plt>
mov    0x2df8(%rip),%rax
mov    (%rax),%edi
lea    0xe0f(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%ebx
jmp    1219 <main+0xa9>
mov    0x10(%rbx),%rdi
xor    %ebx,%ebx
lea    0x6(%rsp),%rsi
xor    %edx,%edx
call   1080 <smartsplit@plt>
movsbl 0x6(%rsp),%edi
call   1030 <putchar@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c": all separators used\0A\00"
@.str.1 = [5 x i8] c"-ifs\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
%9 = alloca i8*
%10 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%11 = load i32, i32* %4
switch i32 %11, label %49 [
i32 2, label %12
i32 3, label %30
]
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @smartsplit(i8* %15, i8* %8, i8** %9)
store i32 %16, i32* %7
%17 = load i32, i32* %7
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %12
%20 = load i8*, i8** %9
%21 = call i32 @puts(i8* %20)
br label %29
22: ; preds = %12
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = call i32 @output_prog_name(i8* %25)
%27 = load i32, i32* @stderr
%28 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %6
br label %29
29: ; preds = %22, %19
br label %54
30: ; preds = %2
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32 @strcmp(i8* %33, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %43
36: ; preds = %30
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 2
%39 = load i8*, i8** %38
%40 = call i32 @smartsplit(i8* %39, i8* %10, i8** null)
%41 = load i8, i8* %10
%42 = call i32 @putchar(i8 signext %41)
br label %48
43: ; preds = %30
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 0
%46 = load i8*, i8** %45
%47 = call i32 @usage(i8* %46)
store i32 1, i32* %6
br label %48
48: ; preds = %43, %36
br label %54
49: ; preds = %2
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 0
%52 = load i8*, i8** %51
%53 = call i32 @usage(i8* %52)
store i32 2, i32* %6
br label %54
54: ; preds = %49, %48, %29
%55 = load i32, i32* %6
ret i32 %55
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c": all separators used\0A\00"
@.str.1 = [5 x i8] c"-ifs\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8
%4 = alloca i8*
%5 = alloca i8
switch i32 %0, label %36 [
i32 2, label %6
i32 3, label %22
]
6: ; preds = %2
%7 = bitcast i8** %4 to i8*
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = call i32 @smartsplit(i8* %9, i8* %3, i8** %4)
%11 = icmp eq i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %6
%13 = load i8*, i8** %4
%14 = call i32 @puts(i8* dereferenceable(1) %13)
br label %20
15: ; preds = %6
%16 = load i8*, i8** %1
%17 = call i32 @output_prog_name(i8* %16)
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %15, %12
%21 = phi i32 [ 0, %12 ], [ 1, %15 ]
br label %39
22: ; preds = %2
%23 = getelementptr inbounds i8*, i8** %1, i64 1
%24 = load i8*, i8** %23
%25 = tail call i32 @strcmp(i8* dereferenceable(1) %24, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %33
27: ; preds = %22
%28 = getelementptr inbounds i8*, i8** %1, i64 2
%29 = load i8*, i8** %28
%30 = call i32 @smartsplit(i8* %29, i8* %5, i8** null)
%31 = load i8, i8* %5
%32 = call i32 @putchar(i8 signext %31)
br label %39
33: ; preds = %22
%34 = load i8*, i8** %1
%35 = tail call i32 @usage(i8* %34)
br label %39
36: ; preds = %2
%37 = load i8*, i8** %1
%38 = tail call i32 @usage(i8* %37)
br label %39
39: ; preds = %27, %33, %36, %20
%40 = phi i32 [ 2, %36 ], [ 0, %27 ], [ 1, %33 ], [ %21, %20 ]
ret i32 %40
}