void __attribute__((noreturn)) panic(int cnt) {
  volatile long *p = (void *)0xc02200E8;
  volatile long *p2;
  p2 = (void *)0xc02200D8;
  *p2 = 0;
  int i;
  for (; cnt > 0; cnt--) {
    p[0] = 0x46;
    *p2 = 0;
    for (i = 0; i < 0x200000; i++) {
      asm("nop\n");
      asm("nop\n");
    }
    p[0] = 0x44;
    *p2 = 0x46;
    for (i = 0; i < 0x200000; i++) {
      asm("nop\n");
      asm("nop\n");
    }
  }
  shutdown();
}


x86 assembly (clang, -O0):
<panic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    $0xc02200e8,%eax
mov    %rax,-0x10(%rbp)
mov    $0xc02200d8,%eax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
cmpl   $0x0,-0x4(%rbp)
jle    11c9 <panic+0xb9>
mov    -0x10(%rbp),%rax
movq   $0x46,(%rax)
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x200000,-0x1c(%rbp)
jge    117c <panic+0x6c>
nop
nop
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115f <panic+0x4f>
mov    -0x10(%rbp),%rax
movq   $0x44,(%rax)
mov    -0x18(%rbp),%rax
movq   $0x46,(%rax)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x200000,-0x1c(%rbp)
jge    11b6 <panic+0xa6>
nop
nop
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1199 <panic+0x89>
jmp    11bb <panic+0xab>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    1138 <panic+0x28>
mov    $0x0,%al
call   1030 <shutdown@plt>

x86 assembly (clang, -O2):
<panic>:
push   %rax
mov    $0xc02200d8,%eax
movq   $0x0,(%rax)
test   %edi,%edi
jle    1181 <panic+0x71>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movq   $0x46,0x10(%rax)
movq   $0x0,(%rax)
mov    $0x200000,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
nop
nop
add    $0xffffffff,%ecx
jne    1150 <panic+0x40>
movq   $0x44,0x10(%rax)
movq   $0x46,(%rax)
mov    $0x200000,%ecx
nopl   0x0(%rax,%rax,1)
nop
nop
add    $0xffffffff,%ecx
jne    1170 <panic+0x60>
lea    -0x1(%rdi),%ecx
cmp    $0x1,%edi
mov    %ecx,%edi
jg     1130 <panic+0x20>
xor    %eax,%eax
call   1030 <shutdown@plt>

LLVM IR (-O0):
define void @panic(i32 %0) {
%2 = alloca i32
%3 = alloca i64*
%4 = alloca i64*
%5 = alloca i32
store i32 %0, i32* %2
store i64* inttoptr (i64 3223453928 to i64*), i64** %3
store i64* inttoptr (i64 3223453912 to i64*), i64** %4
%6 = load i64*, i64** %4
store volatile i64 0, i64* %6
br label %7
7: ; preds = %33, %1
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %36
10: ; preds = %7
%11 = load i64*, i64** %3
%12 = getelementptr inbounds i64, i64* %11, i64 0
store volatile i64 70, i64* %12
%13 = load i64*, i64** %4
store volatile i64 0, i64* %13
store i32 0, i32* %5
br label %14
14: ; preds = %18, %10
%15 = load i32, i32* %5
%16 = icmp slt i32 %15, 2097152
br i1 %16, label %17, label %21
17: ; preds = %14
br label %18
18: ; preds = %17
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %14
21: ; preds = %14
%22 = load i64*, i64** %3
%23 = getelementptr inbounds i64, i64* %22, i64 0
store volatile i64 68, i64* %23
%24 = load i64*, i64** %4
store volatile i64 70, i64* %24
store i32 0, i32* %5
br label %25
25: ; preds = %29, %21
%26 = load i32, i32* %5
%27 = icmp slt i32 %26, 2097152
br i1 %27, label %28, label %32
28: ; preds = %25
br label %29
29: ; preds = %28
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %25
32: ; preds = %25
br label %33
33: ; preds = %32
%34 = load i32, i32* %2
%35 = add nsw i32 %34, -1
store i32 %35, i32* %2
br label %7
36: ; preds = %7
%37 = call i32 (...) @shutdown()
unreachable
}

LLVM IR (-O2):
define void @panic(i32 %0) {
store volatile i64 0, i64* inttoptr (i64 3223453912 to i64*)
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %17
3: ; preds = %1, %14
%4 = phi i32 [ %15, %14 ], [ %0, %1 ]
store volatile i64 70, i64* inttoptr (i64 3223453928 to i64*)
store volatile i64 0, i64* inttoptr (i64 3223453912 to i64*)
br label %5
5: ; preds = %3, %5
%6 = phi i32 [ 0, %3 ], [ %7, %5 ]
tail call void asm sideeffect "nop\0A", "~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop\0A", "~{dirflag},~{fpsr},~{flags}"()
%7 = add nuw nsw i32 %6, 1
%8 = icmp eq i32 %7, 2097152
br i1 %8, label %9, label %5
9: ; preds = %5
store volatile i64 68, i64* inttoptr (i64 3223453928 to i64*)
store volatile i64 70, i64* inttoptr (i64 3223453912 to i64*)
br label %10
10: ; preds = %9, %10
%11 = phi i32 [ 0, %9 ], [ %12, %10 ]
tail call void asm sideeffect "nop\0A", "~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop\0A", "~{dirflag},~{fpsr},~{flags}"()
%12 = add nuw nsw i32 %11, 1
%13 = icmp eq i32 %12, 2097152
br i1 %13, label %14, label %10
14: ; preds = %10
%15 = add nsw i32 %4, -1
%16 = icmp sgt i32 %4, 1
br i1 %16, label %3, label %17
17: ; preds = %14, %1
%18 = tail call i32 (...) @shutdown()
unreachable
}