#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*/ sprintf(char *, char *, char const *, int);
scalar_t__ strlen(char *);
int eti_gen(char *buf, int code, const char *name, int *etimin, int *etimax) {
  sprintf(buf, "   E_%-16s : constant Eti_Error := %d;\n", name, code);
  if (code < *etimin)
    *etimin = code;
  if (code > *etimax)
    *etimax = code;
  return (int)strlen(buf);
}


x86 assembly (clang, -O0):
<eti_gen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0xc(%rbp),%ecx
lea    0xeb3(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0xc(%rbp),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jge    116a <eti_gen+0x4a>
mov    -0xc(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jle    1182 <eti_gen+0x62>
mov    -0xc(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eti_gen>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8,%r14
mov    %rcx,%r15
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xec7(%rip),%rsi
mov    %ebp,%ecx
call   1040 <sprintf@plt>
cmp    %ebp,(%r15)
jle    1148 <eti_gen+0x28>
mov    %ebp,(%r15)
cmp    %ebp,(%r14)
jge    1150 <eti_gen+0x30>
mov    %ebp,(%r14)
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <strlen@plt>

LLVM IR (-O0):
@.str = [40 x i8] c" E_%-16s : constant Eti_Error := %d;\0A\00"
define i32 @eti_gen(i8* %0, i32 %1, i8* %2, i32* %3, i32* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i32*
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32* %3, i32** %9
store i32* %4, i32** %10
%11 = load i8*, i8** %6
%12 = load i8*, i8** %8
%13 = load i32, i32* %7
%14 = call i32 @sprintf(i8* %11, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %12, i32 %13)
%15 = load i32, i32* %7
%16 = load i32*, i32** %9
%17 = load i32, i32* %16
%18 = icmp slt i32 %15, %17
br i1 %18, label %19, label %22
19: ; preds = %5
%20 = load i32, i32* %7
%21 = load i32*, i32** %9
store i32 %20, i32* %21
br label %22
22: ; preds = %19, %5
%23 = load i32, i32* %7
%24 = load i32*, i32** %10
%25 = load i32, i32* %24
%26 = icmp sgt i32 %23, %25
br i1 %26, label %27, label %30
27: ; preds = %22
%28 = load i32, i32* %7
%29 = load i32*, i32** %10
store i32 %28, i32* %29
br label %30
30: ; preds = %27, %22
%31 = load i8*, i8** %6
%32 = call i64 @strlen(i8* %31)
%33 = trunc i64 %32 to i32
ret i32 %33
}

LLVM IR (-O2):
@.str = [40 x i8] c" E_%-16s : constant Eti_Error := %d;\0A\00"
define i32 @eti_gen(i8* nocapture %0, i32 %1, i8* %2, i32* nocapture %3, i32* nocapture %4) {
%6 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %1)
%7 = load i32, i32* %3
%8 = icmp sgt i32 %7, %1
br i1 %8, label %9, label %10
9: ; preds = %5
store i32 %1, i32* %3
br label %10
10: ; preds = %9, %5
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, %1
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 %1, i32* %4
br label %14
14: ; preds = %13, %10
%15 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%16 = trunc i64 %15 to i32
ret i32 %16
}