#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*/ stderr;
void error(int err, char *file) {
  static char *error_str[] = {
      "Seek",
      "Read",
      "Write",
  };
  fprintf(stderr, "%s error (file:%s)\n", error_str[err], file);
  exit(1);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
movslq -0x4(%rbp),%rcx
lea    0x2efd(%rip),%rax
mov    (%rax,%rcx,8),%rdx
mov    -0x10(%rbp),%rcx
lea    0xebe(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rax
mov    %rsi,%rcx
mov    0x2eb5(%rip),%rax
mov    (%rax),%eax
movslq %edi,%rdx
lea    0xec9(%rip),%rsi
movslq (%rsi,%rdx,4),%rdx
add    %rsi,%rdx
lea    0xed7(%rip),%rsi
mov    %eax,%edi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@error.error_str = internal global [3 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0)]
@.str = [5 x i8] c"Seek\00"
@.str.1 = [5 x i8] c"Read\00"
@.str.2 = [6 x i8] c"Write\00"
@stderr = global i32 0
@.str.3 = [20 x i8] c"%s error (file:%s)\0A\00"
define void @error(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* @stderr
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [3 x i8*], [3 x i8*]* @error.error_str, i64 0, i64 %7
%9 = load i8*, i8** %8
%10 = load i8*, i8** %4
%11 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %9, i8* %10)
%12 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@reltable.error = internal unnamed_addr constant [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.error to i64)) to i32)]
@.str = [5 x i8] c"Seek\00"
@.str.1 = [5 x i8] c"Read\00"
@.str.2 = [6 x i8] c"Write\00"
@stderr = global i32 0
@.str.3 = [20 x i8] c"%s error (file:%s)\0A\00"
define void @error(i32 %0, i8* %1) {
%3 = load i32, i32* @stderr
%4 = sext i32 %0 to i64
%5 = shl i64 %4, 2
%6 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.error to i8*), i64 %5)
%7 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %6, i8* %1)
%8 = tail call i32 @exit(i32 1)
unreachable
}