#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*/ fprintf(int /*<<< orphan*/, char *, int, int, int, int, int,
                           int, int);
int rb(int);
int skipdata(int, int);
int /*<<< orphan*/ stderr;
int print_jfif() {
  int major, minor, density, x, y, r, tx, ty;
  r = rb(1);
  if (r == -1)
    return -1;
  major = rb(1);
  if (major == -1)
    return -1;
  minor = rb(1);
  if (minor == -1)
    return -1;
  density = rb(1);
  if (density == -1)
    return -1;
  x = rb(1);
  if (x == -1)
    return -1;
  r = rb(1);
  if (r == -1)
    return -1;
  x = (x << 8) | r;
  y = rb(1);
  if (y == -1)
    return -1;
  r = rb(1);
  if (r == -1)
    return -1;
  y = (y << 8) | r;
  tx = rb(1);
  if (tx == -1)
    return -1;
  ty = rb(1);
  if (ty == -1)
    return -1;
  fprintf(stderr, "JFIF v%d.%d, dens %d, %dx%d, tn %dx%d\n", major, minor,
          density, x, y, tx, ty);
  return skipdata(tx * ty * 3, 1);
}


x86 assembly (clang, -O0):
<print_jfif>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    $0x1,%edi
call   1050 <rb@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    115b <print_jfif+0x2b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1300 <print_jfif+0x1d0>
mov    $0x1,%edi
call   1050 <rb@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    117e <print_jfif+0x4e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1300 <print_jfif+0x1d0>
mov    $0x1,%edi
call   1050 <rb@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    11a1 <print_jfif+0x71>
movl   $0xffffffff,-0x4(%rbp)
jmp    1300 <print_jfif+0x1d0>
mov    $0x1,%edi
call   1050 <rb@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0xffffffff,-0x10(%rbp)
jne    11c4 <print_jfif+0x94>
movl   $0xffffffff,-0x4(%rbp)
jmp    1300 <print_jfif+0x1d0>
mov    $0x1,%edi
call   1050 <rb@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    11e7 <print_jfif+0xb7>
movl   $0xffffffff,-0x4(%rbp)
jmp    1300 <print_jfif+0x1d0>
mov    $0x1,%edi
call   1050 <rb@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    120a <print_jfif+0xda>
movl   $0xffffffff,-0x4(%rbp)
jmp    1300 <print_jfif+0x1d0>
mov    -0x14(%rbp),%eax
shl    $0x8,%eax
or     -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x1,%edi
call   1050 <rb@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    1239 <print_jfif+0x109>
movl   $0xffffffff,-0x4(%rbp)
jmp    1300 <print_jfif+0x1d0>
mov    $0x1,%edi
call   1050 <rb@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    125c <print_jfif+0x12c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1300 <print_jfif+0x1d0>
mov    -0x18(%rbp),%eax
shl    $0x8,%eax
or     -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    $0x1,%edi
call   1050 <rb@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0xffffffff,-0x20(%rbp)
jne    128b <print_jfif+0x15b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1300 <print_jfif+0x1d0>
mov    $0x1,%edi
call   1050 <rb@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
jne    12ae <print_jfif+0x17e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1300 <print_jfif+0x1d0>
mov    0x2d2b(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0x14(%rbp),%r9d
mov    -0x18(%rbp),%r11d
mov    -0x20(%rbp),%r10d
mov    -0x24(%rbp),%eax
lea    0xd29(%rip),%rsi
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1040 <fprintf@plt>
mov    -0x20(%rbp),%eax
imul   -0x24(%rbp),%eax
imul   $0x3,%eax,%edi
mov    $0x1,%esi
call   1030 <skipdata@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_jfif>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    $0x1,%edi
call   1050 <rb@plt>
cmp    $0xffffffff,%eax
je     1272 <print_jfif+0x142>
mov    $0x1,%edi
call   1050 <rb@plt>
cmp    $0xffffffff,%eax
je     1272 <print_jfif+0x142>
mov    %eax,%ebx
mov    $0x1,%edi
call   1050 <rb@plt>
cmp    $0xffffffff,%eax
je     1272 <print_jfif+0x142>
mov    %eax,%ebp
mov    $0x1,%edi
call   1050 <rb@plt>
cmp    $0xffffffff,%eax
je     1272 <print_jfif+0x142>
mov    %eax,%r14d
mov    $0x1,%edi
call   1050 <rb@plt>
cmp    $0xffffffff,%eax
je     1272 <print_jfif+0x142>
mov    %eax,%r12d
mov    $0x1,%edi
call   1050 <rb@plt>
cmp    $0xffffffff,%eax
je     1272 <print_jfif+0x142>
mov    %eax,%r15d
mov    $0x1,%edi
call   1050 <rb@plt>
cmp    $0xffffffff,%eax
je     1272 <print_jfif+0x142>
mov    %eax,%r13d
mov    $0x1,%edi
call   1050 <rb@plt>
mov    %rax,0x10(%rsp)
cmp    $0xffffffff,%eax
je     1272 <print_jfif+0x142>
mov    $0x1,%edi
call   1050 <rb@plt>
mov    %rax,0x8(%rsp)
cmp    $0xffffffff,%eax
je     1272 <print_jfif+0x142>
mov    $0x1,%edi
call   1050 <rb@plt>
cmp    $0xffffffff,%eax
je     1272 <print_jfif+0x142>
shl    $0x8,%r12d
or     %r12d,%r15d
shl    $0x8,%r13d
mov    0x10(%rsp),%r10
or     %r13d,%r10d
mov    0x2db8(%rip),%rcx
mov    (%rcx),%edi
sub    $0x8,%rsp
lea    0xdcb(%rip),%rsi
mov    %ebx,%edx
mov    %ebp,%ecx
mov    %r14d,%r8d
mov    %r15d,%r9d
push   %rax
mov    0x18(%rsp),%rbx
push   %rbx
push   %r10
mov    %rax,%rbp
call   1040 <fprintf@plt>
add    $0x20,%rsp
imul   %ebp,%ebx
lea    (%rbx,%rbx,2),%edi
mov    $0x1,%esi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <skipdata@plt>
mov    $0xffffffff,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [39 x i8] c"JFIF v%d.%d, dens %d, %dx%d, tn %dx%d\0A\00"
define i32 @print_jfif() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = call i32 @rb(i32 1)
store i32 %10, i32* %7
%11 = load i32, i32* %7
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %14
13: ; preds = %0
store i32 -1, i32* %1
br label %82
14: ; preds = %0
%15 = call i32 @rb(i32 1)
store i32 %15, i32* %2
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %19
18: ; preds = %14
store i32 -1, i32* %1
br label %82
19: ; preds = %14
%20 = call i32 @rb(i32 1)
store i32 %20, i32* %3
%21 = load i32, i32* %3
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %24
23: ; preds = %19
store i32 -1, i32* %1
br label %82
24: ; preds = %19
%25 = call i32 @rb(i32 1)
store i32 %25, i32* %4
%26 = load i32, i32* %4
%27 = icmp eq i32 %26, -1
br i1 %27, label %28, label %29
28: ; preds = %24
store i32 -1, i32* %1
br label %82
29: ; preds = %24
%30 = call i32 @rb(i32 1)
store i32 %30, i32* %5
%31 = load i32, i32* %5
%32 = icmp eq i32 %31, -1
br i1 %32, label %33, label %34
33: ; preds = %29
store i32 -1, i32* %1
br label %82
34: ; preds = %29
%35 = call i32 @rb(i32 1)
store i32 %35, i32* %7
%36 = load i32, i32* %7
%37 = icmp eq i32 %36, -1
br i1 %37, label %38, label %39
38: ; preds = %34
store i32 -1, i32* %1
br label %82
39: ; preds = %34
%40 = load i32, i32* %5
%41 = shl i32 %40, 8
%42 = load i32, i32* %7
%43 = or i32 %41, %42
store i32 %43, i32* %5
%44 = call i32 @rb(i32 1)
store i32 %44, i32* %6
%45 = load i32, i32* %6
%46 = icmp eq i32 %45, -1
br i1 %46, label %47, label %48
47: ; preds = %39
store i32 -1, i32* %1
br label %82
48: ; preds = %39
%49 = call i32 @rb(i32 1)
store i32 %49, i32* %7
%50 = load i32, i32* %7
%51 = icmp eq i32 %50, -1
br i1 %51, label %52, label %53
52: ; preds = %48
store i32 -1, i32* %1
br label %82
53: ; preds = %48
%54 = load i32, i32* %6
%55 = shl i32 %54, 8
%56 = load i32, i32* %7
%57 = or i32 %55, %56
store i32 %57, i32* %6
%58 = call i32 @rb(i32 1)
store i32 %58, i32* %8
%59 = load i32, i32* %8
%60 = icmp eq i32 %59, -1
br i1 %60, label %61, label %62
61: ; preds = %53
store i32 -1, i32* %1
br label %82
62: ; preds = %53
%63 = call i32 @rb(i32 1)
store i32 %63, i32* %9
%64 = load i32, i32* %9
%65 = icmp eq i32 %64, -1
br i1 %65, label %66, label %67
66: ; preds = %62
store i32 -1, i32* %1
br label %82
67: ; preds = %62
%68 = load i32, i32* @stderr
%69 = load i32, i32* %2
%70 = load i32, i32* %3
%71 = load i32, i32* %4
%72 = load i32, i32* %5
%73 = load i32, i32* %6
%74 = load i32, i32* %8
%75 = load i32, i32* %9
%76 = call i32 @fprintf(i32 %68, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %69, i32 %70, i32 %71, i32 %72, i32 %73, i32 %74, i32 %75)
%77 = load i32, i32* %8
%78 = load i32, i32* %9
%79 = mul nsw i32 %77, %78
%80 = mul nsw i32 %79, 3
%81 = call i32 @skipdata(i32 %80, i32 1)
store i32 %81, i32* %1
br label %82
82: ; preds = %67, %66, %61, %52, %47, %38, %33, %28, %23, %18, %13
%83 = load i32, i32* %1
ret i32 %83
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [39 x i8] c"JFIF v%d.%d, dens %d, %dx%d, tn %dx%d\0A\00"
define i32 @print_jfif() {
%1 = tail call i32 @rb(i32 1)
%2 = icmp eq i32 %1, -1
br i1 %2, label %40, label %3
3: ; preds = %0
%4 = tail call i32 @rb(i32 1)
%5 = icmp eq i32 %4, -1
br i1 %5, label %40, label %6
6: ; preds = %3
%7 = tail call i32 @rb(i32 1)
%8 = icmp eq i32 %7, -1
br i1 %8, label %40, label %9
9: ; preds = %6
%10 = tail call i32 @rb(i32 1)
%11 = icmp eq i32 %10, -1
br i1 %11, label %40, label %12
12: ; preds = %9
%13 = tail call i32 @rb(i32 1)
%14 = icmp eq i32 %13, -1
br i1 %14, label %40, label %15
15: ; preds = %12
%16 = tail call i32 @rb(i32 1)
%17 = icmp eq i32 %16, -1
br i1 %17, label %40, label %18
18: ; preds = %15
%19 = shl i32 %13, 8
%20 = or i32 %16, %19
%21 = tail call i32 @rb(i32 1)
%22 = icmp eq i32 %21, -1
br i1 %22, label %40, label %23
23: ; preds = %18
%24 = tail call i32 @rb(i32 1)
%25 = icmp eq i32 %24, -1
br i1 %25, label %40, label %26
26: ; preds = %23
%27 = shl i32 %21, 8
%28 = or i32 %24, %27
%29 = tail call i32 @rb(i32 1)
%30 = icmp eq i32 %29, -1
br i1 %30, label %40, label %31
31: ; preds = %26
%32 = tail call i32 @rb(i32 1)
%33 = icmp eq i32 %32, -1
br i1 %33, label %40, label %34
34: ; preds = %31
%35 = load i32, i32* @stderr
%36 = tail call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %7, i32 %10, i32 %20, i32 %28, i32 %29, i32 %32)
%37 = mul i32 %29, 3
%38 = mul i32 %37, %32
%39 = tail call i32 @skipdata(i32 %38, i32 1)
br label %40
40: ; preds = %31, %26, %23, %18, %15, %12, %9, %6, %3, %0, %34
%41 = phi i32 [ %39, %34 ], [ -1, %0 ], [ -1, %3 ], [ -1, %6 ], [ -1, %9 ], [ -1, %12 ], [ -1, %15 ], [ -1, %18 ], [ -1, %23 ], [ -1, %26 ], [ -1, %31 ]
ret i32 %41
}