#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 */
char *RepMkPath(char *, char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  char *Path;
  int i;
  if ((argc % 2) != 1) {
    fprintf(stderr, "Usage: %s type filename [type filename [...]]\n", argv[0]);
    exit(-1);
  }
  for (i = 1; i < argc; i += 2) {
    Path = RepMkPath(argv[i], argv[i + 1]);
    if (Path) {
      printf("%s\n", Path);
      free(Path);
    } else {
      fprintf(stderr, "ERROR: type='%s' filename='%s' invalid.\n", argv[i],
              argv[i + 1]);
    }
  }
  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)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
je     11a2 <main+0x52>
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe6f(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    124b <main+0xfb>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1060 <RepMkPath@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1204 <main+0xb4>
mov    -0x18(%rbp),%rsi
lea    0xe3e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
jmp    1238 <main+0xe8>
mov    0x2dd5(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xe02(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    123d <main+0xed>
mov    -0x1c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a9 <main+0x59>
xor    %eax,%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
mov    %rsi,%r12
mov    %edi,%eax
shr    $0x1f,%eax
add    %edi,%eax
and    $0xfffffffe,%eax
mov    %edi,%ecx
sub    %eax,%ecx
cmp    $0x1,%ecx
jne    1201 <main+0xb1>
cmp    $0x2,%edi
jl     11f0 <main+0xa0>
mov    %edi,%r13d
mov    $0x1,%ebp
lea    0xeaa(%rip),%r14
lea    0xe9f(%rip),%r15
jmp    11c5 <main+0x75>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
mov    (%r12,%rbp,8),%rdx
mov    0x8(%r12,%rbp,8),%rcx
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
add    $0x2,%rbp
cmp    %r13,%rbp
jae    11f0 <main+0xa0>
mov    (%r12,%rbp,8),%rdi
mov    0x8(%r12,%rbp,8),%rsi
call   1060 <RepMkPath@plt>
test   %rax,%rax
je     11a0 <main+0x50>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
jmp    11bc <main+0x6c>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2dd8(%rip),%rax
mov    (%rax),%edi
mov    (%r12),%rdx
lea    0xdeb(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [47 x i8] c"Usage: %s type filename [type filename [...]]\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [41 x i8] c"ERROR: type='%s' filename='%s' invalid.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = srem i32 %8, 2
%10 = icmp ne i32 %9, 1
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = call i32 @exit(i32 -1)
unreachable
18: ; preds = %2
store i32 1, i32* %7
br label %19
19: ; preds = %58, %18
%20 = load i32, i32* %7
%21 = load i32, i32* %4
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %61
23: ; preds = %19
%24 = load i8**, i8*** %5
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = load i8**, i8*** %5
%30 = load i32, i32* %7
%31 = add nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %29, i64 %32
%34 = load i8*, i8** %33
%35 = call i8* @RepMkPath(i8* %28, i8* %34)
store i8* %35, i8** %6
%36 = load i8*, i8** %6
%37 = icmp ne i8* %36, null
br i1 %37, label %38, label %43
38: ; preds = %23
%39 = load i8*, i8** %6
%40 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %39)
%41 = load i8*, i8** %6
%42 = call i32 @free(i8* %41)
br label %57
43: ; preds = %23
%44 = load i32, i32* @stderr
%45 = load i8**, i8*** %5
%46 = load i32, i32* %7
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8*, i8** %45, i64 %47
%49 = load i8*, i8** %48
%50 = load i8**, i8*** %5
%51 = load i32, i32* %7
%52 = add nsw i32 %51, 1
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8*, i8** %50, i64 %53
%55 = load i8*, i8** %54
%56 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i8* %49, i8* %55)
br label %57
57: ; preds = %43, %38
br label %58
58: ; preds = %57
%59 = load i32, i32* %7
%60 = add nsw i32 %59, 2
store i32 %60, i32* %7
br label %19
61: ; preds = %19
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [47 x i8] c"Usage: %s type filename [type filename [...]]\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [41 x i8] c"ERROR: type='%s' filename='%s' invalid.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = srem i32 %0, 2
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = icmp sgt i32 %0, 1
br i1 %6, label %7, label %34
7: ; preds = %5
%8 = zext i32 %0 to i64
br label %14
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8*, i8** %1
%12 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = tail call i32 @exit(i32 -1)
unreachable
14: ; preds = %7, %31
%15 = phi i64 [ 1, %7 ], [ %32, %31 ]
%16 = getelementptr inbounds i8*, i8** %1, i64 %15
%17 = load i8*, i8** %16
%18 = add nuw nsw i64 %15, 1
%19 = getelementptr inbounds i8*, i8** %1, i64 %18
%20 = load i8*, i8** %19
%21 = tail call i8* @RepMkPath(i8* %17, i8* %20)
%22 = icmp eq i8* %21, null
br i1 %22, label %26, label %23
23: ; preds = %14
%24 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %21)
%25 = tail call i32 @free(i8* %21)
br label %31
26: ; preds = %14
%27 = load i32, i32* @stderr
%28 = load i8*, i8** %16
%29 = load i8*, i8** %19
%30 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i8* %28, i8* %29)
br label %31
31: ; preds = %23, %26
%32 = add nuw nsw i64 %15, 2
%33 = icmp ult i64 %32, %8
br i1 %33, label %14, label %34
34: ; preds = %31, %5
ret i32 0
}