#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int tag_file(char *, char *);
int /*<<< orphan*/ usage();
int main_tag_file(int argc, char **argv) {
  assert(argv != NULL);
  if (argc < 2) {
    usage();
    return 1;
  }
  for (int i = 1; i < argc; i++)
    if (tag_file(argv[0], argv[i]) == 1) {
      fprintf(stderr, "ftag"
                      ": error tagging file\n");
      return 1;
    }
  return 0;
}


x86 assembly (clang, -O0):
<main_tag_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x2,-0x8(%rbp)
jge    117e <main_tag_file+0x3e>
mov    $0x0,%al
call   1060 <usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    11ed <main_tag_file+0xad>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11e6 <main_tag_file+0xa6>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1050 <tag_file@plt>
cmp    $0x1,%eax
jne    11d3 <main_tag_file+0x93>
mov    0x2e27(%rip),%rax
mov    (%rax),%edi
lea    0xe3e(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11ed <main_tag_file+0xad>
jmp    11d8 <main_tag_file+0x98>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1185 <main_tag_file+0x45>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main_tag_file>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %edi,%edi
test   %rsi,%rsi
setne  %dil
call   1030 <assert@plt>
cmp    $0x2,%ebp
jge    116a <main_tag_file+0x2a>
xor    %eax,%eax
call   1060 <usage@plt>
mov    $0x1,%eax
jmp    11d4 <main_tag_file+0x94>
mov    (%rbx),%rdi
mov    0x8(%rbx),%rsi
call   1050 <tag_file@plt>
mov    $0x1,%r14b
cmp    $0x1,%eax
je     11b5 <main_tag_file+0x75>
mov    %ebp,%r14d
mov    $0x2,%ebp
cs nopw 0x0(%rax,%rax,1)
cmp    %rbp,%r14
je     11cc <main_tag_file+0x8c>
mov    (%rbx),%rdi
mov    (%rbx,%rbp,8),%rsi
call   1050 <tag_file@plt>
add    $0x1,%rbp
cmp    $0x1,%eax
jne    1190 <main_tag_file+0x50>
add    $0xffffffffffffffff,%rbp
cmp    %r14,%rbp
setb   %r14b
mov    0x2e24(%rip),%rax
mov    (%rax),%edi
lea    0xe3b(%rip),%rsi
call   1040 <fprintf@plt>
jmp    11d0 <main_tag_file+0x90>
seta   %r14b
movzbl %r14b,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [26 x i8] c"ftag: error tagging file\0A\00"
define i32 @main_tag_file(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = icmp ne i8** %7, null
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 2
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 (...) @usage()
store i32 1, i32* %3
br label %39
15: ; preds = %2
store i32 1, i32* %6
br label %16
16: ; preds = %35, %15
%17 = load i32, i32* %6
%18 = load i32, i32* %4
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %38
20: ; preds = %16
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = load i8**, i8*** %5
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 @tag_file(i8* %23, i8* %28)
%30 = icmp eq i32 %29, 1
br i1 %30, label %31, label %34
31: ; preds = %20
%32 = load i32, i32* @stderr
%33 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %39
34: ; preds = %20
br label %35
35: ; preds = %34
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %16
38: ; preds = %16
store i32 0, i32* %3
br label %39
39: ; preds = %38, %31, %13
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [26 x i8] c"ftag: error tagging file\0A\00"
define i32 @main_tag_file(i32 %0, i8** %1) {
%3 = icmp ne i8** %1, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = icmp slt i32 %0, 2
br i1 %6, label %15, label %7
7: ; preds = %2
%8 = zext i32 %0 to i64
%9 = zext i32 %0 to i64
%10 = load i8*, i8** %1
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @tag_file(i8* %10, i8* %12)
%14 = icmp eq i32 %13, 1
br i1 %14, label %29, label %17
15: ; preds = %2
%16 = tail call i32 (...) @usage()
br label %38
17: ; preds = %7, %20
%18 = phi i64 [ %26, %20 ], [ 2, %7 ]
%19 = icmp eq i64 %18, %9
br i1 %19, label %33, label %20
20: ; preds = %17
%21 = load i8*, i8** %1
%22 = getelementptr inbounds i8*, i8** %1, i64 %18
%23 = load i8*, i8** %22
%24 = tail call i32 @tag_file(i8* %21, i8* %23)
%25 = icmp eq i32 %24, 1
%26 = add nuw nsw i64 %18, 1
br i1 %25, label %27, label %17
27: ; preds = %20
%28 = icmp ult i64 %18, %8
br label %29
29: ; preds = %27, %7
%30 = phi i1 [ true, %7 ], [ %28, %27 ]
%31 = load i32, i32* @stderr
%32 = tail call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %35
33: ; preds = %17
%34 = icmp ult i64 %18, %8
br label %35
35: ; preds = %33, %29
%36 = phi i1 [ %30, %29 ], [ %34, %33 ]
%37 = zext i1 %36 to i32
br label %38
38: ; preds = %35, %15
%39 = phi i32 [ 1, %15 ], [ %37, %35 ]
ret i32 %39
}