#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*/ insert_into_file(char *, char *, char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char **argv) {
  char *replacefile;
  char *inoupdate_start;
  char *inoupdate_end;
  if (argc <= 4) {
    printf("%s replacefilename \"start-text\" \"end-text\" [.ino files]\n",
           argv[0]);
    return 1;
  }
  argv++;
  replacefile = *argv;
  argv++;
  inoupdate_start = *argv;
  argv++;
  inoupdate_end = *argv;
  argv++;
  while (*argv != NULL) {
    insert_into_file(*argv, replacefile, inoupdate_start, inoupdate_end);
    argv++;
  }
  return 0;
}


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)
cmpl   $0x4,-0x8(%rbp)
jg     115f <main+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11ee <main+0xce>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     11e7 <main+0xc7>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1040 <insert_into_file@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    11b0 <main+0x90>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%rbx
cmp    $0x4,%edi
jg     1147 <main+0x27>
mov    (%rbx),%rsi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%r14d
jmp    118a <main+0x6a>
mov    0x20(%rbx),%rdi
xor    %r14d,%r14d
test   %rdi,%rdi
je     118a <main+0x6a>
mov    0x8(%rbx),%r15
mov    0x10(%rbx),%r12
mov    0x18(%rbx),%rbp
add    $0x28,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rsi
mov    %r12,%rdx
mov    %rbp,%rcx
call   1040 <insert_into_file@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1170 <main+0x50>
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [57 x i8] c"%s replacefilename \22start-text\22 \22end-text\22 [.ino files]\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp sle i32 %9, 4
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* %14)
store i32 1, i32* %3
br label %45
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i32 1
store i8** %18, i8*** %5
%19 = load i8**, i8*** %5
%20 = load i8*, i8** %19
store i8* %20, i8** %6
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i32 1
store i8** %22, i8*** %5
%23 = load i8**, i8*** %5
%24 = load i8*, i8** %23
store i8* %24, i8** %7
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i32 1
store i8** %26, i8*** %5
%27 = load i8**, i8*** %5
%28 = load i8*, i8** %27
store i8* %28, i8** %8
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i32 1
store i8** %30, i8*** %5
br label %31
31: ; preds = %35, %16
%32 = load i8**, i8*** %5
%33 = load i8*, i8** %32
%34 = icmp ne i8* %33, null
br i1 %34, label %35, label %44
35: ; preds = %31
%36 = load i8**, i8*** %5
%37 = load i8*, i8** %36
%38 = load i8*, i8** %6
%39 = load i8*, i8** %7
%40 = load i8*, i8** %8
%41 = call i32 @insert_into_file(i8* %37, i8* %38, i8* %39, i8* %40)
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i32 1
store i8** %43, i8*** %5
br label %31
44: ; preds = %31
store i32 0, i32* %3
br label %45
45: ; preds = %44, %11
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
@.str = [57 x i8] c"%s replacefilename \22start-text\22 \22end-text\22 [.ino files]\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 5
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %24
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8*, i8** %1, i64 3
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8*, i8** %1, i64 4
%15 = load i8*, i8** %14
%16 = icmp eq i8* %15, null
br i1 %16, label %24, label %17
17: ; preds = %7, %17
%18 = phi i8* [ %22, %17 ], [ %15, %7 ]
%19 = phi i8** [ %21, %17 ], [ %14, %7 ]
%20 = tail call i32 @insert_into_file(i8* %18, i8* %9, i8* %11, i8* %13)
%21 = getelementptr inbounds i8*, i8** %19, i64 1
%22 = load i8*, i8** %21
%23 = icmp eq i8* %22, null
br i1 %23, label %24, label %17
24: ; preds = %17, %7, %4
%25 = phi i32 [ 1, %4 ], [ 0, %7 ], [ 0, %17 ]
ret i32 %25
}