#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 */
typedef int /*<<< orphan*/ str;

/* Variables and functions */
int mysnprintf(char *, int, char *, int, int, int, int, int, int);
int /*<<< orphan*/ printf(char *, int, char *);
int main(void) {
  char str[512];
  int l, i = 0xfeab6789;
  l = mysnprintf(str, sizeof(str), "hello %d %i %u %o %x %X", i, i, i, i, i, i);
  printf("%d %s\n", l, str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xfeab6789,-0x218(%rbp)
67 ab fe
lea    -0x210(%rbp),%rdi
mov    -0x218(%rbp),%ecx
mov    -0x218(%rbp),%r8d
mov    -0x218(%rbp),%r9d
mov    -0x218(%rbp),%r11d
mov    -0x218(%rbp),%r10d
mov    -0x218(%rbp),%eax
mov    $0x200,%esi
lea    0xe89(%rip),%rdx
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1040 <mysnprintf@plt>
mov    %eax,-0x214(%rbp)
mov    -0x214(%rbp),%esi
lea    -0x210(%rbp),%rdx
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x200,%rsp
sub    $0x8,%rsp
lea    0xecd(%rip),%rdx
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x200,%esi
mov    $0xfeab6789,%ecx
mov    $0xfeab6789,%r8d
mov    $0xfeab6789,%r9d
push   $0xfffffffffeab6789
push   $0xfffffffffeab6789
push   $0xfffffffffeab6789
call   1040 <mysnprintf@plt>
add    $0x20,%rsp
lea    0xea8(%rip),%rdi
mov    %eax,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"hello %d %i %u %o %x %X\00"
@.str.1 = [7 x i8] c"%d %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [512 x i8]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 -22321271, i32* %4
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%6 = load i32, i32* %4
%7 = load i32, i32* %4
%8 = load i32, i32* %4
%9 = load i32, i32* %4
%10 = load i32, i32* %4
%11 = load i32, i32* %4
%12 = call i32 @mysnprintf(i8* %5, i32 512, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11)
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%15 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %13, i8* %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"hello %d %i %u %o %x %X\00"
@.str.1 = [7 x i8] c"%d %s\0A\00"
define i32 @main() {
%1 = alloca [512 x i8]
%2 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%3 = call i32 @mysnprintf(i8* %2, i32 512, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 -22321271, i32 -22321271, i32 -22321271, i32 -22321271, i32 -22321271, i32 -22321271)
%4 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %3, i8* %2)
ret i32 0
}