int print_buff(buffer, frame, string, sizebuff)
char *buffer;
char *frame;
char *string;
int *sizebuff;
{
  int size;
  if (*sizebuff > strlen(string) + 7)
    size = sprintf(buffer, frame, string);
  else
    error("* * Erro Fatal: variavel possui nome muito longo * *");
  *sizebuff -= size;
  return size;
}


x86 assembly (clang, -O0):
<print_buff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movslq (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
add    $0x7,%rcx
cmp    %rcx,%rax
jbe    118b <print_buff+0x5b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    %eax,-0x24(%rbp)
jmp    1199 <print_buff+0x69>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1040 <error@plt>
mov    -0x24(%rbp),%edx
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
sub    %edx,%ecx
mov    %ecx,(%rax)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_buff>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r13
mov    %rsi,%r15
mov    %rdi,%r12
movslq (%rcx),%rbx
mov    %rdx,%rdi
call   1030 <strlen@plt>
add    $0x7,%rax
cmp    %rbx,%rax
jae    116b <print_buff+0x3b>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1050 <sprintf@plt>
jmp    1179 <print_buff+0x49>
lea    0xe8e(%rip),%rdi
xor    %eax,%eax
call   1040 <error@plt>
sub    %eax,(%r14)
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [53 x i8] c"* * Erro Fatal: variavel possui nome muito longo * *\00"
define i32 @print_buff(i8* %0, i8* %1, i8* %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32* %3, i32** %8
%10 = load i32*, i32** %8
%11 = load i32, i32* %10
%12 = sext i32 %11 to i64
%13 = load i8*, i8** %7
%14 = call i64 @strlen(i8* %13)
%15 = add i64 %14, 7
%16 = icmp ugt i64 %12, %15
br i1 %16, label %17, label %22
17: ; preds = %4
%18 = load i8*, i8** %5
%19 = load i8*, i8** %6
%20 = load i8*, i8** %7
%21 = call i32 (i8*, i8*, ...) @sprintf(i8* %18, i8* %19, i8* %20)
store i32 %21, i32* %9
br label %24
22: ; preds = %4
%23 = call i32 (i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, ...)*)(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
br label %24
24: ; preds = %22, %17
%25 = load i32, i32* %9
%26 = load i32*, i32** %8
%27 = load i32, i32* %26
%28 = sub nsw i32 %27, %25
store i32 %28, i32* %26
%29 = load i32, i32* %9
ret i32 %29
}

LLVM IR (-O2):
@.str = [53 x i8] c"* * Erro Fatal: variavel possui nome muito longo * *\00"
define i32 @print_buff(i8* nocapture writeonly %0, i8* nocapture %1, i8* %2, i32* nocapture %3) {
%5 = load i32, i32* %3
%6 = sext i32 %5 to i64
%7 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%8 = add i64 %7, 7
%9 = icmp ult i64 %8, %6
br i1 %9, label %10, label %12
10: ; preds = %4
%11 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1, i8* %2)
br label %14
12: ; preds = %4
%13 = tail call i32 (i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, ...)*)(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %10
%15 = phi i32 [ %11, %10 ], [ undef, %12 ]
%16 = load i32, i32* %3
%17 = sub nsw i32 %16, %15
store i32 %17, i32* %3
ret i32 %15
}