#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*/ decomment_file(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ *stdin;
int decomment_files(int argc, char *argv[]) {
  int result = 0;
  if (argc == 1) {
    decomment_file("stdin", stdin);
  } else {
    while (argc > 1) {
      FILE *f;
      if ((f = fopen(argv[1], "r")) == NULL) {
        result = 2;
        perror(argv[1]);
      } else {
        decomment_file(argv[1], f);
        fclose(f);
      }
      argc -= (1);
      argv += (1);
    }
  }
  return result;
}


x86 assembly (clang, -O0):
<decomment_files>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    117b <decomment_files+0x3b>
mov    0x2e81(%rip),%rax
mov    (%rax),%rsi
lea    0xe8f(%rip),%rdi
call   1060 <decomment_file@plt>
jmp    11fe <decomment_files+0xbe>
jmp    1180 <decomment_files+0x40>
cmpl   $0x1,-0x4(%rbp)
jle    11f9 <decomment_files+0xb9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe6d(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    11c5 <decomment_files+0x85>
movl   $0x2,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <perror@plt>
jmp    11df <decomment_files+0x9f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x20(%rbp),%rsi
call   1060 <decomment_file@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1180 <decomment_files+0x40>
jmp    11fe <decomment_files+0xbe>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decomment_files>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    $0x1,%edi
jne    1168 <decomment_files+0x28>
mov    0x2e94(%rip),%rax
mov    (%rax),%rsi
lea    0xea2(%rip),%rdi
call   1060 <decomment_file@plt>
xor    %r14d,%r14d
jmp    11d3 <decomment_files+0x93>
mov    %edi,%r12d
xor    %r14d,%r14d
cmp    $0x2,%edi
jl     11d3 <decomment_files+0x93>
mov    %rsi,%rbx
add    $0x1,%r12d
add    $0x8,%rbx
xor    %r14d,%r14d
lea    0xe7e(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%rdi
mov    %r15,%rsi
call   1040 <fopen@plt>
mov    (%rbx),%rdi
test   %rax,%rax
je     11c6 <decomment_files+0x86>
mov    %rax,%rbp
mov    %rax,%rsi
call   1060 <decomment_file@plt>
mov    %rbp,%rdi
call   1030 <fclose@plt>
add    $0xffffffff,%r12d
add    $0x8,%rbx
cmp    $0x2,%r12d
jg     1190 <decomment_files+0x50>
jmp    11d3 <decomment_files+0x93>
call   1050 <perror@plt>
mov    $0x2,%r14d
jmp    11b6 <decomment_files+0x76>
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"stdin\00"
@stdin = global i32* null
@.str.1 = [2 x i8] c"r\00"
define i32 @decomment_files(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32*
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 0, i32* %5
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i32*, i32** @stdin
%11 = call i32 @decomment_file(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %10)
br label %41
12: ; preds = %2
br label %13
13: ; preds = %35, %12
%14 = load i32, i32* %3
%15 = icmp sgt i32 %14, 1
br i1 %15, label %16, label %40
16: ; preds = %13
%17 = load i8**, i8*** %4
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32* @fopen(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %20, i32** %6
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %27
22: ; preds = %16
store i32 2, i32* %5
%23 = load i8**, i8*** %4
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 @perror(i8* %25)
br label %35
27: ; preds = %16
%28 = load i8**, i8*** %4
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = load i32*, i32** %6
%32 = call i32 @decomment_file(i8* %30, i32* %31)
%33 = load i32*, i32** %6
%34 = call i32 @fclose(i32* %33)
br label %35
35: ; preds = %27, %22
%36 = load i32, i32* %3
%37 = sub nsw i32 %36, 1
store i32 %37, i32* %3
%38 = load i8**, i8*** %4
%39 = getelementptr inbounds i8*, i8** %38, i64 1
store i8** %39, i8*** %4
br label %13
40: ; preds = %13
br label %41
41: ; preds = %40, %9
%42 = load i32, i32* %5
ret i32 %42
}

LLVM IR (-O2):
@.str = [6 x i8] c"stdin\00"
@stdin = global i32* null
@.str.1 = [2 x i8] c"r\00"
define i32 @decomment_files(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = icmp sgt i32 %0, 1
br i1 %5, label %9, label %27
6: ; preds = %2
%7 = load i32*, i32** @stdin
%8 = tail call i32 @decomment_file(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %7)
br label %27
9: ; preds = %4, %23
%10 = phi i32 [ %25, %23 ], [ %0, %4 ]
%11 = phi i32 [ %24, %23 ], [ 0, %4 ]
%12 = phi i8** [ %13, %23 ], [ %1, %4 ]
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i32* %15, null
%17 = load i8*, i8** %13
br i1 %16, label %18, label %20
18: ; preds = %9
%19 = tail call i32 @perror(i8* %17)
br label %23
20: ; preds = %9
%21 = tail call i32 @decomment_file(i8* %17, i32* %15)
%22 = tail call i32 @fclose(i32* %15)
br label %23
23: ; preds = %20, %18
%24 = phi i32 [ 2, %18 ], [ %11, %20 ]
%25 = add nsw i32 %10, -1
%26 = icmp sgt i32 %10, 2
br i1 %26, label %9, label %27
27: ; preds = %23, %4, %6
%28 = phi i32 [ 0, %6 ], [ 0, %4 ], [ %24, %23 ]
ret i32 %28
}