#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*/ db_output(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ iprintf(char *);
int siprintf(char *, char *, int, int);
int db_printf2(char *format, int i1, int i2) {
  char buf[200];
  int res = siprintf(buf, format, i1, i2);
  if (res == -1) {
    iprintf("ERROR - Debug call to sprintf failed\n");
    exit(-1);
  }
  db_output(buf);
  return res;
}


x86 assembly (clang, -O0):
<db_printf2>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    -0xe0(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1030 <siprintf@plt>
mov    %eax,-0xe4(%rbp)
cmpl   $0xffffffff,-0xe4(%rbp)
jne    1194 <db_printf2+0x54>
lea    0xe7b(%rip),%rdi
call   1060 <iprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
lea    -0xe0(%rbp),%rdi
call   1040 <db_output@plt>
mov    -0xe4(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<db_printf2>:
push   %rbx
sub    $0xd0,%rsp
mov    %edx,%ecx
mov    %esi,%edx
mov    %rdi,%rsi
mov    %rsp,%rdi
call   1030 <siprintf@plt>
cmp    $0xffffffff,%eax
je     1171 <db_printf2+0x31>
mov    %eax,%ebx
mov    %rsp,%rdi
call   1040 <db_output@plt>
mov    %ebx,%eax
add    $0xd0,%rsp
pop    %rbx
ret
lea    0xe88(%rip),%rdi
call   1060 <iprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"ERROR - Debug call to sprintf failed\0A\00"
define i32 @db_printf2(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [200 x i8]
%8 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = getelementptr inbounds [200 x i8], [200 x i8]* %7, i64 0, i64 0
%10 = load i8*, i8** %4
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = call i32 @siprintf(i8* %9, i8* %10, i32 %11, i32 %12)
store i32 %13, i32* %8
%14 = load i32, i32* %8
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %19
16: ; preds = %3
%17 = call i32 @iprintf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @exit(i32 -1)
unreachable
19: ; preds = %3
%20 = getelementptr inbounds [200 x i8], [200 x i8]* %7, i64 0, i64 0
%21 = call i32 @db_output(i8* %20)
%22 = load i32, i32* %8
ret i32 %22
}

LLVM IR (-O2):
@.str = [38 x i8] c"ERROR - Debug call to sprintf failed\0A\00"
define i32 @db_printf2(i8* %0, i32 %1, i32 %2) {
%4 = alloca [200 x i8]
%5 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%6 = call i32 @siprintf(i8* %5, i8* %0, i32 %1, i32 %2)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = call i32 @iprintf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 -1)
unreachable
11: ; preds = %3
%12 = call i32 @db_output(i8* %5)
ret i32 %6
}