#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 convertNIB2DDL(char *, char *, int);
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (argc < 3) {
    printf("usage: nib2ddl [-s] source_file target_file\n");
    return 0;
  }
  if (argc == 3)
    return convertNIB2DDL(argv[1], argv[2], 0);
  else {
    if (strcmp(argv[1], "-s") != 0)
      return 1;
    return convertNIB2DDL(argv[2], argv[3], 1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1168 <main+0x38>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11d8 <main+0xa8>
cmpl   $0x3,-0x8(%rbp)
jne    1191 <main+0x61>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
xor    %edx,%edx
call   1050 <convertNIB2DDL@plt>
mov    %eax,-0x4(%rbp)
jmp    11d8 <main+0xa8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe8d(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11bb <main+0x8b>
movl   $0x1,-0x4(%rbp)
jmp    11d8 <main+0xa8>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
mov    $0x1,%edx
call   1050 <convertNIB2DDL@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jg     1146 <main+0x16>
lea    0xec6(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    %rsi,%rbx
mov    %edi,%eax
mov    0x8(%rsi),%rdi
cmp    $0x3,%eax
jne    1160 <main+0x30>
mov    0x10(%rbx),%rsi
xor    %edx,%edx
pop    %rbx
jmp    1050 <convertNIB2DDL@plt>
lea    0xe99(%rip),%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     117b <main+0x4b>
pop    %rbx
ret
mov    0x10(%rbx),%rdi
mov    0x18(%rbx),%rsi
mov    $0x1,%edx
pop    %rbx
jmp    1050 <convertNIB2DDL@plt>

LLVM IR (-O0):
@.str = [45 x i8] c"usage: nib2ddl [-s] source_file target_file\0A\00"
@.str.1 = [3 x i8] c"-s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 3
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %36
10: ; preds = %2
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 3
br i1 %12, label %13, label %21
13: ; preds = %10
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = call i32 @convertNIB2DDL(i8* %16, i8* %19, i32 0)
store i32 %20, i32* %3
br label %36
21: ; preds = %10
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %21
store i32 1, i32* %3
br label %36
28: ; preds = %21
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 2
%31 = load i8*, i8** %30
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 3
%34 = load i8*, i8** %33
%35 = call i32 @convertNIB2DDL(i8* %31, i8* %34, i32 1)
store i32 %35, i32* %3
br label %36
36: ; preds = %28, %27, %13, %8
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"-s\00"
@str = [44 x i8] c"usage: nib2ddl [-s] source_file target_file\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
br label %23
6: ; preds = %2
%7 = icmp eq i32 %0, 3
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
br i1 %7, label %10, label %14
10: ; preds = %6
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @convertNIB2DDL(i8* %9, i8* %12, i32 0)
br label %23
14: ; preds = %6
%15 = tail call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %14
%18 = getelementptr inbounds i8*, i8** %1, i64 2
%19 = load i8*, i8** %18
%20 = getelementptr inbounds i8*, i8** %1, i64 3
%21 = load i8*, i8** %20
%22 = tail call i32 @convertNIB2DDL(i8* %19, i8* %21, i32 1)
br label %23
23: ; preds = %14, %17, %10, %4
%24 = phi i32 [ 0, %4 ], [ %13, %10 ], [ %22, %17 ], [ 1, %14 ]
ret i32 %24
}