#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 *, unsigned int, ...);
void lanes_to_str(char *lanes, unsigned int tx, unsigned int rx) {
  if (tx == rx) {
    if (tx < 2) {
      *lanes = '\0';
      return;
    }
    sprintf(lanes, "/x%u", tx);
  } else {
    sprintf(lanes, "/Tx%u+Rx%u", tx, rx);
  }
}


x86 assembly (clang, -O0):
<lanes_to_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    115e <lanes_to_str+0x4e>
cmpl   $0x2,-0xc(%rbp)
jae    1144 <lanes_to_str+0x34>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
jmp    1176 <lanes_to_str+0x66>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xeae(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1176 <lanes_to_str+0x66>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe96(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lanes_to_str>:
mov    %edx,%ecx
mov    %esi,%edx
cmp    %ecx,%esi
jne    1121 <lanes_to_str+0x11>
cmp    $0x1,%edx
ja     112f <lanes_to_str+0x1f>
movb   $0x0,(%rdi)
ret
lea    0xedd(%rip),%rsi
xor    %eax,%eax
jmp    1030 <sprintf@plt>
lea    0xeca(%rip),%rsi
xor    %eax,%eax
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"/x%u\00"
@.str.1 = [11 x i8] c"/Tx%u+Rx%u\00"
define void @lanes_to_str(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = load i32, i32* %6
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %19
10: ; preds = %3
%11 = load i32, i32* %5
%12 = icmp ult i32 %11, 2
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = load i8*, i8** %4
store i8 0, i8* %14
br label %24
15: ; preds = %10
%16 = load i8*, i8** %4
%17 = load i32, i32* %5
%18 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %24
19: ; preds = %3
%20 = load i8*, i8** %4
%21 = load i32, i32* %5
%22 = load i32, i32* %6
%23 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %20, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %21, i32 %22)
br label %24
24: ; preds = %13, %19, %15
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"/x%u\00"
@.str.1 = [11 x i8] c"/Tx%u+Rx%u\00"
define void @lanes_to_str(i8* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, %2
br i1 %4, label %5, label %10
5: ; preds = %3
%6 = icmp ult i32 %1, 2
br i1 %6, label %7, label %8
7: ; preds = %5
store i8 0, i8* %0
br label %12
8: ; preds = %5
%9 = tail call i32 (i8*, i8*, i32, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %1)
br label %12
10: ; preds = %3
%11 = tail call i32 (i8*, i8*, i32, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %1, i32 %2)
br label %12
12: ; preds = %7, %10, %8
ret void
}