#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*/ CHAR_MIN;
int /*<<< orphan*/ INT_MIN;
int /*<<< orphan*/ SHRT_MIN;
char *int2str(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ printf(char *, char *);
void tst_min_2() {
  char buf_int2str[34] = "";
  printf("min 2#%s\n", int2str(CHAR_MIN, buf_int2str, 2));
  printf("min 2#%s\n", int2str(SHRT_MIN, buf_int2str, 2));
  printf("min 2#%s\n", int2str(INT_MIN, buf_int2str, 2));
}


x86 assembly (clang, -O0):
<tst_min_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x22,%edx
call   1050 <memset@plt>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    -0x30(%rbp),%rsi
mov    $0x2,%edx
call   1030 <int2str@plt>
mov    %rax,%rsi
lea    0xe97(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
lea    -0x30(%rbp),%rsi
mov    $0x2,%edx
call   1030 <int2str@plt>
mov    %rax,%rsi
lea    0xe71(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e45(%rip),%rax
mov    (%rax),%edi
lea    -0x30(%rbp),%rsi
mov    $0x2,%edx
call   1030 <int2str@plt>
mov    %rax,%rsi
lea    0xe4b(%rip),%rdi
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tst_min_2>:
push   %r14
push   %rbx
sub    $0x28,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movw   $0x0,0x20(%rsp)
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%r14
mov    %r14,%rsi
mov    $0x2,%edx
call   1030 <int2str@plt>
lea    0xea6(%rip),%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
mov    %r14,%rsi
mov    $0x2,%edx
call   1030 <int2str@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
mov    %r14,%rsi
mov    $0x2,%edx
call   1030 <int2str@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [10 x i8] c"min 2#%s\0A\00"
@CHAR_MIN = global i32 0
@SHRT_MIN = global i32 0
@INT_MIN = global i32 0
define void @tst_min_2() {
%1 = alloca [34 x i8]
%2 = bitcast [34 x i8]* %1 to i8*
%3 = load i32, i32* @CHAR_MIN
%4 = getelementptr inbounds [34 x i8], [34 x i8]* %1, i64 0, i64 0
%5 = call i8* @int2str(i32 %3, i8* %4, i32 2)
%6 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i32, i32* @SHRT_MIN
%8 = getelementptr inbounds [34 x i8], [34 x i8]* %1, i64 0, i64 0
%9 = call i8* @int2str(i32 %7, i8* %8, i32 2)
%10 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i32, i32* @INT_MIN
%12 = getelementptr inbounds [34 x i8], [34 x i8]* %1, i64 0, i64 0
%13 = call i8* @int2str(i32 %11, i8* %12, i32 2)
%14 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %13)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"min 2#%s\0A\00"
@CHAR_MIN = global i32 0
@SHRT_MIN = global i32 0
@INT_MIN = global i32 0
define void @tst_min_2() {
%1 = alloca [34 x i8]
%2 = getelementptr inbounds [34 x i8], [34 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @CHAR_MIN
%4 = call i8* @int2str(i32 %3, i8* %2, i32 2)
%5 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @SHRT_MIN
%7 = call i8* @int2str(i32 %6, i8* %2, i32 2)
%8 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i32, i32* @INT_MIN
%10 = call i8* @int2str(i32 %9, i8* %2, i32 2)
%11 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %10)
ret void
}