#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 */
scalar_t__ beq();
scalar_t__ bne();
int /*<<< orphan*/ cmp(int /*<<< orphan*/, int);
int /*<<< orphan*/ lda(int, int);
int /*<<< orphan*/ sta(int, int);
void jsr_get_sysinfo() {
  lda(0, 64);
  sta(1, 0xf7);
  lda(0, 'e');
  sta(1, 0xf0);
  lda(0, 0);
  sta(1, 0xef);
  lda(1, 0xfbb3);
  cmp(0, 0x38);
  if (bne())
    goto apple_iiplus;
  lda(0, ' ');
  sta(1, 0xf0);
  goto done_detecting;
apple_iiplus:
  cmp(0, 0xea);
  if (bne())
    goto apple_iie;
  lda(1, 0xfb1e);
  cmp(0, 0x8a);
  if (beq())
    goto apple_iii;
  lda(0, 48);
  sta(1, 0xf7);
  lda(0, '+');
  sta(1, 0xf0);
  goto done_detecting;
apple_iii:
  lda(0, 'I');
  sta(1, 0xf0);
  lda(0, 48);
  sta(1, 0xf7);
  goto done_detecting;
apple_iie:
  lda(1, 0xfbc0);
  if (beq())
    goto apple_iic;
  cmp(0, 0xe0);
  if (bne())
    goto done_detecting;
  lda(0, 1);
  sta(1, 0xef);
  lda(0, 128);
  sta(1, 0xf7);
  goto done_detecting;
apple_iic:
  lda(0, 'c');
  sta(1, 0xf0);
  lda(0, 128);
  sta(1, 0xf7);
done_detecting:;
}


x86 assembly (clang, -O0):
<jsr_get_sysinfo>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
mov    $0x40,%esi
call   1070 <lda@plt>
mov    $0x1,%edi
mov    $0xf7,%esi
call   1030 <sta@plt>
xor    %edi,%edi
mov    $0x65,%esi
call   1070 <lda@plt>
mov    $0x1,%edi
mov    $0xf0,%esi
call   1030 <sta@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1070 <lda@plt>
mov    $0x1,%edi
mov    $0xef,%esi
call   1030 <sta@plt>
mov    $0x1,%edi
mov    $0xfbb3,%esi
call   1070 <lda@plt>
xor    %edi,%edi
mov    $0x38,%esi
call   1060 <cmp@plt>
mov    $0x0,%al
call   1050 <bne@plt>
cmp    $0x0,%rax
je     11d3 <jsr_get_sysinfo+0x83>
jmp    11f3 <jsr_get_sysinfo+0xa3>
xor    %edi,%edi
mov    $0x20,%esi
call   1070 <lda@plt>
mov    $0x1,%edi
mov    $0xf0,%esi
call   1030 <sta@plt>
jmp    1374 <jsr_get_sysinfo+0x224>
xor    %edi,%edi
mov    $0xea,%esi
call   1060 <cmp@plt>
mov    $0x0,%al
call   1050 <bne@plt>
cmp    $0x0,%rax
je     1215 <jsr_get_sysinfo+0xc5>
jmp    12bc <jsr_get_sysinfo+0x16c>
mov    $0x1,%edi
mov    $0xfb1e,%esi
call   1070 <lda@plt>
xor    %edi,%edi
mov    $0x8a,%esi
call   1060 <cmp@plt>
mov    $0x0,%al
call   1040 <beq@plt>
cmp    $0x0,%rax
je     1246 <jsr_get_sysinfo+0xf6>
jmp    1281 <jsr_get_sysinfo+0x131>
xor    %edi,%edi
mov    $0x30,%esi
call   1070 <lda@plt>
mov    $0x1,%edi
mov    $0xf7,%esi
call   1030 <sta@plt>
xor    %edi,%edi
mov    $0x2b,%esi
call   1070 <lda@plt>
mov    $0x1,%edi
mov    $0xf0,%esi
call   1030 <sta@plt>
jmp    1374 <jsr_get_sysinfo+0x224>
xor    %edi,%edi
mov    $0x49,%esi
call   1070 <lda@plt>
mov    $0x1,%edi
mov    $0xf0,%esi
call   1030 <sta@plt>
xor    %edi,%edi
mov    $0x30,%esi
call   1070 <lda@plt>
mov    $0x1,%edi
mov    $0xf7,%esi
call   1030 <sta@plt>
jmp    1374 <jsr_get_sysinfo+0x224>
mov    $0x1,%edi
mov    $0xfbc0,%esi
call   1070 <lda@plt>
mov    $0x0,%al
call   1040 <beq@plt>
cmp    $0x0,%rax
je     12e1 <jsr_get_sysinfo+0x191>
jmp    133e <jsr_get_sysinfo+0x1ee>
xor    %edi,%edi
mov    $0xe0,%esi
call   1060 <cmp@plt>
mov    $0x0,%al
call   1050 <bne@plt>
cmp    $0x0,%rax
je     1303 <jsr_get_sysinfo+0x1b3>
jmp    1374 <jsr_get_sysinfo+0x224>
xor    %edi,%edi
mov    $0x1,%esi
call   1070 <lda@plt>
mov    $0x1,%edi
mov    $0xef,%esi
call   1030 <sta@plt>
xor    %edi,%edi
mov    $0x80,%esi
call   1070 <lda@plt>
mov    $0x1,%edi
mov    $0xf7,%esi
call   1030 <sta@plt>
jmp    1374 <jsr_get_sysinfo+0x224>
xor    %edi,%edi
mov    $0x63,%esi
call   1070 <lda@plt>
mov    $0x1,%edi
mov    $0xf0,%esi
call   1030 <sta@plt>
xor    %edi,%edi
mov    $0x80,%esi
call   1070 <lda@plt>
mov    $0x1,%edi
mov    $0xf7,%esi
call   1030 <sta@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<jsr_get_sysinfo>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %edi,%edi
mov    $0x40,%esi
call   1070 <lda@plt>
mov    $0x1,%edi
mov    $0xf7,%esi
call   1030 <sta@plt>
xor    %edi,%edi
mov    $0x65,%esi
call   1070 <lda@plt>
mov    $0xf0,%ebx
mov    $0x1,%edi
mov    $0xf0,%esi
call   1030 <sta@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1070 <lda@plt>
mov    $0x1,%edi
mov    $0xef,%esi
call   1030 <sta@plt>
mov    $0x1,%edi
mov    $0xfbb3,%esi
call   1070 <lda@plt>
xor    %edi,%edi
mov    $0x38,%esi
call   1060 <cmp@plt>
xor    %eax,%eax
call   1050 <bne@plt>
test   %rax,%rax
je     1225 <jsr_get_sysinfo+0xd5>
xor    %edi,%edi
mov    $0xea,%esi
call   1060 <cmp@plt>
xor    %eax,%eax
call   1050 <bne@plt>
test   %rax,%rax
je     1230 <jsr_get_sysinfo+0xe0>
mov    $0x1,%r14d
mov    $0x1,%edi
mov    $0xfbc0,%esi
call   1070 <lda@plt>
xor    %eax,%eax
call   1040 <beq@plt>
mov    $0xf7,%ebx
mov    $0x80,%r15d
test   %rax,%rax
je     1285 <jsr_get_sysinfo+0x135>
mov    $0xf0,%ebp
mov    $0x63,%r14d
jmp    12ad <jsr_get_sysinfo+0x15d>
mov    $0x20,%r15d
jmp    12c3 <jsr_get_sysinfo+0x173>
mov    $0x1,%edi
mov    $0xfb1e,%esi
call   1070 <lda@plt>
xor    %edi,%edi
mov    $0x8a,%esi
call   1060 <cmp@plt>
xor    %eax,%eax
call   1040 <beq@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    $0x30,%eax
mov    $0x49,%r14d
cmove  %eax,%r14d
mov    $0xf7,%ebx
mov    $0xf0,%ebp
cmove  %ebx,%ebp
mov    $0xf0,%eax
lea    0x2b(%rcx,%rcx,4),%r15d
cmove  %eax,%ebx
jmp    12ad <jsr_get_sysinfo+0x15d>
xor    %edi,%edi
mov    $0xe0,%esi
call   1060 <cmp@plt>
xor    %eax,%eax
call   1050 <bne@plt>
test   %rax,%rax
je     12a8 <jsr_get_sysinfo+0x158>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xef,%ebp
xor    %edi,%edi
mov    %r14d,%esi
call   1070 <lda@plt>
mov    $0x1,%edi
mov    %ebp,%esi
call   1030 <sta@plt>
xor    %edi,%edi
mov    %r15d,%esi
call   1070 <lda@plt>
mov    $0x1,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <sta@plt>

LLVM IR (-O0):
define void @jsr_get_sysinfo() {
%1 = call i32 @lda(i32 0, i32 64)
%2 = call i32 @sta(i32 1, i32 247)
%3 = call i32 @lda(i32 0, i32 101)
%4 = call i32 @sta(i32 1, i32 240)
%5 = call i32 @lda(i32 0, i32 0)
%6 = call i32 @sta(i32 1, i32 239)
%7 = call i32 @lda(i32 1, i32 64435)
%8 = call i32 @cmp(i32 0, i32 56)
%9 = call i64 (...) @bne()
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %0
br label %15
12: ; preds = %0
%13 = call i32 @lda(i32 0, i32 32)
%14 = call i32 @sta(i32 1, i32 240)
br label %56
15: ; preds = %11
%16 = call i32 @cmp(i32 0, i32 234)
%17 = call i64 (...) @bne()
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %15
br label %36
20: ; preds = %15
%21 = call i32 @lda(i32 1, i32 64286)
%22 = call i32 @cmp(i32 0, i32 138)
%23 = call i64 (...) @beq()
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %20
br label %31
26: ; preds = %20
%27 = call i32 @lda(i32 0, i32 48)
%28 = call i32 @sta(i32 1, i32 247)
%29 = call i32 @lda(i32 0, i32 43)
%30 = call i32 @sta(i32 1, i32 240)
br label %56
31: ; preds = %25
%32 = call i32 @lda(i32 0, i32 73)
%33 = call i32 @sta(i32 1, i32 240)
%34 = call i32 @lda(i32 0, i32 48)
%35 = call i32 @sta(i32 1, i32 247)
br label %56
36: ; preds = %19
%37 = call i32 @lda(i32 1, i32 64448)
%38 = call i64 (...) @beq()
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %41
40: ; preds = %36
br label %51
41: ; preds = %36
%42 = call i32 @cmp(i32 0, i32 224)
%43 = call i64 (...) @bne()
%44 = icmp ne i64 %43, 0
br i1 %44, label %45, label %46
45: ; preds = %41
br label %56
46: ; preds = %41
%47 = call i32 @lda(i32 0, i32 1)
%48 = call i32 @sta(i32 1, i32 239)
%49 = call i32 @lda(i32 0, i32 128)
%50 = call i32 @sta(i32 1, i32 247)
br label %56
51: ; preds = %40
%52 = call i32 @lda(i32 0, i32 99)
%53 = call i32 @sta(i32 1, i32 240)
%54 = call i32 @lda(i32 0, i32 128)
%55 = call i32 @sta(i32 1, i32 247)
br label %56
56: ; preds = %51, %46, %45, %31, %26, %12
ret void
}

LLVM IR (-O2):
define void @jsr_get_sysinfo() {
%1 = tail call i32 @lda(i32 0, i32 64)
%2 = tail call i32 @sta(i32 1, i32 247)
%3 = tail call i32 @lda(i32 0, i32 101)
%4 = tail call i32 @sta(i32 1, i32 240)
%5 = tail call i32 @lda(i32 0, i32 0)
%6 = tail call i32 @sta(i32 1, i32 239)
%7 = tail call i32 @lda(i32 1, i32 64435)
%8 = tail call i32 @cmp(i32 0, i32 56)
%9 = tail call i64 (...) @bne()
%10 = icmp eq i64 %9, 0
br i1 %10, label %39, label %11
11: ; preds = %0
%12 = tail call i32 @cmp(i32 0, i32 234)
%13 = tail call i64 (...) @bne()
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %24
15: ; preds = %11
%16 = tail call i32 @lda(i32 1, i32 64286)
%17 = tail call i32 @cmp(i32 0, i32 138)
%18 = tail call i64 (...) @beq()
%19 = icmp eq i64 %18, 0
%20 = select i1 %19, i32 48, i32 73
%21 = select i1 %19, i32 247, i32 240
%22 = select i1 %19, i32 43, i32 48
%23 = select i1 %19, i32 240, i32 247
br label %32
24: ; preds = %11
%25 = tail call i32 @lda(i32 1, i32 64448)
%26 = tail call i64 (...) @beq()
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %24
%29 = tail call i32 @cmp(i32 0, i32 224)
%30 = tail call i64 (...) @bne()
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %44
32: ; preds = %24, %28, %15
%33 = phi i32 [ %20, %15 ], [ 1, %28 ], [ 99, %24 ]
%34 = phi i32 [ %21, %15 ], [ 239, %28 ], [ 240, %24 ]
%35 = phi i32 [ %22, %15 ], [ 128, %28 ], [ 128, %24 ]
%36 = phi i32 [ %23, %15 ], [ 247, %28 ], [ 247, %24 ]
%37 = tail call i32 @lda(i32 0, i32 %33)
%38 = tail call i32 @sta(i32 1, i32 %34)
br label %39
39: ; preds = %32, %0
%40 = phi i32 [ 32, %0 ], [ %35, %32 ]
%41 = phi i32 [ 240, %0 ], [ %36, %32 ]
%42 = tail call i32 @lda(i32 0, i32 %40)
%43 = tail call i32 @sta(i32 1, i32 %41)
br label %44
44: ; preds = %39, %28
ret void
}