#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*/ free(char *);
long load_file(char *, char **);
int /*<<< orphan*/ printf(char *, unsigned int, unsigned char);
int main(int argc, char *argv[]) {
  char *pcnv;
  long lcnv;
  unsigned i;
  if (argc != 2)
    return 1;
  lcnv = load_file(argv[1], &pcnv);
  if (lcnv != 256)
    return 2;
  for (i = 0; i < 256; i++)
    if ((unsigned char)pcnv[i] != i)
      printf("%d %d\n", i, (unsigned char)pcnv[i]);
  free(pcnv);
  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   $0x2,-0x8(%rbp)
je     115c <main+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    11f0 <main+0xc0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <load_file@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x100,-0x20(%rbp)
je     118b <main+0x5b>
movl   $0x2,-0x4(%rbp)
jmp    11f0 <main+0xc0>
movl   $0x0,-0x24(%rbp)
cmpl   $0x100,-0x24(%rbp)
jae    11e0 <main+0xb0>
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
movzbl (%rax,%rcx,1),%eax
cmp    -0x24(%rbp),%eax
je     11cd <main+0x9d>
mov    -0x24(%rbp),%esi
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
lea    0xe3c(%rip),%rdi
movzbl (%rax,%rcx,1),%edx
call   1040 <printf@plt>
jmp    11d2 <main+0xa2>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1192 <main+0x62>
mov    -0x18(%rbp),%rdi
call   1030 <free@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
mov    $0x1,%eax
cmp    $0x2,%edi
jne    11a4 <main+0x74>
mov    0x8(%rsi),%rdi
mov    %rsp,%rsi
call   1050 <load_file@plt>
mov    %rax,%rcx
mov    $0x2,%eax
cmp    $0x100,%rcx
jne    11a4 <main+0x74>
xor    %ebx,%ebx
lea    0xe9c(%rip),%r14
jmp    117d <main+0x4d>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    $0x100,%rbx
je     1199 <main+0x69>
mov    (%rsp),%rax
movzbl (%rax,%rbx,1),%eax
cmp    %rax,%rbx
je     1170 <main+0x40>
movzbl %al,%edx
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
jmp    1170 <main+0x40>
mov    (%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i64
%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 ne i32 %9, 2
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 1, i32* %3
br label %48
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i64 @load_file(i8* %15, i8** %6)
store i64 %16, i64* %7
%17 = load i64, i64* %7
%18 = icmp ne i64 %17, 256
br i1 %18, label %19, label %20
19: ; preds = %12
store i32 2, i32* %3
br label %48
20: ; preds = %12
store i32 0, i32* %8
br label %21
21: ; preds = %42, %20
%22 = load i32, i32* %8
%23 = icmp ult i32 %22, 256
br i1 %23, label %24, label %45
24: ; preds = %21
%25 = load i8*, i8** %6
%26 = load i32, i32* %8
%27 = zext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = load i32, i32* %8
%32 = icmp ne i32 %30, %31
br i1 %32, label %33, label %41
33: ; preds = %24
%34 = load i32, i32* %8
%35 = load i8*, i8** %6
%36 = load i32, i32* %8
%37 = zext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %35, i64 %37
%39 = load i8, i8* %38
%40 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %34, i8 zeroext %39)
br label %41
41: ; preds = %33, %24
br label %42
42: ; preds = %41
%43 = load i32, i32* %8
%44 = add i32 %43, 1
store i32 %44, i32* %8
br label %21
45: ; preds = %21
%46 = load i8*, i8** %6
%47 = call i32 @free(i8* %46)
store i32 0, i32* %3
br label %48
48: ; preds = %45, %19, %11
%49 = load i32, i32* %3
ret i32 %49
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = icmp eq i32 %0, 2
br i1 %5, label %6, label %27
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = call i64 @load_file(i8* %8, i8** %3)
%10 = icmp eq i64 %9, 256
br i1 %10, label %11, label %27
11: ; preds = %6, %21
%12 = phi i64 [ %22, %21 ], [ 0, %6 ]
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i64 %12
%15 = load i8, i8* %14
%16 = zext i8 %15 to i64
%17 = icmp eq i64 %12, %16
br i1 %17, label %21, label %18
18: ; preds = %11
%19 = trunc i64 %12 to i32
%20 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %19, i8 zeroext %15)
br label %21
21: ; preds = %11, %18
%22 = add nuw nsw i64 %12, 1
%23 = icmp eq i64 %22, 256
br i1 %23, label %24, label %11
24: ; preds = %21
%25 = load i8*, i8** %3
%26 = call i32 @free(i8* %25)
br label %27
27: ; preds = %6, %2, %24
%28 = phi i32 [ 0, %24 ], [ 1, %2 ], [ 2, %6 ]
ret i32 %28
}