#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*/ get_int(int *);
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ puts(char *);
scalar_t__ test_int();
int main(void) {
  int *ptr;
  int array[7];
  if (test_int()) {
    puts("The Miniserver has not been installed.\n");
    return (1);
  }
  get_int(array);
  printf("Total number of link interrupts : %d\n", array[0]);
  printf("Clashes with MS-DOS calls : %d\n", array[1]);
  printf("I/O handled during timer interrupt : %d\n", array[2]);
  printf("Timer interrupts clashing with MS-DOS : %d\n", array[3]);
  printf("Idle interrupts with outstanding link I/O : %d\n", array[4]);
  printf("Magic number check : %x\n", array[5]);
  printf("InDOS flag : %x\n", array[6]);
  printf("\n%d interrupts handled immediately, %d during timer interrupt\n",
         array[0] - array[1], array[2]);
  printf("%d interrupts handled during idle time.\n", array[4]);
  printf("Total handled is %d out of %d\n",
         (array[0] - array[1]) + array[2] + array[4], array[0]);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <test_int@plt>
cmp    $0x0,%rax
je     1178 <main+0x38>
lea    0xe99(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    1244 <main+0x104>
lea    -0x30(%rbp),%rdi
call   1060 <get_int@plt>
mov    -0x30(%rbp),%esi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x2c(%rbp),%esi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%esi
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xef4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xf13(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xf1b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%esi
sub    -0x2c(%rbp),%esi
mov    -0x28(%rbp),%edx
lea    0xf15(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xf43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%esi
sub    -0x2c(%rbp),%esi
add    -0x28(%rbp),%esi
add    -0x20(%rbp),%esi
mov    -0x30(%rbp),%edx
lea    0xf4f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <test_int@plt>
test   %rax,%rax
je     1169 <main+0x29>
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
jmp    1238 <main+0xf8>
mov    %rsp,%rdi
call   1060 <get_int@plt>
mov    (%rsp),%esi
lea    0xead(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
lea    0xec1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
lea    0xecf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
lea    0xee6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
lea    0xf00(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%esi
lea    0xf1e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%esi
lea    0xf25(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%esi
mov    0x8(%rsp),%edx
sub    0x4(%rsp),%esi
lea    0xf1d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
lea    0xf4a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%edx
mov    %edx,%esi
sub    0x4(%rsp),%esi
add    0x8(%rsp),%esi
add    0x10(%rsp),%esi
lea    0xf54(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [40 x i8] c"The Miniserver has not been installed.\0A\00"
@.str.1 = [38 x i8] c"Total number of link interrupts : %d\0A\00"
@.str.2 = [32 x i8] c"Clashes with MS-DOS calls : %d\0A\00"
@.str.3 = [41 x i8] c"I/O handled during timer interrupt : %d\0A\00"
@.str.4 = [44 x i8] c"Timer interrupts clashing with MS-DOS : %d\0A\00"
@.str.5 = [48 x i8] c"Idle interrupts with outstanding link I/O : %d\0A\00"
@.str.6 = [25 x i8] c"Magic number check : %x\0A\00"
@.str.7 = [17 x i8] c"InDOS flag : %x\0A\00"
@.str.8 = [63 x i8] c"\0A%d interrupts handled immediately, %d during timer interrupt\0A\00"
@.str.9 = [41 x i8] c"%d interrupts handled during idle time.\0A\00"
@.str.10 = [31 x i8] c"Total handled is %d out of %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [7 x i32]
store i32 0, i32* %1
%4 = call i64 (...) @test_int()
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @puts(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
br label %57
8: ; preds = %0
%9 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 0
%10 = call i32 @get_int(i32* %9)
%11 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 0
%12 = load i32, i32* %11
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 1
%15 = load i32, i32* %14
%16 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 2
%18 = load i32, i32* %17
%19 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 3
%21 = load i32, i32* %20
%22 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), i32 %21)
%23 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 4
%24 = load i32, i32* %23
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0), i32 %24)
%26 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 5
%27 = load i32, i32* %26
%28 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 6
%30 = load i32, i32* %29
%31 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i32 %30)
%32 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 0
%33 = load i32, i32* %32
%34 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 1
%35 = load i32, i32* %34
%36 = sub nsw i32 %33, %35
%37 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 2
%38 = load i32, i32* %37
%39 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.8, i64 0, i64 0), i32 %36, i32 %38)
%40 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 4
%41 = load i32, i32* %40
%42 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.9, i64 0, i64 0), i32 %41)
%43 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 0
%44 = load i32, i32* %43
%45 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 1
%46 = load i32, i32* %45
%47 = sub nsw i32 %44, %46
%48 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 2
%49 = load i32, i32* %48
%50 = add nsw i32 %47, %49
%51 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 4
%52 = load i32, i32* %51
%53 = add nsw i32 %50, %52
%54 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 0
%55 = load i32, i32* %54
%56 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0), i32 %53, i32 %55)
store i32 0, i32* %1
br label %57
57: ; preds = %8, %6
%58 = load i32, i32* %1
ret i32 %58
}

LLVM IR (-O2):
@.str = [40 x i8] c"The Miniserver has not been installed.\0A\00"
@.str.1 = [38 x i8] c"Total number of link interrupts : %d\0A\00"
@.str.2 = [32 x i8] c"Clashes with MS-DOS calls : %d\0A\00"
@.str.3 = [41 x i8] c"I/O handled during timer interrupt : %d\0A\00"
@.str.4 = [44 x i8] c"Timer interrupts clashing with MS-DOS : %d\0A\00"
@.str.5 = [48 x i8] c"Idle interrupts with outstanding link I/O : %d\0A\00"
@.str.6 = [25 x i8] c"Magic number check : %x\0A\00"
@.str.7 = [17 x i8] c"InDOS flag : %x\0A\00"
@.str.8 = [63 x i8] c"\0A%d interrupts handled immediately, %d during timer interrupt\0A\00"
@.str.9 = [41 x i8] c"%d interrupts handled during idle time.\0A\00"
@.str.10 = [31 x i8] c"Total handled is %d out of %d\0A\00"
define i32 @main() {
%1 = alloca [7 x i32]
%2 = bitcast [7 x i32]* %1 to i8*
%3 = tail call i64 (...) @test_int()
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %45
7: ; preds = %0
%8 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%9 = call i32 @get_int(i32* %8)
%10 = load i32, i32* %8
%11 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 1
%13 = load i32, i32* %12
%14 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 2
%16 = load i32, i32* %15
%17 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 3
%19 = load i32, i32* %18
%20 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), i32 %19)
%21 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 4
%22 = load i32, i32* %21
%23 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0), i32 %22)
%24 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 5
%25 = load i32, i32* %24
%26 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i32 %25)
%27 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 6
%28 = load i32, i32* %27
%29 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %8
%31 = load i32, i32* %12
%32 = sub nsw i32 %30, %31
%33 = load i32, i32* %15
%34 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.8, i64 0, i64 0), i32 %32, i32 %33)
%35 = load i32, i32* %21
%36 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.9, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %8
%38 = load i32, i32* %12
%39 = sub i32 %37, %38
%40 = load i32, i32* %15
%41 = add nsw i32 %39, %40
%42 = load i32, i32* %21
%43 = add nsw i32 %41, %42
%44 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0), i32 %43, i32 %37)
br label %45
45: ; preds = %7, %5
%46 = phi i32 [ 1, %5 ], [ 0, %7 ]
ret i32 %46
}