#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*/ EXIT_SUCCESS;
int atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
scalar_t__ strncmp(char *, char *, int);
int main(int argc, char **argv) {
  int wide = 1;
  int dpi = 96;
  int tinynum = 0;
  int i;
  int bitarray[0x10000][16];
  void gethex();
  void genlongbmp();
  void genwidebmp();
  memset((void *)bitarray, 0, 0x10000 * 16 * sizeof(int));
  gethex(bitarray);
  if (argc > 1) {
    for (i = 1; i < argc; i++) {
      if (strncmp(argv[i], "-l", 2) == 0) {
        wide = 0;
      } else if (strncmp(argv[i], "-d", 2) == 0) {
        dpi = atoi(&argv[i][2]);
      } else if (strncmp(argv[i], "-t", 2) == 0) {
        tinynum = 1;
      }
    }
  }
  if (wide) {
    genwidebmp(bitarray, dpi, tinynum);
  } else {
    genlongbmp(bitarray, dpi, tinynum);
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400020,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x60,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    -0x400020(%rbp),%rdi
xor    %esi,%esi
mov    $0x400000,%edx
call   1050 <memset@plt>
lea    -0x400020(%rbp),%rdi
mov    $0x0,%al
call   1080 <gethex@plt>
cmpl   $0x1,-0x8(%rbp)
jle    12a3 <main+0x133>
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    129e <main+0x12e>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe11(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    120f <main+0x9f>
movl   $0x0,-0x14(%rbp)
jmp    128b <main+0x11b>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xde1(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1253 <main+0xe3>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
add    $0x2,%rdi
call   1070 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    1286 <main+0x116>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xda0(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1281 <main+0x111>
movl   $0x1,-0x1c(%rbp)
jmp    1286 <main+0x116>
jmp    128b <main+0x11b>
jmp    1290 <main+0x120>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11d0 <main+0x60>
jmp    12a3 <main+0x133>
cmpl   $0x0,-0x14(%rbp)
je     12c6 <main+0x156>
lea    -0x400020(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    $0x0,%al
call   1060 <genwidebmp@plt>
jmp    12da <main+0x16a>
lea    -0x400020(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    $0x0,%al
call   1040 <genlongbmp@plt>
mov    0x2cff(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x400018,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0x10(%rsp),%r14
xor    %r15d,%r15d
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x400000,%edx
call   1050 <memset@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1080 <gethex@plt>
mov    $0x60,%esi
cmp    $0x2,%ebp
jl     1299 <main+0x129>
mov    %ebp,%r14d
lea    -0x1(%r14),%r13
movl   $0x60,0x8(%rsp)
xor    %r15d,%r15d
mov    $0x1,%r12d
lea    0xe2c(%rip),%rbp
movl   $0x1,0xc(%rsp)
jmp    120a <main+0x9a>
xchg   %ax,%ax
lea    0xe1f(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
mov    $0x1,%eax
cmove  %eax,%r15d
add    $0x1,%r12
cmp    %r14,%r12
je     128e <main+0x11e>
mov    (%rbx,%r12,8),%rdi
mov    %rbp,%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1248 <main+0xd8>
cmp    %r12,%r13
je     1279 <main+0x109>
mov    0x8(%rbx,%r12,8),%rdi
mov    %rbp,%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
add    $0x1,%r12
test   %rax,%rax
je     1220 <main+0xb0>
movl   $0x0,0xc(%rsp)
mov    (%rbx,%r12,8),%rdi
lea    0xdb0(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
mov    (%rbx,%r12,8),%rdi
test   %rax,%rax
jne    11e0 <main+0x70>
add    $0x2,%rdi
call   1070 <atoi@plt>
mov    %eax,0x8(%rsp)
jmp    11fd <main+0x8d>
mov    0x8(%rsp),%esi
lea    0x10(%rsp),%rdi
mov    %r15d,%edx
xor    %eax,%eax
call   1040 <genlongbmp@plt>
jmp    12a8 <main+0x138>
cmpl   $0x0,0xc(%rsp)
mov    0x8(%rsp),%esi
je     127d <main+0x10d>
lea    0x10(%rsp),%rdi
mov    %r15d,%edx
xor    %eax,%eax
call   1060 <genwidebmp@plt>
mov    0x2d31(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-l\00"
@.str.1 = [3 x i8] c"-d\00"
@.str.2 = [3 x i8] c"-t\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [65536 x [16 x i32]]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
store i32 96, i32* %7
store i32 0, i32* %8
%11 = getelementptr inbounds [65536 x [16 x i32]], [65536 x [16 x i32]]* %10, i64 0, i64 0
%12 = bitcast [16 x i32]* %11 to i8*
%13 = call i32 @memset(i8* %12, i32 0, i32 4194304)
%14 = getelementptr inbounds [65536 x [16 x i32]], [65536 x [16 x i32]]* %10, i64 0, i64 0
%15 = load i32, i32* %4
%16 = icmp sgt i32 %15, 1
br i1 %16, label %17, label %63
17: ; preds = %2
store i32 1, i32* %9
br label %18
18: ; preds = %59, %17
%19 = load i32, i32* %9
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %62
22: ; preds = %18
%23 = load i8**, i8*** %5
%24 = load i32, i32* %9
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
%27 = load i8*, i8** %26
%28 = call i64 @strncmp(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %22
store i32 0, i32* %6
br label %58
31: ; preds = %22
%32 = load i8**, i8*** %5
%33 = load i32, i32* %9
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %32, i64 %34
%36 = load i8*, i8** %35
%37 = call i64 @strncmp(i8* %36, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %47
39: ; preds = %31
%40 = load i8**, i8*** %5
%41 = load i32, i32* %9
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %40, i64 %42
%44 = load i8*, i8** %43
%45 = getelementptr inbounds i8, i8* %44, i64 2
%46 = call i32 @atoi(i8* %45)
store i32 %46, i32* %7
br label %57
47: ; preds = %31
%48 = load i8**, i8*** %5
%49 = load i32, i32* %9
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8*, i8** %48, i64 %50
%52 = load i8*, i8** %51
%53 = call i64 @strncmp(i8* %52, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %56
55: ; preds = %47
store i32 1, i32* %8
br label %56
56: ; preds = %55, %47
br label %57
57: ; preds = %56, %39
br label %58
58: ; preds = %57, %30
br label %59
59: ; preds = %58
%60 = load i32, i32* %9
%61 = add nsw i32 %60, 1
store i32 %61, i32* %9
br label %18
62: ; preds = %18
br label %63
63: ; preds = %62, %2
%64 = load i32, i32* %6
%65 = icmp ne i32 %64, 0
br i1 %65, label %66, label %70
66: ; preds = %63
%67 = getelementptr inbounds [65536 x [16 x i32]], [65536 x [16 x i32]]* %10, i64 0, i64 0
%68 = load i32, i32* %7
%69 = load i32, i32* %8
br label %74
70: ; preds = %63
%71 = getelementptr inbounds [65536 x [16 x i32]], [65536 x [16 x i32]]* %10, i64 0, i64 0
%72 = load i32, i32* %7
%73 = load i32, i32* %8
br label %74
74: ; preds = %70, %66
%75 = load i32, i32* @EXIT_SUCCESS
%76 = call i32 @exit(i32 %75)
unreachable
}

LLVM IR (-O2):
@.str = [3 x i8] c"-l\00"
@.str.1 = [3 x i8] c"-d\00"
@.str.2 = [3 x i8] c"-t\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [65536 x [16 x i32]]
%4 = bitcast [65536 x [16 x i32]]* %3 to i8*
%5 = getelementptr inbounds [65536 x [16 x i32]], [65536 x [16 x i32]]* %3, i64 0, i64 0
%6 = call i32 @memset(i8* %4, i32 0, i32 4194304)
%7 = icmp sgt i32 %0, 1
br i1 %7, label %8, label %50
8: ; preds = %2
%9 = zext i32 %0 to i64
br label %10
10: ; preds = %39, %8
%11 = phi i64 [ %42, %39 ], [ 1, %8 ]
%12 = phi i32 [ %41, %39 ], [ 0, %8 ]
%13 = phi i32 [ %40, %39 ], [ 96, %8 ]
%14 = phi i32 [ %26, %39 ], [ 1, %8 ]
%15 = getelementptr inbounds i8*, i8** %1, i64 %11
%16 = load i8*, i8** %15
%17 = call i64 @strncmp(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%18 = icmp eq i64 %17, 0
br i1 %18, label %44, label %24
19: ; preds = %44
%20 = getelementptr inbounds i8*, i8** %1, i64 %46
%21 = load i8*, i8** %20
%22 = call i64 @strncmp(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%23 = icmp eq i64 %22, 0
br i1 %23, label %44, label %24
24: ; preds = %19, %10
%25 = phi i64 [ %11, %10 ], [ %46, %19 ]
%26 = phi i32 [ %14, %10 ], [ 0, %19 ]
%27 = getelementptr inbounds i8*, i8** %1, i64 %25
%28 = load i8*, i8** %27
%29 = call i64 @strncmp(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%30 = icmp eq i64 %29, 0
%31 = load i8*, i8** %27
br i1 %30, label %32, label %35
32: ; preds = %24
%33 = getelementptr inbounds i8, i8* %31, i64 2
%34 = call i32 @atoi(i8* %33)
br label %39
35: ; preds = %24
%36 = call i64 @strncmp(i8* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
%37 = icmp eq i64 %36, 0
%38 = select i1 %37, i32 1, i32 %12
br label %39
39: ; preds = %35, %32
%40 = phi i32 [ %34, %32 ], [ %13, %35 ]
%41 = phi i32 [ %12, %32 ], [ %38, %35 ]
%42 = add nuw nsw i64 %25, 1
%43 = icmp eq i64 %42, %9
br i1 %43, label %48, label %10
44: ; preds = %10, %19
%45 = phi i64 [ %46, %19 ], [ %11, %10 ]
%46 = add nuw nsw i64 %45, 1
%47 = icmp eq i64 %46, %9
br i1 %47, label %53, label %19
48: ; preds = %39
%49 = icmp eq i32 %26, 0
br i1 %49, label %53, label %50
50: ; preds = %2, %48
%51 = phi i32 [ %41, %48 ], [ 0, %2 ]
%52 = phi i32 [ %40, %48 ], [ 96, %2 ]
br label %56
53: ; preds = %44, %48
%54 = phi i32 [ %40, %48 ], [ %13, %44 ]
%55 = phi i32 [ %41, %48 ], [ %12, %44 ]
br label %56
56: ; preds = %53, %50
%57 = load i32, i32* @EXIT_SUCCESS
%58 = call i32 @exit(i32 %57)
unreachable
}