#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*/ interrupt(int, int, char *, int /*<<< orphan*/,
                             int /*<<< orphan*/);
int main() {
  int q, w;
  int count = 12345;
  int max = 1000;
  interrupt(0x21, 0x0, "Looping\r\n", 0, 0);
  for (q = 0; q < max; q++) {
    for (w = 0; w < max; w++) {
      interrupt(0x21, 0x0, "\0", 0, 0);
    }
  }
  interrupt(0x21, 0x0, "Done\r\n", 0, 0);
  interrupt(0x21, 0x5, 0, 0, 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3039,-0x10(%rbp)
movl   $0x3e8,-0x14(%rbp)
mov    $0x21,%edi
xor    %r8d,%r8d
lea    0xec4(%rip),%rdx
mov    %r8d,%esi
mov    %r8d,%ecx
call   1030 <interrupt@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11a8 <main+0x98>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1195 <main+0x85>
mov    $0x21,%edi
xor    %r8d,%r8d
lea    0xe95(%rip),%rdx
mov    %r8d,%esi
mov    %r8d,%ecx
call   1030 <interrupt@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1161 <main+0x51>
jmp    119a <main+0x8a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114e <main+0x3e>
mov    $0x21,%edi
xor    %r8d,%r8d
lea    0xe53(%rip),%rdx
mov    %r8d,%esi
mov    %r8d,%ecx
call   1030 <interrupt@plt>
mov    $0x21,%edi
mov    $0x5,%esi
xor    %eax,%eax
mov    %eax,%edx
xor    %r8d,%r8d
mov    %r8d,%ecx
call   1030 <interrupt@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xee5(%rip),%rdx
xor    %r14d,%r14d
mov    $0x21,%edi
xor    %esi,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <interrupt@plt>
lea    0xedb(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    $0x3e8,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x21,%edi
xor    %esi,%esi
mov    %rbx,%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <interrupt@plt>
add    $0xffffffff,%ebp
jne    1150 <main+0x40>
add    $0x1,%r14d
cmp    $0x3e8,%r14d
jne    1140 <main+0x30>
lea    0xe8d(%rip),%rdx
mov    $0x21,%edi
xor    %esi,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <interrupt@plt>
mov    $0x21,%edi
mov    $0x5,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <interrupt@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Looping\0D\0A\00"
@.str.1 = [2 x i8] zeroinitializer
@.str.2 = [7 x i8] c"Done\0D\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 12345, i32* %4
store i32 1000, i32* %5
%6 = call i32 @interrupt(i32 33, i32 0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 0, i32 0)
store i32 0, i32* %2
br label %7
7: ; preds = %22, %0
%8 = load i32, i32* %2
%9 = load i32, i32* %5
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %25
11: ; preds = %7
store i32 0, i32* %3
br label %12
12: ; preds = %18, %11
%13 = load i32, i32* %3
%14 = load i32, i32* %5
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = call i32 @interrupt(i32 33, i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0)
br label %18
18: ; preds = %16
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %12
21: ; preds = %12
br label %22
22: ; preds = %21
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
br label %7
25: ; preds = %7
%26 = call i32 @interrupt(i32 33, i32 0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 0)
%27 = call i32 @interrupt(i32 33, i32 5, i8* null, i32 0, i32 0)
%28 = load i32, i32* %1
ret i32 %28
}

LLVM IR (-O2):
@.str = [10 x i8] c"Looping\0D\0A\00"
@.str.1 = [2 x i8] zeroinitializer
@.str.2 = [7 x i8] c"Done\0D\0A\00"
define i32 @main() {
%1 = tail call i32 @interrupt(i32 33, i32 0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 0, i32 0)
br label %2
2: ; preds = %0, %9
%3 = phi i32 [ 0, %0 ], [ %10, %9 ]
br label %4
4: ; preds = %2, %4
%5 = phi i32 [ 0, %2 ], [ %7, %4 ]
%6 = tail call i32 @interrupt(i32 33, i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0)
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, 1000
br i1 %8, label %9, label %4
9: ; preds = %4
%10 = add nuw nsw i32 %3, 1
%11 = icmp eq i32 %10, 1000
br i1 %11, label %12, label %2
12: ; preds = %9
%13 = tail call i32 @interrupt(i32 33, i32 0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 0)
%14 = tail call i32 @interrupt(i32 33, i32 5, i8* null, i32 0, i32 0)
ret i32 0
}