#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 sprintf(char *, char *, int);
int entvalt(char *buf, int type, int what) {
  int len;
  if (type <= 4)
    len = sprintf(buf, "value[%d]", what);
  else if (type == 131)
    len = sprintf(buf, "lval[%d]", what);
  else
    len = sprintf(buf, "%d", what);
  return len;
}


x86 assembly (clang, -O0):
<entvalt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x4,-0xc(%rbp)
jg     1147 <entvalt+0x37>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%edx
lea    0xec6(%rip),%rsi
call   1030 <sprintf@plt>
mov    %eax,-0x14(%rbp)
jmp    118a <entvalt+0x7a>
cmpl   $0x83,-0xc(%rbp)
jne    116f <entvalt+0x5f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%edx
lea    0xea8(%rip),%rsi
call   1030 <sprintf@plt>
mov    %eax,-0x14(%rbp)
jmp    1185 <entvalt+0x75>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%edx
lea    0xe96(%rip),%rsi
call   1030 <sprintf@plt>
mov    %eax,-0x14(%rbp)
jmp    118a <entvalt+0x7a>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<entvalt>:
cmp    $0x83,%esi
lea    0xeed(%rip),%rax
lea    0xeef(%rip),%rcx
cmove  %rax,%rcx
cmp    $0x5,%esi
lea    0xece(%rip),%rsi
cmovge %rcx,%rsi
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"value[%d]\00"
@.str.1 = [9 x i8] c"lval[%d]\00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @entvalt(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = icmp sle i32 %8, 4
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = load i8*, i8** %4
%12 = load i32, i32* %6
%13 = call i32 @sprintf(i8* %11, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %12)
store i32 %13, i32* %7
br label %26
14: ; preds = %3
%15 = load i32, i32* %5
%16 = icmp eq i32 %15, 131
br i1 %16, label %17, label %21
17: ; preds = %14
%18 = load i8*, i8** %4
%19 = load i32, i32* %6
%20 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %19)
store i32 %20, i32* %7
br label %25
21: ; preds = %14
%22 = load i8*, i8** %4
%23 = load i32, i32* %6
%24 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %23)
store i32 %24, i32* %7
br label %25
25: ; preds = %21, %17
br label %26
26: ; preds = %25, %10
%27 = load i32, i32* %7
ret i32 %27
}

LLVM IR (-O2):
@.str = [10 x i8] c"value[%d]\00"
@.str.1 = [9 x i8] c"lval[%d]\00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @entvalt(i8* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, 5
%5 = icmp eq i32 %1, 131
%6 = select i1 %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%7 = select i1 %4, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %6
%8 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) %7, i32 %2)
ret i32 %8
}