#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*/ get_usr_stats(int, char **);
int /*<<< orphan*/ io_error_msg(char *, int);
int /*<<< orphan*/ put_string(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
void insert_usr_fmt_part(int fmt, int stat) {
  char *usr_stats[9];
  if ((fmt < 1) || (fmt > 16))
    io_error_msg(
        "insert-user-format-part arg 1 out of range (%d); should be in [1-16].",
        fmt);
  --fmt;
  if ((stat < 1) || (stat > 16))
    io_error_msg(
        "insert-user-format-part arg 2 out of range (%d); should be in [1-9].",
        stat);
  --stat;
  get_usr_stats(fmt, usr_stats);
  put_string(usr_stats[stat], strlen(usr_stats[stat]));
}


x86 assembly (clang, -O0):
<insert_usr_fmt_part>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x1,-0x4(%rbp)
jl     1162 <insert_usr_fmt_part+0x22>
cmpl   $0x10,-0x4(%rbp)
jle    1171 <insert_usr_fmt_part+0x31>
mov    -0x4(%rbp),%esi
lea    0xe94(%rip),%rdi
call   1050 <io_error_msg@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x1,-0x8(%rbp)
jl     118e <insert_usr_fmt_part+0x4e>
cmpl   $0x10,-0x8(%rbp)
jle    119d <insert_usr_fmt_part+0x5d>
mov    -0x8(%rbp),%esi
lea    0xeae(%rip),%rdi
call   1050 <io_error_msg@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x50(%rbp),%rsi
call   1030 <get_usr_stats@plt>
movslq -0x8(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rax
mov    %rax,-0x58(%rbp)
movslq -0x8(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rdi
call   1040 <strlen@plt>
mov    -0x58(%rbp),%rdi
mov    %eax,%esi
call   1060 <put_string@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert_usr_fmt_part>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %esi,%r14d
mov    %edi,%ebx
lea    -0x11(%rbx),%eax
cmp    $0xffffffef,%eax
ja     1162 <insert_usr_fmt_part+0x22>
lea    0xea5(%rip),%rdi
mov    %ebx,%esi
call   1050 <io_error_msg@plt>
lea    -0x11(%r14),%eax
cmp    $0xffffffef,%eax
ja     117a <insert_usr_fmt_part+0x3a>
lea    0xed4(%rip),%rdi
mov    %r14d,%esi
call   1050 <io_error_msg@plt>
add    $0xffffffff,%ebx
mov    %rsp,%rsi
mov    %ebx,%edi
call   1030 <get_usr_stats@plt>
movslq %r14d,%rax
mov    -0x8(%rsp,%rax,8),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1060 <put_string@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [70 x i8] c"insert-user-format-part arg 1 out of range (%d); should be in [1-16].\00"
@.str.1 = [69 x i8] c"insert-user-format-part arg 2 out of range (%d); should be in [1-9].\00"
define void @insert_usr_fmt_part(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [9 x i8*]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 1
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i32, i32* %3
%10 = icmp sgt i32 %9, 16
br i1 %10, label %11, label %14
11: ; preds = %8, %2
%12 = load i32, i32* %3
%13 = call i32 @io_error_msg(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %11, %8
%15 = load i32, i32* %3
%16 = add nsw i32 %15, -1
store i32 %16, i32* %3
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 1
br i1 %18, label %22, label %19
19: ; preds = %14
%20 = load i32, i32* %4
%21 = icmp sgt i32 %20, 16
br i1 %21, label %22, label %25
22: ; preds = %19, %14
%23 = load i32, i32* %4
%24 = call i32 @io_error_msg(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %22, %19
%26 = load i32, i32* %4
%27 = add nsw i32 %26, -1
store i32 %27, i32* %4
%28 = load i32, i32* %3
%29 = getelementptr inbounds [9 x i8*], [9 x i8*]* %5, i64 0, i64 0
%30 = call i32 @get_usr_stats(i32 %28, i8** %29)
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [9 x i8*], [9 x i8*]* %5, i64 0, i64 %32
%34 = load i8*, i8** %33
%35 = load i32, i32* %4
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [9 x i8*], [9 x i8*]* %5, i64 0, i64 %36
%38 = load i8*, i8** %37
%39 = call i32 @strlen(i8* %38)
%40 = call i32 @put_string(i8* %34, i32 %39)
ret void
}

LLVM IR (-O2):
@.str = [70 x i8] c"insert-user-format-part arg 1 out of range (%d); should be in [1-16].\00"
@.str.1 = [69 x i8] c"insert-user-format-part arg 2 out of range (%d); should be in [1-9].\00"
define void @insert_usr_fmt_part(i32 %0, i32 %1) {
%3 = alloca [9 x i8*]
%4 = bitcast [9 x i8*]* %3 to i8*
%5 = add i32 %0, -17
%6 = icmp ult i32 %5, -16
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @io_error_msg(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %9
9: ; preds = %2, %7
%10 = add i32 %1, -17
%11 = icmp ult i32 %10, -16
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = tail call i32 @io_error_msg(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0), i32 %1)
br label %14
14: ; preds = %9, %12
%15 = add nsw i32 %0, -1
%16 = add nsw i32 %1, -1
%17 = getelementptr inbounds [9 x i8*], [9 x i8*]* %3, i64 0, i64 0
%18 = call i32 @get_usr_stats(i32 %15, i8** %17)
%19 = sext i32 %16 to i64
%20 = getelementptr inbounds [9 x i8*], [9 x i8*]* %3, i64 0, i64 %19
%21 = load i8*, i8** %20
%22 = call i32 @strlen(i8* %21)
%23 = call i32 @put_string(i8* %21, i32 %22)
ret void
}