#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*/ printf(char *);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ write_math();
int /*<<< orphan*/ write_rtti(char const *, char const *);
int main(int argc, char **argv) {
  if (argc < 3 || argc > 4) {
    printf("Wrong number of args\n");
    return 1;
  }
  const char *src_file = argv[1];
  const char *dst_file = argv[2];
  int rtti_only = argc == 4 && !strcmp(argv[3], "rtti_only");
  if (!rtti_only)
    write_math();
  write_rtti(src_file, dst_file);
  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)
cmpl   $0x3,-0x8(%rbp)
jl     116a <main+0x2a>
cmpl   $0x4,-0x8(%rbp)
jle    1182 <main+0x42>
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11f8 <main+0xb8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
cmpl   $0x4,-0x8(%rbp)
mov    %al,-0x25(%rbp)
jne    11c8 <main+0x88>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xe5e(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    11e4 <main+0xa4>
mov    $0x0,%al
call   1060 <write_math@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <write_rtti@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    -0x5(%rdi),%eax
cmp    $0xfffffffd,%eax
ja     115f <main+0x1f>
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
jmp    1194 <main+0x54>
mov    0x8(%rsi),%rbx
mov    0x10(%rsi),%r14
cmp    $0x4,%edi
jne    1180 <main+0x40>
mov    0x18(%rsi),%rdi
lea    0xe89(%rip),%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1187 <main+0x47>
xor    %eax,%eax
call   1060 <write_math@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <write_rtti@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Wrong number of args\0A\00"
@.str.1 = [10 x i8] c"rtti_only\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 3
br i1 %10, label %14, label %11
11: ; preds = %2
%12 = load i32, i32* %4
%13 = icmp sgt i32 %12, 4
br i1 %13, label %14, label %16
14: ; preds = %11, %2
%15 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %43
16: ; preds = %11
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
store i8* %19, i8** %6
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
store i8* %22, i8** %7
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 4
br i1 %24, label %25, label %32
25: ; preds = %16
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 3
%28 = load i8*, i8** %27
%29 = call i32 @strcmp(i8* %28, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%30 = icmp ne i32 %29, 0
%31 = xor i1 %30, true
br label %32
32: ; preds = %25, %16
%33 = phi i1 [ false, %16 ], [ %31, %25 ]
%34 = zext i1 %33 to i32
store i32 %34, i32* %8
%35 = load i32, i32* %8
%36 = icmp ne i32 %35, 0
br i1 %36, label %39, label %37
37: ; preds = %32
%38 = call i32 (...) @write_math()
br label %39
39: ; preds = %37, %32
%40 = load i8*, i8** %6
%41 = load i8*, i8** %7
%42 = call i32 @write_rtti(i8* %40, i8* %41)
store i32 0, i32* %3
br label %43
43: ; preds = %39, %14
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"rtti_only\00"
@str = [21 x i8] c"Wrong number of args\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = add i32 %0, -5
%4 = icmp ult i32 %3, -2
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
br label %22
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = icmp eq i32 %0, 4
br i1 %12, label %13, label %18
13: ; preds = %7
%14 = getelementptr inbounds i8*, i8** %1, i64 3
%15 = load i8*, i8** %14
%16 = tail call i32 @strcmp(i8* dereferenceable(1) %15, i8* dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %7, %13
%19 = tail call i32 (...) @write_math()
br label %20
20: ; preds = %18, %13
%21 = tail call i32 @write_rtti(i8* %9, i8* %11)
br label %22
22: ; preds = %20, %5
%23 = phi i32 [ 1, %5 ], [ 0, %20 ]
ret i32 %23
}