#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 EXIT_SUCCESS;
int INT_MAX;
unsigned long LONG_MAX;
int /*<<< orphan*/ print(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, unsigned long);
int main(void) {
  print("10");
  print("\n \t 10");
  print("10X");
  print("X10");
  print("+10");
  print("-10");
  char buffer[1024];
  snprintf(buffer, 1024, "%d", INT_MAX);
  print(buffer);
  snprintf(buffer, 1024, "%ld", ((long)INT_MAX) + 1);
  print(buffer);
  snprintf(buffer, 1024, "%ld", LONG_MAX);
  print(buffer);
  snprintf(buffer, 1024, "%lu", ((unsigned long)LONG_MAX) + 1);
  print(buffer);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xecb(%rip),%rdi
call   1040 <print@plt>
lea    0xebb(%rip),%rdi
call   1040 <print@plt>
lea    0xeb6(%rip),%rdi
call   1040 <print@plt>
lea    0xeae(%rip),%rdi
call   1040 <print@plt>
lea    0xea6(%rip),%rdi
call   1040 <print@plt>
lea    0xe9e(%rip),%rdi
call   1040 <print@plt>
lea    -0x410(%rbp),%rdi
mov    0x2e60(%rip),%rax
movslq (%rax),%rcx
mov    $0x400,%esi
lea    0xe80(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x410(%rbp),%rdi
call   1040 <print@plt>
lea    -0x410(%rbp),%rdi
mov    0x2e32(%rip),%rax
movslq (%rax),%rcx
add    $0x1,%rcx
mov    $0x400,%esi
lea    0xe51(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x410(%rbp),%rdi
call   1040 <print@plt>
lea    -0x410(%rbp),%rdi
mov    0x2df0(%rip),%rax
mov    (%rax),%rcx
mov    $0x400,%esi
lea    0xe23(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x410(%rbp),%rdi
call   1040 <print@plt>
lea    -0x410(%rbp),%rdi
mov    0x2dc2(%rip),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    $0x400,%esi
lea    0xdf5(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x410(%rbp),%rdi
call   1040 <print@plt>
mov    0x2d8f(%rip),%rax
mov    (%rax),%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x400,%rsp
lea    0xed1(%rip),%rdi
call   1040 <print@plt>
lea    0xec1(%rip),%rdi
call   1040 <print@plt>
lea    0xebc(%rip),%rdi
call   1040 <print@plt>
lea    0xeb4(%rip),%rdi
call   1040 <print@plt>
lea    0xeac(%rip),%rdi
call   1040 <print@plt>
lea    0xea4(%rip),%rdi
call   1040 <print@plt>
mov    0x2e6d(%rip),%r14
movslq (%r14),%rcx
lea    0xe92(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <print@plt>
movslq (%r14),%rcx
add    $0x1,%rcx
lea    0xe6f(%rip),%r14
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r14,%rdx
call   1030 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <print@plt>
mov    0x2e0e(%rip),%r15
mov    (%r15),%rcx
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r14,%rdx
call   1030 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <print@plt>
mov    (%r15),%rcx
add    $0x1,%rcx
lea    0xe2b(%rip),%rdx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <print@plt>
mov    0x2dc1(%rip),%rax
mov    (%rax),%eax
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"10\00"
@.str.1 = [7 x i8] c"\0A \09 10\00"
@.str.2 = [4 x i8] c"10X\00"
@.str.3 = [4 x i8] c"X10\00"
@.str.4 = [4 x i8] c"+10\00"
@.str.5 = [4 x i8] c"-10\00"
@.str.6 = [3 x i8] c"%d\00"
@INT_MAX = global i32 0
@.str.7 = [4 x i8] c"%ld\00"
@LONG_MAX = global i64 0
@.str.8 = [4 x i8] c"%lu\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
store i32 0, i32* %1
%3 = call i32 @print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @print(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%10 = load i32, i32* @INT_MAX
%11 = sext i32 %10 to i64
%12 = call i32 @snprintf(i8* %9, i32 1024, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i64 %11)
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%14 = call i32 @print(i8* %13)
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%16 = load i32, i32* @INT_MAX
%17 = sext i32 %16 to i64
%18 = add nsw i64 %17, 1
%19 = call i32 @snprintf(i8* %15, i32 1024, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i64 %18)
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%21 = call i32 @print(i8* %20)
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%23 = load i64, i64* @LONG_MAX
%24 = call i32 @snprintf(i8* %22, i32 1024, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i64 %23)
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%26 = call i32 @print(i8* %25)
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%28 = load i64, i64* @LONG_MAX
%29 = add i64 %28, 1
%30 = call i32 @snprintf(i8* %27, i32 1024, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i64 %29)
%31 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%32 = call i32 @print(i8* %31)
%33 = load i32, i32* @EXIT_SUCCESS
ret i32 %33
}

LLVM IR (-O2):
@.str = [3 x i8] c"10\00"
@.str.1 = [7 x i8] c"\0A \09 10\00"
@.str.2 = [4 x i8] c"10X\00"
@.str.3 = [4 x i8] c"X10\00"
@.str.4 = [4 x i8] c"+10\00"
@.str.5 = [4 x i8] c"-10\00"
@.str.6 = [3 x i8] c"%d\00"
@INT_MAX = global i32 0
@.str.7 = [4 x i8] c"%ld\00"
@LONG_MAX = global i64 0
@.str.8 = [4 x i8] c"%lu\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = tail call i32 @print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @print(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%7 = tail call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%9 = load i32, i32* @INT_MAX
%10 = sext i32 %9 to i64
%11 = call i32 @snprintf(i8* %8, i32 1024, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i64 %10)
%12 = call i32 @print(i8* %8)
%13 = load i32, i32* @INT_MAX
%14 = sext i32 %13 to i64
%15 = add nsw i64 %14, 1
%16 = call i32 @snprintf(i8* %8, i32 1024, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i64 %15)
%17 = call i32 @print(i8* %8)
%18 = load i64, i64* @LONG_MAX
%19 = call i32 @snprintf(i8* %8, i32 1024, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i64 %18)
%20 = call i32 @print(i8* %8)
%21 = load i64, i64* @LONG_MAX
%22 = add i64 %21, 1
%23 = call i32 @snprintf(i8* %8, i32 1024, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i64 %22)
%24 = call i32 @print(i8* %8)
%25 = load i32, i32* @EXIT_SUCCESS
ret i32 %25
}