#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*/ strcat(char *, char const *);
int /*<<< orphan*/ strcpy(char *, char *);
void get_include_flags(char *dst, int argc, char *argv[]) {
  const char *cutest_path = argv[4];
  int i;
  strcpy(dst, "-I\"");
  strcat(dst, cutest_path);
  strcat(dst, "\"");
  if (argc > 5) {
    strcat(dst, " ");
  }
  for (i = 5; i < argc; i++) {
    strcat(dst, argv[i]);
    if (i < argc - 1) {
      strcat(dst, " ");
    }
  }
}


x86 assembly (clang, -O0):
<get_include_flags>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x20(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb6(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1040 <strcat@plt>
cmpl   $0x5,-0xc(%rbp)
jle    1186 <get_include_flags+0x66>
mov    -0x8(%rbp),%rdi
lea    0xe83(%rip),%rsi
call   1040 <strcat@plt>
movl   $0x5,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11e2 <get_include_flags+0xc2>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <strcat@plt>
mov    -0x24(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11cf <get_include_flags+0xaf>
mov    -0x8(%rbp),%rdi
lea    0xe3a(%rip),%rsi
call   1040 <strcat@plt>
jmp    11d4 <get_include_flags+0xb4>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    118d <get_include_flags+0x6d>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_include_flags>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%r12d
mov    %rdi,%rbx
mov    0x20(%rdx),%r15
lea    0xec1(%rip),%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcat@plt>
lea    0xeac(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
cmp    $0x6,%r12d
jl     11b7 <get_include_flags+0x97>
lea    0xe99(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcat@plt>
lea    -0x1(%r12),%r13d
mov    %r12d,%r12d
mov    $0x5,%ebp
jmp    1199 <get_include_flags+0x79>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rbp
cmp    %rbp,%r12
je     11b7 <get_include_flags+0x97>
mov    (%r14,%rbp,8),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
cmp    %r13,%rbp
jae    1190 <get_include_flags+0x70>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcat@plt>
jmp    1190 <get_include_flags+0x70>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"-I\22\00"
@.str.1 = [2 x i8] c"\22\00"
@.str.2 = [2 x i8] c" \00"
define void @get_include_flags(i8* %0, i32 %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%9 = load i8**, i8*** %6
%10 = getelementptr inbounds i8*, i8** %9, i64 4
%11 = load i8*, i8** %10
store i8* %11, i8** %7
%12 = load i8*, i8** %4
%13 = call i32 @strcpy(i8* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%14 = load i8*, i8** %4
%15 = load i8*, i8** %7
%16 = call i32 @strcat(i8* %14, i8* %15)
%17 = load i8*, i8** %4
%18 = call i32 @strcat(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%19 = load i32, i32* %5
%20 = icmp sgt i32 %19, 5
br i1 %20, label %21, label %24
21: ; preds = %3
%22 = load i8*, i8** %4
%23 = call i32 @strcat(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %24
24: ; preds = %21, %3
store i32 5, i32* %8
br label %25
25: ; preds = %45, %24
%26 = load i32, i32* %8
%27 = load i32, i32* %5
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %48
29: ; preds = %25
%30 = load i8*, i8** %4
%31 = load i8**, i8*** %6
%32 = load i32, i32* %8
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8*, i8** %31, i64 %33
%35 = load i8*, i8** %34
%36 = call i32 @strcat(i8* %30, i8* %35)
%37 = load i32, i32* %8
%38 = load i32, i32* %5
%39 = sub nsw i32 %38, 1
%40 = icmp slt i32 %37, %39
br i1 %40, label %41, label %44
41: ; preds = %29
%42 = load i8*, i8** %4
%43 = call i32 @strcat(i8* %42, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %44
44: ; preds = %41, %29
br label %45
45: ; preds = %44
%46 = load i32, i32* %8
%47 = add nsw i32 %46, 1
store i32 %47, i32* %8
br label %25
48: ; preds = %25
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"-I\22\00"
@.str.1 = [2 x i8] c"\22\00"
@.str.2 = [2 x i8] c" \00"
define void @get_include_flags(i8* %0, i32 %1, i8** nocapture %2) {
%4 = getelementptr inbounds i8*, i8** %2, i64 4
%5 = load i8*, i8** %4
%6 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @strcat(i8* %0, i8* %5)
%8 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp sgt i32 %1, 5
br i1 %9, label %10, label %26
10: ; preds = %3
%11 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%12 = add nsw i32 %1, -1
%13 = zext i32 %12 to i64
%14 = zext i32 %1 to i64
br label %15
15: ; preds = %10, %23
%16 = phi i64 [ 5, %10 ], [ %24, %23 ]
%17 = getelementptr inbounds i8*, i8** %2, i64 %16
%18 = load i8*, i8** %17
%19 = tail call i32 @strcat(i8* %0, i8* %18)
%20 = icmp ult i64 %16, %13
br i1 %20, label %21, label %23
21: ; preds = %15
%22 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %15, %21
%24 = add nuw nsw i64 %16, 1
%25 = icmp eq i64 %24, %14
br i1 %25, label %26, label %15
26: ; preds = %23, %3
ret void
}