#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*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(int *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ putchar(int /*<<< orphan*/);
int /*<<< orphan*/ strcmp(char *, char *);
void output_source_code(int argc, char **argv) {
  int _i_;
  for (_i_ = 1; _i_ < argc; _i_++)
    if (!strcmp(argv[_i_], "--output_source_code") ||
        !strcmp(argv[_i_], "--osc")) {
      FILE *in = fopen(argv[0], "rb");
      fseek(in, -4, SEEK_END);
      int size;
      fread(&size, 1, 4, in);
      int size_all;
      fseek(in, 0, SEEK_END);
      size_all = ftell(in);
      fseek(in, size, SEEK_SET);
      while (size++ != size_all - 4)
        putchar(fgetc(in));
      fclose(in);
      exit(0);
    }
}


x86 assembly (clang, -O0):
<output_source_code>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    12bf <output_source_code+0x12f>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe3b(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
je     11f4 <output_source_code+0x64>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe2f(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    12ac <output_source_code+0x11c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe19(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    0x2dd2(%rip),%rax
mov    (%rax),%edx
mov    $0xfffffffc,%esi
call   1090 <fseek@plt>
mov    -0x20(%rbp),%rcx
lea    -0x24(%rbp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
call   1040 <fread@plt>
mov    -0x20(%rbp),%rdi
mov    0x2da4(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1090 <fseek@plt>
mov    -0x20(%rbp),%rdi
call   1080 <ftell@plt>
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    0x2d71(%rip),%rax
mov    (%rax),%edx
call   1090 <fseek@plt>
mov    -0x24(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x24(%rbp)
mov    -0x28(%rbp),%ecx
sub    $0x4,%ecx
cmp    %ecx,%eax
je     129c <output_source_code+0x10c>
mov    -0x20(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
jmp    126e <output_source_code+0xde>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
jmp    12b1 <output_source_code+0x121>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a6 <output_source_code+0x16>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_source_code>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     11eb <output_source_code+0x5b>
mov    %rsi,%r12
mov    %edi,%r13d
mov    $0x1,%ebx
lea    0xe4e(%rip),%r14
lea    0xe5c(%rip),%r15
nopl   0x0(%rax)
mov    (%r12,%rbx,8),%rbp
mov    %rbp,%rdi
mov    %r14,%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
je     11fa <output_source_code+0x6a>
mov    %rbp,%rdi
mov    %r15,%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
je     11fa <output_source_code+0x6a>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    11c0 <output_source_code+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%r12),%rdi
lea    0xe16(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%r14
mov    0x2dd4(%rip),%rbx
mov    (%rbx),%edx
mov    %rax,%rdi
mov    $0xfffffffc,%esi
call   1090 <fseek@plt>
lea    0x4(%rsp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
mov    (%rbx),%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1090 <fseek@plt>
mov    %r14,%rdi
call   1080 <ftell@plt>
mov    %eax,%ebx
mov    0x4(%rsp),%ebp
mov    0x2d7d(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
mov    %ebp,%esi
call   1090 <fseek@plt>
lea    -0x4(%rbx),%eax
cmp    %eax,%ebp
je     1294 <output_source_code+0x104>
sub    %ebp,%ebx
add    $0xfffffffc,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
call   1060 <fgetc@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1280 <output_source_code+0xf0>
mov    %r14,%rdi
call   1050 <fclose@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"--output_source_code\00"
@.str.1 = [6 x i8] c"--osc\00"
@.str.2 = [3 x i8] c"rb\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define void @output_source_code(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 1, i32* %5
br label %9
9: ; preds = %63, %2
%10 = load i32, i32* %5
%11 = load i32, i32* %3
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %66
13: ; preds = %9
%14 = load i8**, i8*** %4
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8*, i8** %14, i64 %16
%18 = load i8*, i8** %17
%19 = call i32 @strcmp(i8* %18, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %29
21: ; preds = %13
%22 = load i8**, i8*** %4
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
%26 = load i8*, i8** %25
%27 = call i32 @strcmp(i8* %26, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%28 = icmp ne i32 %27, 0
br i1 %28, label %62, label %29
29: ; preds = %21, %13
%30 = load i8**, i8*** %4
%31 = getelementptr inbounds i8*, i8** %30, i64 0
%32 = load i8*, i8** %31
%33 = call i32* @fopen(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %33, i32** %6
%34 = load i32*, i32** %6
%35 = load i32, i32* @SEEK_END
%36 = call i32 @fseek(i32* %34, i32 -4, i32 %35)
%37 = load i32*, i32** %6
%38 = call i32 @fread(i32* %7, i32 1, i32 4, i32* %37)
%39 = load i32*, i32** %6
%40 = load i32, i32* @SEEK_END
%41 = call i32 @fseek(i32* %39, i32 0, i32 %40)
%42 = load i32*, i32** %6
%43 = call i32 @ftell(i32* %42)
store i32 %43, i32* %8
%44 = load i32*, i32** %6
%45 = load i32, i32* %7
%46 = load i32, i32* @SEEK_SET
%47 = call i32 @fseek(i32* %44, i32 %45, i32 %46)
br label %48
48: ; preds = %54, %29
%49 = load i32, i32* %7
%50 = add nsw i32 %49, 1
store i32 %50, i32* %7
%51 = load i32, i32* %8
%52 = sub nsw i32 %51, 4
%53 = icmp ne i32 %49, %52
br i1 %53, label %54, label %58
54: ; preds = %48
%55 = load i32*, i32** %6
%56 = call i32 @fgetc(i32* %55)
%57 = call i32 @putchar(i32 %56)
br label %48
58: ; preds = %48
%59 = load i32*, i32** %6
%60 = call i32 @fclose(i32* %59)
%61 = call i32 @exit(i32 0)
unreachable
62: ; preds = %21
br label %63
63: ; preds = %62
%64 = load i32, i32* %5
%65 = add nsw i32 %64, 1
store i32 %65, i32* %5
br label %9
66: ; preds = %9
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"--output_source_code\00"
@.str.1 = [6 x i8] c"--osc\00"
@.str.2 = [3 x i8] c"rb\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define void @output_source_code(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %43
5: ; preds = %2
%6 = zext i32 %0 to i64
br label %9
7: ; preds = %15
%8 = icmp eq i64 %18, %6
br i1 %8, label %43, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 1, %5 ], [ %18, %7 ]
%11 = getelementptr inbounds i8*, i8** %1, i64 %10
%12 = load i8*, i8** %11
%13 = tail call i32 @strcmp(i8* dereferenceable(1) %12, i8* dereferenceable(21) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %9
%16 = tail call i32 @strcmp(i8* dereferenceable(1) %12, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
%18 = add nuw nsw i64 %10, 1
br i1 %17, label %19, label %7
19: ; preds = %15, %9
%20 = load i8*, i8** %1
%21 = tail call i32* @fopen(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%22 = load i32, i32* @SEEK_END
%23 = tail call i32 @fseek(i32* %21, i32 -4, i32 %22)
%24 = bitcast i32* %3 to i8*
%25 = call i32 @fread(i32* %3, i32 1, i32 4, i32* %21)
%26 = load i32, i32* @SEEK_END
%27 = tail call i32 @fseek(i32* %21, i32 0, i32 %26)
%28 = tail call i32 @ftell(i32* %21)
%29 = load i32, i32* %3
%30 = load i32, i32* @SEEK_SET
%31 = tail call i32 @fseek(i32* %21, i32 %29, i32 %30)
%32 = add nsw i32 %28, -4
%33 = icmp eq i32 %29, %32
br i1 %33, label %40, label %34
34: ; preds = %19, %34
%35 = phi i32 [ %36, %34 ], [ %29, %19 ]
%36 = add nsw i32 %35, 1
%37 = tail call i32 @fgetc(i32* %21)
%38 = tail call i32 @putchar(i32 %37)
%39 = icmp eq i32 %36, %32
br i1 %39, label %40, label %34
40: ; preds = %34, %19
%41 = tail call i32 @fclose(i32* %21)
%42 = tail call i32 @exit(i32 0)
unreachable
43: ; preds = %7, %2
ret void
}