#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 EOF;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ dec2bin(int, char *);
scalar_t__ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, char *);
char *strerror(scalar_t__);
int main(int argc, char *argv[]) {
  FILE *fp;
  int c, i;
  char rbn[] = "0000000";
  if (argc != 2) {
    printf("Usage: %s <file>\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  errno = 0;
  fp = fopen(argv[1], "r");
  if (fp == NULL) {
    fprintf(stderr, "%s: Couldn't open file %s; %s\n", argv[0], argv[1],
            strerror(errno));
    exit(EXIT_FAILURE);
  }
  while ((c = fgetc(fp)) != EOF) {
    dec2bin(c, rbn);
    printf("   ");
    for (i = 6; i >= 0; i--)
      printf("%s", rbn[i] == '0' ? " " : "\t");
    printf("\n\t\n  ");
    strcpy(rbn, "0000000");
  }
  printf("\n\n\n");
  fclose(fp);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xe53(%rip),%rax
mov    %rax,-0x28(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11de <main+0x4e>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2df1(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    0x2deb(%rip),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe1f(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1269 <main+0xd9>
mov    0x2dc2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    0x2d97(%rip),%rax
mov    (%rax),%rdi
call   10b0 <strerror@plt>
mov    -0x3c(%rbp),%edi
mov    -0x38(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    %rax,%r8
lea    0xdc6(%rip),%rsi
call   1070 <fprintf@plt>
mov    0x2d66(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
jmp    126e <main+0xde>
mov    -0x18(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2d67(%rip),%rcx
cmp    (%rcx),%eax
je     1311 <main+0x181>
mov    -0x1c(%rbp),%edi
lea    -0x28(%rbp),%rsi
call   1080 <dec2bin@plt>
lea    0xd9f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x6,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jl     12ee <main+0x15e>
movslq -0x20(%rbp),%rax
movsbl -0x28(%rbp,%rax,1),%ecx
lea    0xd7e(%rip),%rsi
lea    0xd7d(%rip),%rax
cmp    $0x30,%ecx
cmove  %rax,%rsi
lea    0xd66(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    12aa <main+0x11a>
lea    0xd4f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x28(%rbp),%rdi
lea    0xcf9(%rip),%rsi
call   1030 <strcpy@plt>
jmp    126e <main+0xde>
lea    0xd32(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    0x2c91(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
movabs $0x30303030303030,%rax
mov    %rax,(%rsp)
cmp    $0x2,%edi
jne    1219 <main+0x79>
mov    0x2e08(%rip),%rbp
movq   $0x0,0x0(%rbp)
mov    0x8(%rbx),%rdi
lea    0xe37(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
jne    1238 <main+0x98>
mov    0x2dec(%rip),%rax
mov    (%rax),%r15d
mov    (%rbx),%r14
mov    0x8(%rbx),%rbx
mov    0x0(%rbp),%rdi
call   10c0 <strerror@plt>
lea    0xe0e(%rip),%rsi
mov    %r15d,%edi
mov    %r14,%rdx
mov    %rbx,%rcx
mov    %rax,%r8
call   1080 <fprintf@plt>
jmp    122a <main+0x8a>
mov    (%rbx),%rsi
lea    0xddd(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2d97(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1070 <fgetc@plt>
mov    0x2d9e(%rip),%rbp
cmp    0x0(%rbp),%eax
je     134f <main+0x1af>
mov    %rsp,%r12
lea    0xde3(%rip),%r15
lea    0xdd6(%rip),%r13
lea    0xdcc(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %eax,%edi
mov    %r12,%rsi
call   1090 <dec2bin@plt>
lea    0xdb2(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmpb   $0x30,0x6(%rsp)
mov    %r13,%rsi
cmove  %r15,%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmpb   $0x30,0x5(%rsp)
mov    %r13,%rsi
cmove  %r15,%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmpb   $0x30,0x4(%rsp)
mov    %r13,%rsi
cmove  %r15,%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmpb   $0x30,0x3(%rsp)
mov    %r13,%rsi
cmove  %r15,%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmpb   $0x30,0x2(%rsp)
mov    %r13,%rsi
cmove  %r15,%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmpb   $0x30,0x1(%rsp)
mov    %r13,%rsi
cmove  %r15,%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmpb   $0x30,(%rsp)
mov    %r13,%rsi
cmove  %r15,%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd14(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12,%rdi
lea    0xd09(%rip),%rsi
call   1030 <strcpy@plt>
mov    %r14,%rdi
call   1070 <fgetc@plt>
cmp    0x0(%rbp),%eax
jne    1270 <main+0xd0>
lea    0xcf4(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    0x2c56(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@__const.main.rbn = [8 x i8] c"0000000\00"
@.str = [18 x i8] c"Usage: %s <file>\0A\00"
@EXIT_FAILURE = global i32 0
@errno = global i64 0
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [31 x i8] c"%s: Couldn't open file %s; %s\0A\00"
@EOF = global i32 0
@.str.3 = [4 x i8] c" \00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [2 x i8] c" \00"
@.str.6 = [2 x i8] c"\09\00"
@.str.7 = [6 x i8] c"\0A\09\0A \00"
@.str.8 = [8 x i8] c"0000000\00"
@.str.9 = [4 x i8] c"\0A\0A\0A\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 [8 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [8 x i8]* %9 to i8*
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 2
br i1 %12, label %13, label %20
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %2
store i64 0, i64* @errno
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32* @fopen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %24, i32** %6
%25 = load i32*, i32** %6
%26 = icmp eq i32* %25, null
br i1 %26, label %27, label %40
27: ; preds = %20
%28 = load i32, i32* @stderr
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 0
%31 = load i8*, i8** %30
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = load i64, i64* @errno
%36 = call i8* @strerror(i64 %35)
%37 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %31, i8* %34, i8* %36)
%38 = load i32, i32* @EXIT_FAILURE
%39 = call i32 @exit(i32 %38)
unreachable
40: ; preds = %20
br label %41
41: ; preds = %67, %40
%42 = load i32*, i32** %6
%43 = call i32 @fgetc(i32* %42)
store i32 %43, i32* %7
%44 = load i32, i32* @EOF
%45 = icmp ne i32 %43, %44
br i1 %45, label %46, label %71
46: ; preds = %41
%47 = load i32, i32* %7
%48 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%49 = call i32 @dec2bin(i32 %47, i8* %48)
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
store i32 6, i32* %8
br label %51
51: ; preds = %64, %46
%52 = load i32, i32* %8
%53 = icmp sge i32 %52, 0
br i1 %53, label %54, label %67
54: ; preds = %51
%55 = load i32, i32* %8
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 %56
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = icmp eq i32 %59, 48
%61 = zext i1 %60 to i64
%62 = select i1 %60, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0)
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %62)
br label %64
64: ; preds = %54
%65 = load i32, i32* %8
%66 = add nsw i32 %65, -1
store i32 %66, i32* %8
br label %51
67: ; preds = %51
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%69 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%70 = call i32 @strcpy(i8* %69, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
br label %41
71: ; preds = %41
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%73 = load i32*, i32** %6
%74 = call i32 @fclose(i32* %73)
%75 = load i32, i32* @EXIT_SUCCESS
%76 = call i32 @exit(i32 %75)
unreachable
}

LLVM IR (-O2):
@.str = [18 x i8] c"Usage: %s <file>\0A\00"
@EXIT_FAILURE = global i32 0
@errno = global i64 0
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [31 x i8] c"%s: Couldn't open file %s; %s\0A\00"
@EOF = global i32 0
@.str.3 = [4 x i8] c" \00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [2 x i8] c" \00"
@.str.6 = [2 x i8] c"\09\00"
@.str.7 = [6 x i8] c"\0A\09\0A \00"
@.str.8 = [8 x i8] c"0000000\00"
@EXIT_SUCCESS = global i32 0
@str = [3 x i8] c"\0A\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to [8 x i8]*
%5 = bitcast i64* %3 to i8*
store i64 13563782407139376, i64* %3
%6 = icmp eq i32 %0, 2
br i1 %6, label %12, label %7
7: ; preds = %2
%8 = load i8*, i8** %1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
12: ; preds = %2
store i64 0, i64* @errno
%13 = getelementptr inbounds i8*, i8** %1, 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
br i1 %16, label %29, label %17
17: ; preds = %12
%18 = call i32 @fgetc(i32* %15)
%19 = load i32, i32* @EOF
%20 = icmp eq i32 %18, %19
br i1 %20, label %75, label %21
21: ; preds = %17
%22 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 6
%23 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 5
%24 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 4
%25 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 3
%26 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 2
%27 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 1
%28 = bitcast i64* %3 to i8*
br label %38
29: ; preds = %12
%30 = load i32, i32* @stderr
%31 = load i8*, i8** %1
%32 = load i8*, i8** %13
%33 = load i64, i64* @errno
%34 = tail call i8* @strerror(i64 %33)
%35 = tail call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %31, i8* %32, i8* %34)
%36 = load i32, i32* @EXIT_FAILURE
%37 = tail call i32 @exit(i32 %36)
unreachable
38: ; preds = %21, %38
%39 = phi i32 [ %72, %38 ], [ %18, %21 ]
%40 = call i32 @dec2bin(i32 %39, i8* %5)
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%42 = load i8, i8* %22
%43 = icmp eq i8 %42, 48
%44 = select i1 %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0)
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %44)
%46 = load i8, i8* %23
%47 = icmp eq i8 %46, 48
%48 = select i1 %47, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0)
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %48)
%50 = load i8, i8* %24
%51 = icmp eq i8 %50, 48
%52 = select i1 %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0)
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %52)
%54 = load i8, i8* %25
%55 = icmp eq i8 %54, 48
%56 = select i1 %55, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0)
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %56)
%58 = load i8, i8* %26
%59 = icmp eq i8 %58, 48
%60 = select i1 %59, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0)
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %60)
%62 = load i8, i8* %27
%63 = icmp eq i8 %62, 48
%64 = select i1 %63, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0)
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %64)
%66 = load i8, i8* %28
%67 = icmp eq i8 %66, 48
%68 = select i1 %67, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0)
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %68)
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%71 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%72 = call i32 @fgetc(i32* %15)
%73 = load i32, i32* @EOF
%74 = icmp eq i32 %72, %73
br i1 %74, label %75, label %38
75: ; preds = %38, %17
%76 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%77 = call i32 @fclose(i32* %15)
%78 = load i32, i32* @EXIT_SUCCESS
%79 = call i32 @exit(i32 %78)
unreachable
}