#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*/ exit(int);
int strlen(char *);
scalar_t__ write(int, char *, int);
void error(char *err_msg) {
  char buffer[256] = "[os_mon] cpu supervisor port (cpu_sup): ";
  int i = strlen(buffer), j = 0;
  int n = strlen(err_msg);
  while (i < 253 && j < n) {
    buffer[i++] = err_msg[j++];
  }
  buffer[i++] = '\r';
  buffer[i++] = '\n';
  if (write((2), buffer, i))
    ;
  exit(-1);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x110(%rbp),%rdi
lea    0xea3(%rip),%rsi
mov    $0x100,%edx
call   1050 <memcpy@plt>
lea    -0x110(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x114(%rbp)
movl   $0x0,-0x118(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x11c(%rbp)
xor    %eax,%eax
cmpl   $0xfd,-0x114(%rbp)
mov    %al,-0x11d(%rbp)
jge    11bf <error+0x7f>
mov    -0x118(%rbp),%eax
cmp    -0x11c(%rbp),%eax
setl   %al
mov    %al,-0x11d(%rbp)
mov    -0x11d(%rbp),%al
test   $0x1,%al
jne    11d2 <error+0x92>
jmp    120c <error+0xcc>
mov    -0x8(%rbp),%rax
mov    -0x118(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x118(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x114(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x114(%rbp)
cltq
mov    %cl,-0x110(%rbp,%rax,1)
jmp    1192 <error+0x52>
mov    -0x114(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x114(%rbp)
cltq
movb   $0xd,-0x110(%rbp,%rax,1)
0d
mov    -0x114(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x114(%rbp)
cltq
movb   $0xa,-0x110(%rbp,%rax,1)
0a
lea    -0x110(%rbp),%rsi
mov    -0x114(%rbp),%edx
mov    $0x2,%edi
call   1030 <write@plt>
cmp    $0x0,%rax
je     1268 <error+0x128>
jmp    1268 <error+0x128>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x100,%rsp
mov    %rdi,%r14
lea    0xea7(%rip),%rsi
mov    %rsp,%rbx
mov    $0x100,%edx
mov    %rbx,%rdi
call   1050 <memcpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%r12d
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %r12d,%edx
sub    $0xfc,%edx
jg     11d9 <error+0x99>
mov    %eax,%r15d
test   %eax,%eax
jle    11d9 <error+0x99>
lea    -0x1(%r15),%eax
neg    %edx
cmp    %edx,%eax
cmovb  %eax,%edx
xor    %ebx,%ebx
cmp    $0xfc,%r12d
movslq %r12d,%rbp
lea    (%rsp,%rbp,1),%rdi
cmove  %ebx,%edx
add    $0x1,%rdx
mov    %r14,%rsi
call   1050 <memcpy@plt>
mov    %r15d,%eax
nopl   0x0(%rax,%rax,1)
lea    (%rbx,%rbp,1),%rcx
add    $0x1,%rbx
cmp    $0xfb,%rcx
jg     11d6 <error+0x96>
cmp    %rax,%rbx
jb     11c0 <error+0x80>
add    %ebx,%r12d
movslq %r12d,%rdx
movw   $0xa0d,(%rsp,%rdx,1)
add    $0x2,%edx
mov    %rsp,%rsi
mov    $0x2,%edi
call   1030 <write@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@__const.error.buffer = [256 x i8] c"[os_mon] cpu supervisor port (cpu_sup): \00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
define void @error(i8* %0) {
%2 = alloca i8*
%3 = alloca [256 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %2
%7 = bitcast [256 x i8]* %3 to i8*
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %4
store i32 0, i32* %5
%10 = load i8*, i8** %2
%11 = call i32 @strlen(i8* %10)
store i32 %11, i32* %6
br label %12
12: ; preds = %21, %1
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 253
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = icmp slt i32 %16, %17
br label %19
19: ; preds = %15, %12
%20 = phi i1 [ false, %12 ], [ %18, %15 ]
br i1 %20, label %21, label %32
21: ; preds = %19
%22 = load i8*, i8** %2
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
%25 = sext i32 %23 to i64
%26 = getelementptr inbounds i8, i8* %22, i64 %25
%27 = load i8, i8* %26
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
%30 = sext i32 %28 to i64
%31 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %30
store i8 %27, i8* %31
br label %12
32: ; preds = %19
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
%35 = sext i32 %33 to i64
%36 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %35
store i8 13, i8* %36
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 1
store i32 %38, i32* %4
%39 = sext i32 %37 to i64
%40 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %39
store i8 10, i8* %40
%41 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%42 = load i32, i32* %4
%43 = call i64 @write(i32 2, i8* %41, i32 %42)
%44 = icmp ne i64 %43, 0
br i1 %44, label %45, label %46
45: ; preds = %32
br label %46
46: ; preds = %45, %32
%47 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@__const.error.buffer = [256 x i8] c"[os_mon] cpu supervisor port (cpu_sup): \00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
define void @error(i8* %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = call i32 @strlen(i8* %3)
%5 = call i32 @strlen(i8* %0)
%6 = icmp slt i32 %4, 253
%7 = icmp sgt i32 %5, 0
%8 = select i1 %6, i1 %7, i1 false
br i1 %8, label %9, label %30
9: ; preds = %1
%10 = sext i32 %4 to i64
%11 = getelementptr [256 x i8], [256 x i8]* %2, i64 0, i64 %10
%12 = sub i32 252, %4
%13 = add nsw i32 %5, -1
%14 = icmp eq i32 %4, 252
%15 = call i32 @llvm.umin.i32(i32 %13, i32 %12)
%16 = select i1 %14, i32 0, i32 %15
%17 = zext i32 %16 to i64
%18 = add nuw nsw i64 %17, 1
%19 = zext i32 %5 to i64
br label %20
20: ; preds = %9, %20
%21 = phi i64 [ 0, %9 ], [ %23, %20 ]
%22 = phi i64 [ %10, %9 ], [ %24, %20 ]
%23 = add nuw nsw i64 %21, 1
%24 = add nsw i64 %22, 1
%25 = icmp slt i64 %22, 252
%26 = icmp ult i64 %23, %19
%27 = select i1 %25, i1 %26, i1 false
br i1 %27, label %20, label %28
28: ; preds = %20
%29 = trunc i64 %24 to i32
br label %30
30: ; preds = %28, %1
%31 = phi i32 [ %4, %1 ], [ %29, %28 ]
%32 = add nsw i32 %31, 1
%33 = sext i32 %31 to i64
%34 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %33
store i8 13, i8* %34
%35 = add nsw i32 %31, 2
%36 = sext i32 %32 to i64
%37 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %36
store i8 10, i8* %37
%38 = call i64 @write(i32 2, i8* %3, i32 %35)
%39 = call i32 @exit(i32 -1)
unreachable
}