#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 */
typedef int /*<<< orphan*/ file_path;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *);
int main(int argc, char **argv) {
  const char *path = NULL;
  for (int i = 0; i < argc; i++) {
    if (argv[i][0] == '-' && argv[i][1] == 'o') {
      path = argv[i + 1];
    }
  }
  FILE *f = fopen("/tmp/brighter-output.txt", "w");
  fprintf(f, "%s", path);
  fclose(f);
  char file_path[512];
  snprintf(file_path, sizeof(file_path), "%s/brighter.h", path);
  f = fopen(file_path, "w");
  fclose(f);
  snprintf(file_path, sizeof(file_path), "%s/brighter.o", path);
  f = fopen(file_path, "w");
  fclose(f);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11dd <main+0x8d>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    11ca <main+0x7a>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl 0x1(%rax),%eax
cmp    $0x6f,%eax
jne    11ca <main+0x7a>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
jmp    11cf <main+0x7f>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1178 <main+0x28>
lea    0xe1c(%rip),%rdi
lea    0xe2e(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe18(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
lea    -0x230(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x200,%esi
lea    0xdf6(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x230(%rbp),%rdi
lea    0xdde(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
lea    -0x230(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x200,%esi
lea    0xdc8(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x230(%rbp),%rdi
lea    0xda2(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x200,%rsp
test   %edi,%edi
jle    118a <main+0x3a>
mov    %edi,%ecx
cmp    $0x1,%edi
jne    1216 <main+0xc6>
xor    %eax,%eax
xor    %ebx,%ebx
test   $0x1,%cl
je     118c <main+0x3c>
mov    (%rsi,%rax,8),%rcx
cmpb   $0x2d,(%rcx)
jne    118c <main+0x3c>
cmpb   $0x6f,0x1(%rcx)
jne    118c <main+0x3c>
mov    0x8(%rsi,%rax,8),%rbx
jmp    118c <main+0x3c>
xor    %ebx,%ebx
lea    0xe6d(%rip),%rdi
lea    0xe7f(%rip),%r14
mov    %r14,%rsi
call   1060 <fopen@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %rax,%rsi
call   1050 <fputs@plt>
mov    %r15,%rdi
call   1030 <fclose@plt>
lea    0xe5c(%rip),%rdx
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x200,%esi
mov    %rbx,%rcx
call   1040 <snprintf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1060 <fopen@plt>
mov    %rax,%rdi
call   1030 <fclose@plt>
lea    0xe3d(%rip),%rdx
mov    %r15,%rdi
mov    $0x200,%esi
mov    %rbx,%rcx
call   1040 <snprintf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1060 <fopen@plt>
mov    %rax,%rdi
call   1030 <fclose@plt>
xor    %edi,%edi
call   1070 <exit@plt>
mov    %ecx,%edx
and    $0xfffffffe,%edx
xor    %eax,%eax
xor    %ebx,%ebx
jmp    123d <main+0xed>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x2,%rax
cmp    %rax,%rdx
je     116f <main+0x1f>
mov    (%rsi,%rax,8),%rdi
cmpb   $0x2d,(%rdi)
jne    1251 <main+0x101>
cmpb   $0x6f,0x1(%rdi)
jne    1251 <main+0x101>
mov    0x8(%rsi,%rax,8),%rbx
mov    0x8(%rsi,%rax,8),%rdi
cmpb   $0x2d,(%rdi)
jne    1230 <main+0xe0>
cmpb   $0x6f,0x1(%rdi)
jne    1230 <main+0xe0>
mov    0x10(%rsi,%rax,8),%rbx
jmp    1230 <main+0xe0>

LLVM IR (-O0):
@.str = [25 x i8] c"/tmp/brighter-output.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [14 x i8] c"%s/brighter.h\00"
@.str.4 = [14 x i8] c"%s/brighter.o\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32*
%9 = alloca [512 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i32 0, i32* %7
br label %10
10: ; preds = %42, %2
%11 = load i32, i32* %7
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %45
14: ; preds = %10
%15 = load i8**, i8*** %5
%16 = load i32, i32* %7
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 45
br i1 %23, label %24, label %41
24: ; preds = %14
%25 = load i8**, i8*** %5
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %25, i64 %27
%29 = load i8*, i8** %28
%30 = getelementptr inbounds i8, i8* %29, i64 1
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 111
br i1 %33, label %34, label %41
34: ; preds = %24
%35 = load i8**, i8*** %5
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8*, i8** %35, i64 %38
%40 = load i8*, i8** %39
store i8* %40, i8** %6
br label %41
41: ; preds = %34, %24, %14
br label %42
42: ; preds = %41
%43 = load i32, i32* %7
%44 = add nsw i32 %43, 1
store i32 %44, i32* %7
br label %10
45: ; preds = %10
%46 = call i32* @fopen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %46, i32** %8
%47 = load i32*, i32** %8
%48 = load i8*, i8** %6
%49 = call i32 @fprintf(i32* %47, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %48)
%50 = load i32*, i32** %8
%51 = call i32 @fclose(i32* %50)
%52 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%53 = load i8*, i8** %6
%54 = call i32 @snprintf(i8* %52, i32 512, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %53)
%55 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%56 = call i32* @fopen(i8* %55, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %56, i32** %8
%57 = load i32*, i32** %8
%58 = call i32 @fclose(i32* %57)
%59 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%60 = load i8*, i8** %6
%61 = call i32 @snprintf(i8* %59, i32 512, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %60)
%62 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%63 = call i32* @fopen(i8* %62, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %63, i32** %8
%64 = load i32*, i32** %8
%65 = call i32 @fclose(i32* %64)
%66 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [25 x i8] c"/tmp/brighter-output.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.3 = [14 x i8] c"%s/brighter.h\00"
@.str.4 = [14 x i8] c"%s/brighter.o\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [512 x i8]
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %29
5: ; preds = %2
%6 = zext i32 %0 to i64
%7 = and i64 %6, 1
%8 = icmp eq i32 %0, 1
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = and i64 %6, 4294967294
br label %42
11: ; preds = %73, %5
%12 = phi i8* [ undef, %5 ], [ %74, %73 ]
%13 = phi i64 [ 0, %5 ], [ %75, %73 ]
%14 = phi i8* [ null, %5 ], [ %74, %73 ]
%15 = icmp eq i64 %7, 0
br i1 %15, label %29, label %16
16: ; preds = %11
%17 = getelementptr inbounds i8*, i8** %1, i64 %13
%18 = load i8*, i8** %17
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 45
br i1 %20, label %21, label %29
21: ; preds = %16
%22 = getelementptr inbounds i8, i8* %18, i64 1
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 111
br i1 %24, label %25, label %29
25: ; preds = %21
%26 = add nuw nsw i64 %13, 1
%27 = getelementptr inbounds i8*, i8** %1, i64 %26
%28 = load i8*, i8** %27
br label %29
29: ; preds = %11, %25, %21, %16, %2
%30 = phi i8* [ null, %2 ], [ %12, %11 ], [ %28, %25 ], [ %14, %21 ], [ %14, %16 ]
%31 = tail call i32* @fopen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%32 = tail call i32 @fputs(i8* %30, i32* %31)
%33 = tail call i32 @fclose(i32* %31)
%34 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%35 = call i32 @snprintf(i8* %34, i32 512, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %30)
%36 = call i32* @fopen(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%37 = call i32 @fclose(i32* %36)
%38 = call i32 @snprintf(i8* %34, i32 512, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %30)
%39 = call i32* @fopen(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%40 = call i32 @fclose(i32* %39)
%41 = call i32 @exit(i32 0)
unreachable
42: ; preds = %73, %9
%43 = phi i64 [ 0, %9 ], [ %75, %73 ]
%44 = phi i8* [ null, %9 ], [ %74, %73 ]
%45 = phi i64 [ 0, %9 ], [ %76, %73 ]
%46 = getelementptr inbounds i8*, i8** %1, i64 %43
%47 = load i8*, i8** %46
%48 = load i8, i8* %47
%49 = icmp eq i8 %48, 45
br i1 %49, label %50, label %58
50: ; preds = %42
%51 = getelementptr inbounds i8, i8* %47, i64 1
%52 = load i8, i8* %51
%53 = icmp eq i8 %52, 111
br i1 %53, label %54, label %58
54: ; preds = %50
%55 = or i64 %43, 1
%56 = getelementptr inbounds i8*, i8** %1, i64 %55
%57 = load i8*, i8** %56
br label %58
58: ; preds = %42, %50, %54
%59 = phi i8* [ %57, %54 ], [ %44, %50 ], [ %44, %42 ]
%60 = or i64 %43, 1
%61 = getelementptr inbounds i8*, i8** %1, i64 %60
%62 = load i8*, i8** %61
%63 = load i8, i8* %62
%64 = icmp eq i8 %63, 45
br i1 %64, label %65, label %73
65: ; preds = %58
%66 = getelementptr inbounds i8, i8* %62, i64 1
%67 = load i8, i8* %66
%68 = icmp eq i8 %67, 111
br i1 %68, label %69, label %73
69: ; preds = %65
%70 = add nuw i64 %43, 2
%71 = getelementptr inbounds i8*, i8** %1, i64 %70
%72 = load i8*, i8** %71
br label %73
73: ; preds = %69, %65, %58
%74 = phi i8* [ %72, %69 ], [ %59, %65 ], [ %59, %58 ]
%75 = add nuw nsw i64 %43, 2
%76 = add i64 %45, 2
%77 = icmp eq i64 %76, %10
br i1 %77, label %11, label %42
}