#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*/ add_pre_buffer(char *, ...);
int /*<<< orphan*/ die(char *);
char **handle_switch_I(char *arg, char **next) {
  char *path = arg + 1;
  switch (arg[1]) {
  case '-':
    add_pre_buffer("#split_include\n");
    break;
  case '\0':
    path = *++next;
    if (!path)
      die("missing argument for -I option");
  default:
    add_pre_buffer("#add_include \"%s/\"\n", path);
  }
  return next;
}


x86 assembly (clang, -O0):
<handle_switch_I>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
mov    %eax,-0x1c(%rbp)
test   %eax,%eax
je     1178 <handle_switch_I+0x58>
jmp    1154 <handle_switch_I+0x34>
mov    -0x1c(%rbp),%eax
sub    $0x2d,%eax
jne    11ab <handle_switch_I+0x8b>
jmp    1165 <handle_switch_I+0x45>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <add_pre_buffer@plt>
jmp    11bd <handle_switch_I+0x9d>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11a6 <handle_switch_I+0x86>
lea    0xe6f(%rip),%rdi
call   1040 <die@plt>
jmp    11ab <handle_switch_I+0x8b>
mov    -0x18(%rbp),%rsi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <add_pre_buffer@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_switch_I>:
push   %rbx
mov    %rsi,%rbx
movsbl 0x1(%rdi),%eax
test   %eax,%eax
je     1141 <handle_switch_I+0x21>
cmp    $0x2d,%eax
jne    115e <handle_switch_I+0x3e>
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <add_pre_buffer@plt>
jmp    1173 <handle_switch_I+0x53>
mov    0x8(%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1165 <handle_switch_I+0x45>
lea    0xebb(%rip),%rdi
call   1040 <die@plt>
xor    %esi,%esi
jmp    1165 <handle_switch_I+0x45>
mov    %rdi,%rsi
add    $0x1,%rsi
lea    0xec3(%rip),%rdi
xor    %eax,%eax
call   1030 <add_pre_buffer@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"#split_include\0A\00"
@.str.1 = [31 x i8] c"missing argument for -I option\00"
@.str.2 = [20 x i8] c"#add_include \22%s/\22\0A\00"
define i8** @handle_switch_I(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
%5 = alloca i8*
store i8* %0, i8** %3
store i8** %1, i8*** %4
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 1
store i8* %7, i8** %5
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
switch i32 %11, label %23 [
i32 45, label %12
i32 0, label %14
]
12: ; preds = %2
%13 = call i32 (i8*, ...) @add_pre_buffer(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %26
14: ; preds = %2
%15 = load i8**, i8*** %4
%16 = getelementptr inbounds i8*, i8** %15, i32 1
store i8** %16, i8*** %4
%17 = load i8*, i8** %16
store i8* %17, i8** %5
%18 = load i8*, i8** %5
%19 = icmp ne i8* %18, null
br i1 %19, label %22, label %20
20: ; preds = %14
%21 = call i32 @die(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %20, %14
br label %23
23: ; preds = %2, %22
%24 = load i8*, i8** %5
%25 = call i32 (i8*, ...) @add_pre_buffer(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %24)
br label %26
26: ; preds = %23, %12
%27 = load i8**, i8*** %4
ret i8** %27
}

LLVM IR (-O2):
@.str = [16 x i8] c"#split_include\0A\00"
@.str.1 = [31 x i8] c"missing argument for -I option\00"
@.str.2 = [20 x i8] c"#add_include \22%s/\22\0A\00"
define i8** @handle_switch_I(i8* %0, i8** %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 1
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %14 [
i32 45, label %6
i32 0, label %8
]
6: ; preds = %2
%7 = tail call i32 (i8*, ...) @add_pre_buffer(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %18
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = tail call i32 @die(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %8, %12, %2
%15 = phi i8** [ %1, %2 ], [ %9, %8 ], [ %9, %12 ]
%16 = phi i8* [ %3, %2 ], [ %10, %8 ], [ null, %12 ]
%17 = tail call i32 (i8*, ...) @add_pre_buffer(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %14, %6
%19 = phi i8** [ %15, %14 ], [ %1, %6 ]
ret i8** %19
}