#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;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  if (argc == 1) {
    return 0;
  } else if (argc > 2 && strcmp(argv[1], "--help") != 0 &&
             strcmp(argv[1], "-h") != 0) {
    FILE *pointer;
    pointer = fopen(argv[1], "w");
    int i = 2;
    int test;
    for (i; i < argc; i++) {
      if (strcmp(argv[i], "--break") == 0) {
        fprintf(pointer, "\n");
      } else {
        fprintf(pointer, "%s ", argv[i]);
      }
    }
    fclose(pointer);
  } else if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) {
    printf("Minipad 1.0 by CyberError\nUSAGE: minipad [filename] [contents]\n");
    printf("Options\n\t-h --help\t-Displays this text\n\t   --break\t-Inserts "
           "a new line in position of --break\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    117c <main+0x2c>
movl   $0x0,-0x4(%rbp)
jmp    12ca <main+0x17a>
cmpl   $0x2,-0x8(%rbp)
jle    1265 <main+0x115>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe6b(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     1265 <main+0x115>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe54(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     1265 <main+0x115>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe39(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
movl   $0x2,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1257 <main+0x107>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe0c(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1226 <main+0xd6>
mov    -0x18(%rbp),%rdi
lea    0xe3c(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    1244 <main+0xf4>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xdd7(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    1249 <main+0xf9>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11e1 <main+0x91>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
jmp    12be <main+0x16e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd93(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     12a1 <main+0x151>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd6e(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12b9 <main+0x169>
lea    0xd70(%rip),%rdi
call   1040 <printf@plt>
lea    0xda4(%rip),%rdi
call   1040 <printf@plt>
jmp    12be <main+0x16e>
jmp    12c3 <main+0x173>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x1,%edi
je     1266 <main+0x106>
mov    %rsi,%rbx
mov    %edi,%ebp
cmp    $0x3,%edi
jl     121a <main+0xba>
mov    0x8(%rbx),%rdi
lea    0xe73(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     121a <main+0xba>
mov    0x8(%rbx),%rdi
lea    0xe61(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     121a <main+0xba>
mov    0x8(%rbx),%rdi
lea    0xe4f(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r14
mov    %ebp,%r13d
mov    $0x2,%ebp
lea    0xed3(%rip),%r12
lea    0xe33(%rip),%r15
jmp    11fa <main+0x9a>
nopl   0x0(%rax,%rax,1)
mov    (%rbx,%rbp,8),%rdx
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
je     125e <main+0xfe>
mov    (%rbx,%rbp,8),%rdi
mov    %r12,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    11e0 <main+0x80>
mov    $0xa,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
jmp    11f1 <main+0x91>
mov    0x8(%rbx),%rdi
lea    0xde2(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1244 <main+0xe4>
mov    0x8(%rbx),%rdi
lea    0xdc6(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    1266 <main+0x106>
lea    0xdc5(%rip),%rdi
call   1030 <puts@plt>
lea    0xdf8(%rip),%rdi
call   1030 <puts@plt>
jmp    1266 <main+0x106>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"--help\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [8 x i8] c"--break\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [4 x i8] c"%s \00"
@.str.6 = [64 x i8] c"Minipad 1.0 by CyberError\0AUSAGE: minipad [filename] [contents]\0A\00"
@.str.7 = [95 x i8] c"Options\0A\09-h --help\09-Displays this text\0A\09 --break\09-Inserts a new line in position of --break\0A\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 i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 0, i32* %3
br label %81
12: ; preds = %2
%13 = load i32, i32* %4
%14 = icmp sgt i32 %13, 2
br i1 %14, label %15, label %63
15: ; preds = %12
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %63
21: ; preds = %15
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %63
27: ; preds = %21
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i32* @fopen(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %31, i32** %6
store i32 2, i32* %7
%32 = load i32, i32* %7
br label %33
33: ; preds = %57, %27
%34 = load i32, i32* %7
%35 = load i32, i32* %4
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %60
37: ; preds = %33
%38 = load i8**, i8*** %5
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8*, i8** %38, i64 %40
%42 = load i8*, i8** %41
%43 = call i64 @strcmp(i8* %42, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %48
45: ; preds = %37
%46 = load i32*, i32** %6
%47 = call i32 (i32*, i8*, ...) @fprintf(i32* %46, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %56
48: ; preds = %37
%49 = load i32*, i32** %6
%50 = load i8**, i8*** %5
%51 = load i32, i32* %7
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i8*, i8** %50, i64 %52
%54 = load i8*, i8** %53
%55 = call i32 (i32*, i8*, ...) @fprintf(i32* %49, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %54)
br label %56
56: ; preds = %48, %45
br label %57
57: ; preds = %56
%58 = load i32, i32* %7
%59 = add nsw i32 %58, 1
store i32 %59, i32* %7
br label %33
60: ; preds = %33
%61 = load i32*, i32** %6
%62 = call i32 @fclose(i32* %61)
br label %79
63: ; preds = %21, %15, %12
%64 = load i8**, i8*** %5
%65 = getelementptr inbounds i8*, i8** %64, i64 1
%66 = load i8*, i8** %65
%67 = call i64 @strcmp(i8* %66, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%68 = icmp eq i64 %67, 0
br i1 %68, label %75, label %69
69: ; preds = %63
%70 = load i8**, i8*** %5
%71 = getelementptr inbounds i8*, i8** %70, i64 1
%72 = load i8*, i8** %71
%73 = call i64 @strcmp(i8* %72, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%74 = icmp eq i64 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %69, %63
%76 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.6, i64 0, i64 0))
%77 = call i32 @printf(i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str.7, i64 0, i64 0))
br label %78
78: ; preds = %75, %69
br label %79
79: ; preds = %78, %60
br label %80
80: ; preds = %79
store i32 0, i32* %3
br label %81
81: ; preds = %80, %11
%82 = load i32, i32* %3
ret i32 %82
}

LLVM IR (-O2):
@.str = [7 x i8] c"--help\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [8 x i8] c"--break\00"
@.str.5 = [4 x i8] c"%s \00"
@str = [63 x i8] c"Minipad 1.0 by CyberError\0AUSAGE: minipad [filename] [contents]\00"
@str.8 = [94 x i8] c"Options\0A\09-h --help\09-Displays this text\0A\09 --break\09-Inserts a new line in position of --break\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %47, label %4
4: ; preds = %2
%5 = icmp sgt i32 %0, 2
br i1 %5, label %6, label %35
6: ; preds = %4
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %35, label %11
11: ; preds = %6
%12 = load i8*, i8** %7
%13 = tail call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %35, label %15
15: ; preds = %11
%16 = load i8*, i8** %7
%17 = tail call i32* @fopen(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%18 = zext i32 %0 to i64
br label %19
19: ; preds = %15, %30
%20 = phi i64 [ 2, %15 ], [ %31, %30 ]
%21 = getelementptr inbounds i8*, i8** %1, i64 %20
%22 = load i8*, i8** %21
%23 = tail call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %19
%26 = tail call i32 @fputc(i32 10, i32* %17)
br label %30
27: ; preds = %19
%28 = load i8*, i8** %21
%29 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %28)
br label %30
30: ; preds = %25, %27
%31 = add nuw nsw i64 %20, 1
%32 = icmp eq i64 %31, %18
br i1 %32, label %33, label %19
33: ; preds = %30
%34 = tail call i32 @fclose(i32* %17)
br label %47
35: ; preds = %11, %6, %4
%36 = getelementptr inbounds i8*, i8** %1, i64 1
%37 = load i8*, i8** %36
%38 = tail call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %44, label %40
40: ; preds = %35
%41 = load i8*, i8** %36
%42 = tail call i64 @strcmp(i8* %41, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %40, %35
%45 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str, i64 0, i64 0))
%46 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([94 x i8], [94 x i8]* @str.8, i64 0, i64 0))
br label %47
47: ; preds = %40, %44, %33, %2
ret i32 0
}