#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, int);
const char *_res2str(int x, int y) {
  if (x > 0 && y > 0 && x < 0xffff && y < 0xffff) {
    static char str[64];
    sprintf(str, "%dx%d", x, y);
    return str;
  }
  return "";
}


x86 assembly (clang, -O0):
<_res2str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1175 <_res2str+0x65>
cmpl   $0x0,-0x10(%rbp)
jle    1175 <_res2str+0x65>
cmpl   $0xffff,-0xc(%rbp)
jge    1175 <_res2str+0x65>
cmpl   $0xffff,-0x10(%rbp)
jge    1175 <_res2str+0x65>
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0x2ee7(%rip),%rdi
lea    0xea0(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2ed4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1180 <_res2str+0x70>
lea    0xe89(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_res2str>:
push   %rbx
mov    %edi,%edx
lea    -0x1(%rdx),%eax
lea    0xee8(%rip),%rbx
cmp    $0xfffd,%eax
ja     1146 <_res2str+0x36>
mov    %esi,%ecx
lea    -0x1(%rcx),%eax
cmp    $0xfffd,%eax
ja     1146 <_res2str+0x36>
lea    0x2f09(%rip),%rbx
lea    0xec2(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@_res2str.str = internal global [64 x i8] zeroinitializer
@.str = [6 x i8] c"%dx%d\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @_res2str(i32 %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %21
8: ; preds = %2
%9 = load i32, i32* %5
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 65535
br i1 %13, label %14, label %21
14: ; preds = %11
%15 = load i32, i32* %5
%16 = icmp slt i32 %15, 65535
br i1 %16, label %17, label %21
17: ; preds = %14
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = call i32 @sprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @_res2str.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %19)
store i8* getelementptr inbounds ([64 x i8], [64 x i8]* @_res2str.str, i64 0, i64 0), i8** %3
br label %22
21: ; preds = %14, %11, %8, %2
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %22
22: ; preds = %21, %17
%23 = load i8*, i8** %3
ret i8* %23
}

LLVM IR (-O2):
@_res2str.str = internal global [64 x i8] zeroinitializer
@.str = [6 x i8] c"%dx%d\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @_res2str(i32 %0, i32 %1) {
%3 = add i32 %0, -1
%4 = icmp ult i32 %3, 65534
%5 = add i32 %1, -1
%6 = icmp ult i32 %5, 65534
%7 = and i1 %4, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @_res2str.str, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
br label %10
10: ; preds = %2, %8
%11 = phi i8* [ getelementptr inbounds ([64 x i8], [64 x i8]* @_res2str.str, i64 0, i64 0), %8 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %2 ]
ret i8* %11
}