#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*/ sprintf(char *, char *, int);
const char *get_house_number__str(int i) {
  static char s_str[12];
  static int s_i = -1;
  if (i < 0)
    s_str[0] = '\0';
  else {
    if (s_i != i)
      sprintf(s_str, "%d", i);
  }
  s_i = i;
  return s_str;
}


x86 assembly (clang, -O0):
<get_house_number__str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1131 <get_house_number__str+0x21>
movb   $0x0,0x2f01(%rip)
jmp    115b <get_house_number__str+0x4b>
mov    0x2ef1(%rip),%eax
cmp    -0x4(%rbp),%eax
je     1156 <get_house_number__str+0x46>
mov    -0x4(%rbp),%edx
lea    0x2ee3(%rip),%rdi
lea    0xeaf(%rip),%rsi
call   1030 <sprintf@plt>
jmp    115b <get_house_number__str+0x4b>
mov    -0x4(%rbp),%eax
mov    %eax,0x2ec4(%rip)
lea    0x2ec2(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_house_number__str>:
push   %rbx
mov    %edi,%ebx
test   %edi,%edi
js     1136 <get_house_number__str+0x26>
cmp    %ebx,0x2f0b(%rip)
je     113d <get_house_number__str+0x2d>
lea    0x2f07(%rip),%rdi
lea    0xed3(%rip),%rsi
mov    %ebx,%edx
call   1030 <sprintf@plt>
jmp    113d <get_house_number__str+0x2d>
movb   $0x0,0x2ef0(%rip)
mov    %ebx,0x2ee5(%rip)
lea    0x2ee3(%rip),%rax
pop    %rbx
ret

LLVM IR (-O0):
@get_house_number__str.s_str = internal global [12 x i8] zeroinitializer
@get_house_number__str.s_i = internal global i32 -1
@.str = [3 x i8] c"%d\00"
define i8* @get_house_number__str(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
store i8 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @get_house_number__str.s_str, i64 0, i64 0)
br label %14
6: ; preds = %1
%7 = load i32, i32* @get_house_number__str.s_i
%8 = load i32, i32* %2
%9 = icmp ne i32 %7, %8
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = load i32, i32* %2
%12 = call i32 @sprintf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @get_house_number__str.s_str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %10, %6
br label %14
14: ; preds = %13, %5
%15 = load i32, i32* %2
store i32 %15, i32* @get_house_number__str.s_i
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @get_house_number__str.s_str, i64 0, i64 0)
}

LLVM IR (-O2):
@get_house_number__str.s_str = internal global [12 x i8] zeroinitializer
@get_house_number__str.s_i = internal unnamed_addr global i32 -1
@.str = [3 x i8] c"%d\00"
define i8* @get_house_number__str(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %3, label %4
3: ; preds = %1
store i8 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @get_house_number__str.s_str, i64 0, i64 0)
br label %9
4: ; preds = %1
%5 = load i32, i32* @get_house_number__str.s_i
%6 = icmp eq i32 %5, %0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @get_house_number__str.s_str, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %9
9: ; preds = %4, %7, %3
store i32 %0, i32* @get_house_number__str.s_i
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @get_house_number__str.s_str, i64 0, i64 0)
}