#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 */
struct fonz {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fp_init(int);
int /*<<< orphan*/ fp_sendcmd(int, int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ runcmd(struct fonz *);
int main() {
  int i;
  struct fonz *fp;
  printf("Testing FONZ...\n");
  fp_init(4);
  fp_sendcmd(0x00, 0, 0);
  runcmd(fp);
  fp_sendcmd(0xc1, 0xaa, 0x55);
  runcmd(fp);
  fp_sendcmd(0xce, 0xaa, 0x55);
  runcmd(fp);
  fp_sendcmd(0x31, 0, 0);
  runcmd(fp);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1050 <printf@plt>
mov    $0x4,%edi
call   1030 <fp_init@plt>
xor    %edx,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1060 <fp_sendcmd@plt>
mov    -0x10(%rbp),%rdi
call   1040 <runcmd@plt>
mov    $0xc1,%edi
mov    $0xaa,%esi
mov    $0x55,%edx
call   1060 <fp_sendcmd@plt>
mov    -0x10(%rbp),%rdi
call   1040 <runcmd@plt>
mov    $0xce,%edi
mov    $0xaa,%esi
mov    $0x55,%edx
call   1060 <fp_sendcmd@plt>
mov    -0x10(%rbp),%rdi
call   1040 <runcmd@plt>
mov    $0x31,%edi
xor    %edx,%edx
mov    %edx,%esi
call   1060 <fp_sendcmd@plt>
mov    -0x10(%rbp),%rdi
call   1040 <runcmd@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xea8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x4,%edi
call   1040 <fp_init@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <fp_sendcmd@plt>
call   1050 <runcmd@plt>
mov    $0xc1,%edi
mov    $0xaa,%esi
mov    $0x55,%edx
call   1060 <fp_sendcmd@plt>
call   1050 <runcmd@plt>
mov    $0xce,%edi
mov    $0xaa,%esi
mov    $0x55,%edx
call   1060 <fp_sendcmd@plt>
call   1050 <runcmd@plt>
mov    $0x31,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <fp_sendcmd@plt>
call   1050 <runcmd@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
%struct.fonz = type { i32 }
@.str = [17 x i8] c"Testing FONZ...\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.fonz*
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @fp_init(i32 4)
%6 = call i32 @fp_sendcmd(i32 0, i32 0, i32 0)
%7 = load %struct.fonz*, %struct.fonz** %3
%8 = call i32 @runcmd(%struct.fonz* %7)
%9 = call i32 @fp_sendcmd(i32 193, i32 170, i32 85)
%10 = load %struct.fonz*, %struct.fonz** %3
%11 = call i32 @runcmd(%struct.fonz* %10)
%12 = call i32 @fp_sendcmd(i32 206, i32 170, i32 85)
%13 = load %struct.fonz*, %struct.fonz** %3
%14 = call i32 @runcmd(%struct.fonz* %13)
%15 = call i32 @fp_sendcmd(i32 49, i32 0, i32 0)
%16 = load %struct.fonz*, %struct.fonz** %3
%17 = call i32 @runcmd(%struct.fonz* %16)
%18 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.fonz = type { i32 }
@str = [16 x i8] c"Testing FONZ...\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @fp_init(i32 4)
%3 = tail call i32 @fp_sendcmd(i32 0, i32 0, i32 0)
%4 = tail call i32 @runcmd(%struct.fonz* undef)
%5 = tail call i32 @fp_sendcmd(i32 193, i32 170, i32 85)
%6 = tail call i32 @runcmd(%struct.fonz* undef)
%7 = tail call i32 @fp_sendcmd(i32 206, i32 170, i32 85)
%8 = tail call i32 @runcmd(%struct.fonz* undef)
%9 = tail call i32 @fp_sendcmd(i32 49, i32 0, i32 0)
%10 = tail call i32 @runcmd(%struct.fonz* undef)
%11 = tail call i32 @exit(i32 0)
unreachable
}