#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*/ io_error_msg(char *, int);
int /*<<< orphan*/ set_usr_stats(int, char **);
void define_usr_fmt(int fmt, char *pos_h, char *neg_h, char *pos_t, char *neg_t,
                    char *zero, char *comma, char *decimal, char *precision,
                    char *scale) {
  char *usr_buf[9];
  if (fmt < 1 || fmt > 16) {
    io_error_msg("Format number out of range %d (should be in [1..16].", fmt);
  }
  --fmt;
  usr_buf[0] = pos_h;
  usr_buf[1] = neg_h;
  usr_buf[2] = pos_t;
  usr_buf[3] = neg_t;
  usr_buf[4] = zero;
  usr_buf[5] = comma;
  usr_buf[6] = decimal;
  usr_buf[7] = precision;
  usr_buf[8] = scale;
  set_usr_stats(fmt, usr_buf);
}


x86 assembly (clang, -O0):
<define_usr_fmt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
cmpl   $0x1,-0x4(%rbp)
jl     1166 <define_usr_fmt+0x46>
cmpl   $0x10,-0x4(%rbp)
jle    1175 <define_usr_fmt+0x55>
mov    -0x4(%rbp),%esi
lea    0xe90(%rip),%rdi
call   1040 <io_error_msg@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    0x18(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    0x20(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    0x28(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x80(%rbp),%rsi
call   1030 <set_usr_stats@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<define_usr_fmt>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rsi,%rbp
mov    %edi,%ebx
mov    0x98(%rsp),%rcx
mov    0x90(%rsp),%rdx
mov    0x88(%rsp),%rsi
mov    0x80(%rsp),%rdi
lea    -0x11(%rbx),%eax
cmp    $0xffffffef,%eax
ja     1195 <define_usr_fmt+0x75>
lea    0xe92(%rip),%rdi
mov    %ebx,%esi
call   1040 <io_error_msg@plt>
mov    0x80(%rsp),%rdi
mov    0x88(%rsp),%rsi
mov    0x90(%rsp),%rdx
mov    0x98(%rsp),%rcx
add    $0xffffffff,%ebx
mov    %rbp,(%rsp)
mov    %r13,0x8(%rsp)
mov    %r12,0x10(%rsp)
mov    %r15,0x18(%rsp)
mov    %r14,0x20(%rsp)
mov    %rdi,0x28(%rsp)
mov    %rsi,0x30(%rsp)
mov    %rdx,0x38(%rsp)
mov    %rcx,0x40(%rsp)
mov    %rsp,%rsi
mov    %ebx,%edi
call   1030 <set_usr_stats@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [53 x i8] c"Format number out of range %d (should be in [1..16].\00"
define void @define_usr_fmt(i32 %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5, i8* %6, i8* %7, i8* %8, i8* %9) {
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca i8*
%20 = alloca i8*
%21 = alloca [9 x i8*]
store i32 %0, i32* %11
store i8* %1, i8** %12
store i8* %2, i8** %13
store i8* %3, i8** %14
store i8* %4, i8** %15
store i8* %5, i8** %16
store i8* %6, i8** %17
store i8* %7, i8** %18
store i8* %8, i8** %19
store i8* %9, i8** %20
%22 = load i32, i32* %11
%23 = icmp slt i32 %22, 1
br i1 %23, label %27, label %24
24: ; preds = %10
%25 = load i32, i32* %11
%26 = icmp sgt i32 %25, 16
br i1 %26, label %27, label %30
27: ; preds = %24, %10
%28 = load i32, i32* %11
%29 = call i32 @io_error_msg(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %27, %24
%31 = load i32, i32* %11
%32 = add nsw i32 %31, -1
store i32 %32, i32* %11
%33 = load i8*, i8** %12
%34 = getelementptr inbounds [9 x i8*], [9 x i8*]* %21, i64 0, i64 0
store i8* %33, i8** %34
%35 = load i8*, i8** %13
%36 = getelementptr inbounds [9 x i8*], [9 x i8*]* %21, i64 0, i64 1
store i8* %35, i8** %36
%37 = load i8*, i8** %14
%38 = getelementptr inbounds [9 x i8*], [9 x i8*]* %21, i64 0, i64 2
store i8* %37, i8** %38
%39 = load i8*, i8** %15
%40 = getelementptr inbounds [9 x i8*], [9 x i8*]* %21, i64 0, i64 3
store i8* %39, i8** %40
%41 = load i8*, i8** %16
%42 = getelementptr inbounds [9 x i8*], [9 x i8*]* %21, i64 0, i64 4
store i8* %41, i8** %42
%43 = load i8*, i8** %17
%44 = getelementptr inbounds [9 x i8*], [9 x i8*]* %21, i64 0, i64 5
store i8* %43, i8** %44
%45 = load i8*, i8** %18
%46 = getelementptr inbounds [9 x i8*], [9 x i8*]* %21, i64 0, i64 6
store i8* %45, i8** %46
%47 = load i8*, i8** %19
%48 = getelementptr inbounds [9 x i8*], [9 x i8*]* %21, i64 0, i64 7
store i8* %47, i8** %48
%49 = load i8*, i8** %20
%50 = getelementptr inbounds [9 x i8*], [9 x i8*]* %21, i64 0, i64 8
store i8* %49, i8** %50
%51 = load i32, i32* %11
%52 = getelementptr inbounds [9 x i8*], [9 x i8*]* %21, i64 0, i64 0
%53 = call i32 @set_usr_stats(i32 %51, i8** %52)
ret void
}

LLVM IR (-O2):
@.str = [53 x i8] c"Format number out of range %d (should be in [1..16].\00"
define void @define_usr_fmt(i32 %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5, i8* %6, i8* %7, i8* %8, i8* %9) {
%11 = alloca [9 x i8*]
%12 = bitcast [9 x i8*]* %11 to i8*
%13 = add i32 %0, -17
%14 = icmp ult i32 %13, -16
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = tail call i32 @io_error_msg(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %17
17: ; preds = %10, %15
%18 = add nsw i32 %0, -1
%19 = getelementptr inbounds [9 x i8*], [9 x i8*]* %11, i64 0, i64 0
store i8* %1, i8** %19
%20 = getelementptr inbounds [9 x i8*], [9 x i8*]* %11, i64 0, i64 1
store i8* %2, i8** %20
%21 = getelementptr inbounds [9 x i8*], [9 x i8*]* %11, i64 0, i64 2
store i8* %3, i8** %21
%22 = getelementptr inbounds [9 x i8*], [9 x i8*]* %11, i64 0, i64 3
store i8* %4, i8** %22
%23 = getelementptr inbounds [9 x i8*], [9 x i8*]* %11, i64 0, i64 4
store i8* %5, i8** %23
%24 = getelementptr inbounds [9 x i8*], [9 x i8*]* %11, i64 0, i64 5
store i8* %6, i8** %24
%25 = getelementptr inbounds [9 x i8*], [9 x i8*]* %11, i64 0, i64 6
store i8* %7, i8** %25
%26 = getelementptr inbounds [9 x i8*], [9 x i8*]* %11, i64 0, i64 7
store i8* %8, i8** %26
%27 = getelementptr inbounds [9 x i8*], [9 x i8*]* %11, i64 0, i64 8
store i8* %9, i8** %27
%28 = call i32 @set_usr_stats(i32 %18, i8** %19)
ret void
}