#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*/ errno;
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, ...);
char *strerror(int /*<<< orphan*/);
void _make_error_message(int err, char *where, char *buf) {
  extern char *ec_error_message[];
  if (err == -170)
    sprintf(buf, "ECLiPSe: %s (%s) in %s.", ec_error_message[err],
            strerror(errno), where);
  else
    sprintf(buf, "ECLiPSe: %s in %s.", ec_error_message[err], where);
}


x86 assembly (clang, -O0):
<_make_error_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0xffffff56,-0x4(%rbp)
jne    118b <_make_error_message+0x6b>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
movslq -0x4(%rbp),%rcx
mov    0x2e8d(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    %rax,%rcx
mov    -0x10(%rbp),%r8
lea    0xe81(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    11b0 <_make_error_message+0x90>
mov    -0x18(%rbp),%rdi
movslq -0x4(%rbp),%rcx
mov    0x2e46(%rip),%rax
mov    (%rax,%rcx,8),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe6f(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_make_error_message>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
cmp    $0xffffff56,%edi
jne    116e <_make_error_message+0x4e>
mov    0x2ea6(%rip),%rax
mov    -0x550(%rax),%r15
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
lea    0xeaa(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %rax,%rcx
mov    %r14,%r8
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <sprintf@plt>
movslq %edi,%rax
mov    0x2e68(%rip),%rcx
mov    (%rcx,%rax,8),%rdx
lea    0xe95(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rcx
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"ECLiPSe: %s (%s) in %s.\00"
@ec_error_message = external global [0 x i8*]
@errno = global i32 0
@.str.1 = [19 x i8] c"ECLiPSe: %s in %s.\00"
define void @_make_error_message(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, -170
br i1 %8, label %9, label %19
9: ; preds = %3
%10 = load i8*, i8** %6
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [0 x i8*], [0 x i8*]* @ec_error_message, i64 0, i64 %12
%14 = load i8*, i8** %13
%15 = load i32, i32* @errno
%16 = call i8* @strerror(i32 %15)
%17 = load i8*, i8** %5
%18 = call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* %10, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %14, i8* %16, i8* %17)
br label %27
19: ; preds = %3
%20 = load i8*, i8** %6
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [0 x i8*], [0 x i8*]* @ec_error_message, i64 0, i64 %22
%24 = load i8*, i8** %23
%25 = load i8*, i8** %5
%26 = call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* %20, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %24, i8* %25)
br label %27
27: ; preds = %19, %9
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"ECLiPSe: %s (%s) in %s.\00"
@ec_error_message = external global [0 x i8*]
@errno = global i32 0
@.str.1 = [19 x i8] c"ECLiPSe: %s in %s.\00"
define void @_make_error_message(i32 %0, i8* %1, i8* nocapture writeonly %2) {
%4 = icmp eq i32 %0, -170
br i1 %4, label %5, label %10
5: ; preds = %3
%6 = load i8*, i8** getelementptr ([0 x i8*], [0 x i8*]* @ec_error_message, i64 0, i64 -170)
%7 = load i32, i32* @errno
%8 = tail call i8* @strerror(i32 %7)
%9 = tail call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %8, i8* %1)
br label %15
10: ; preds = %3
%11 = sext i32 %0 to i64
%12 = getelementptr inbounds [0 x i8*], [0 x i8*]* @ec_error_message, i64 0, i64 %11
%13 = load i8*, i8** %12
%14 = tail call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* %1)
br label %15
15: ; preds = %10, %5
ret void
}