#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*/ emit_names(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ scan_file(char *);
int /*<<< orphan*/ sort_names();
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  int i;
  const char *program = argv[0];
  FILE *ic, *ih;
  argc--;
  argv++;
  if (argc < 3 || strcmp(argv[2], "--")) {
    fprintf(stderr, "Usage: %s ic-file ih-file -- file ...\n", program);
    exit(1);
  }
  if (!(ic = fopen(argv[0], "w")) || !(ih = fopen(argv[1], "w"))) {
    fprintf(stderr, "%s: Could not open output\n", program);
    exit(1);
  }
  argc -= 3;
  argv += 3;
  for (i = 1; i < argc; i++)
    scan_file(argv[i]);
  sort_names();
  emit_names(ic, ih);
  fclose(ic);
  fclose(ih);
  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)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jl     11de <main+0x5e>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe31(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1201 <main+0x81>
mov    0x2dfb(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xe11(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe1b(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     1244 <main+0xc4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdf9(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    1267 <main+0xe7>
mov    0x2d95(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xdd4(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x8(%rbp),%eax
sub    $0x3,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x18,%rax
mov    %rax,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12ae <main+0x12e>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   10a0 <scan_file@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1283 <main+0x103>
mov    $0x0,%al
call   1030 <sort_names@plt>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1040 <emit_names@plt>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    (%rsi),%r12
cmp    $0x4,%edi
jl     1246 <main+0xc6>
mov    %rsi,%r14
mov    %edi,%ebp
mov    0x18(%rsi),%rdi
lea    0xe59(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    1246 <main+0xc6>
mov    0x8(%r14),%rdi
lea    0xe6a(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     1258 <main+0xd8>
mov    %rax,%r15
mov    0x10(%r14),%rdi
lea    0xe4e(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     1258 <main+0xd8>
mov    %rax,%r13
cmp    $0x6,%ebp
jb     1213 <main+0x93>
add    $0xfffffffc,%ebp
add    $0xffffffffffffffff,%rbp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    0x28(%r14,%rbx,8),%rdi
call   10a0 <scan_file@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1200 <main+0x80>
xor    %eax,%eax
call   1030 <sort_names@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1040 <emit_names@plt>
mov    %r15,%rdi
call   1050 <fclose@plt>
mov    %r13,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d93(%rip),%rax
mov    (%rax),%edi
lea    0xdad(%rip),%rsi
jmp    1268 <main+0xe8>
mov    0x2d81(%rip),%rax
mov    (%rax),%edi
lea    0xdc4(%rip),%rsi
mov    %r12,%rdx
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"--\00"
@stderr = global i32 0
@.str.1 = [39 x i8] c"Usage: %s ic-file ih-file -- file ...\0A\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [27 x i8] c"%s: Could not open output\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
store i8* %12, i8** %7
%13 = load i32, i32* %4
%14 = add nsw i32 %13, -1
store i32 %14, i32* %4
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i32 1
store i8** %16, i8*** %5
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 3
br i1 %18, label %25, label %19
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %30
25: ; preds = %19, %2
%26 = load i32, i32* @stderr
%27 = load i8*, i8** %7
%28 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %27)
%29 = call i32 @exit(i32 1)
unreachable
30: ; preds = %19
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 0
%33 = load i8*, i8** %32
%34 = call i32* @fopen(i8* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %34, i32** %8
%35 = icmp ne i32* %34, null
br i1 %35, label %36, label %42
36: ; preds = %30
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 1
%39 = load i8*, i8** %38
%40 = call i32* @fopen(i8* %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %40, i32** %9
%41 = icmp ne i32* %40, null
br i1 %41, label %47, label %42
42: ; preds = %36, %30
%43 = load i32, i32* @stderr
%44 = load i8*, i8** %7
%45 = call i32 @fprintf(i32 %43, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %44)
%46 = call i32 @exit(i32 1)
unreachable
47: ; preds = %36
%48 = load i32, i32* %4
%49 = sub nsw i32 %48, 3
store i32 %49, i32* %4
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 3
store i8** %51, i8*** %5
store i32 1, i32* %6
br label %52
52: ; preds = %63, %47
%53 = load i32, i32* %6
%54 = load i32, i32* %4
%55 = icmp slt i32 %53, %54
br i1 %55, label %56, label %66
56: ; preds = %52
%57 = load i8**, i8*** %5
%58 = load i32, i32* %6
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8*, i8** %57, i64 %59
%61 = load i8*, i8** %60
%62 = call i32 @scan_file(i8* %61)
br label %63
63: ; preds = %56
%64 = load i32, i32* %6
%65 = add nsw i32 %64, 1
store i32 %65, i32* %6
br label %52
66: ; preds = %52
%67 = call i32 (...) @sort_names()
%68 = load i32*, i32** %8
%69 = load i32*, i32** %9
%70 = call i32 @emit_names(i32* %68, i32* %69)
%71 = load i32*, i32** %8
%72 = call i32 @fclose(i32* %71)
%73 = load i32*, i32** %9
%74 = call i32 @fclose(i32* %73)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"--\00"
@stderr = global i32 0
@.str.1 = [39 x i8] c"Usage: %s ic-file ih-file -- file ...\0A\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [27 x i8] c"%s: Could not open output\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = icmp slt i32 %0, 4
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 3
%8 = load i8*, i8** %7
%9 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %6, %2
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%14 = tail call i32 @exit(i32 1)
unreachable
15: ; preds = %6
%16 = load i8*, i8** %4
%17 = tail call i32* @fopen(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i32* %17, null
br i1 %18, label %24, label %19
19: ; preds = %15
%20 = getelementptr inbounds i8*, i8** %1, i64 2
%21 = load i8*, i8** %20
%22 = tail call i32* @fopen(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %28
24: ; preds = %19, %15
%25 = load i32, i32* @stderr
%26 = tail call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %3)
%27 = tail call i32 @exit(i32 1)
unreachable
28: ; preds = %19
%29 = getelementptr inbounds i8*, i8** %1, i64 4
%30 = icmp ugt i32 %0, 5
br i1 %30, label %31, label %41
31: ; preds = %28
%32 = add nsw i32 %0, -4
%33 = zext i32 %32 to i64
br label %34
34: ; preds = %31, %34
%35 = phi i64 [ 1, %31 ], [ %39, %34 ]
%36 = getelementptr inbounds i8*, i8** %29, i64 %35
%37 = load i8*, i8** %36
%38 = tail call i32 @scan_file(i8* %37)
%39 = add nuw nsw i64 %35, 1
%40 = icmp eq i64 %39, %33
br i1 %40, label %41, label %34
41: ; preds = %34, %28
%42 = tail call i32 (...) @sort_names()
%43 = tail call i32 @emit_names(i32* %17, i32* %22)
%44 = tail call i32 @fclose(i32* %17)
%45 = tail call i32 @fclose(i32* %22)
ret i32 0
}