#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 /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
scalar_t__ strchr(char *, char);
int strlen(char *);
void errmsg(char *pname, char *msg) {
  extern char model[];
  fprintf(stderr, "ERROR in procedure \'%s\': %s\n", pname, msg);
  if (strchr(msg, '\012') && strlen(msg) != 1) {
    printf("\n");
  }
  exit(1);
}


x86 assembly (clang, -O0):
<errmsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe88(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1040 <strchr@plt>
cmp    $0x0,%rax
je     11b3 <errmsg+0x63>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x1,%eax
je     11b3 <errmsg+0x63>
lea    0xe6d(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<errmsg>:
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%rdx
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
lea    0xe99(%rip),%rsi
mov    %rbx,%rcx
call   1060 <fprintf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     1198 <errmsg+0x48>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x1,%eax
je     1198 <errmsg+0x48>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [29 x i8] c"ERROR in procedure '%s': %s\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @errmsg(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7)
%9 = load i8*, i8** %4
%10 = call i64 @strchr(i8* %9, i8 signext 10)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = call i32 @strlen(i8* %13)
%15 = icmp ne i32 %14, 1
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16, %12, %2
%19 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [29 x i8] c"ERROR in procedure '%s': %s\0A\00"
define void @errmsg(i8* %0, i8* %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%5 = tail call i64 @strchr(i8* %1, i8 signext 10)
%6 = icmp eq i64 %5, 0
br i1 %6, label %12, label %7
7: ; preds = %2
%8 = tail call i32 @strlen(i8* %1)
%9 = icmp eq i32 %8, 1
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i32 @putchar(i32 10)
br label %12
12: ; preds = %10, %7, %2
%13 = tail call i32 @exit(i32 1)
unreachable
}