#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 snprintf(char *, unsigned int, char *, int, ...);
int print_range(char *buf, unsigned int buflen, int a, int b) {
  if (a == b)
    return snprintf(buf, buflen, "%d", a);
  return snprintf(buf, buflen, "%d-%d", a, b);
}


x86 assembly (clang, -O0):
<print_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    1151 <print_range+0x41>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%ecx
lea    0xec1(%rip),%rdx
mov    $0x0,%al
call   1030 <snprintf@plt>
mov    %eax,-0x4(%rbp)
jmp    1170 <print_range+0x60>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
lea    0xe9a(%rip),%rdx
mov    $0x0,%al
call   1030 <snprintf@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_range>:
mov    %ecx,%r8d
mov    %edx,%ecx
cmp    %r8d,%edx
jne    1128 <print_range+0x18>
lea    0xee2(%rip),%rdx
xor    %eax,%eax
jmp    1030 <snprintf@plt>
lea    0xed1(%rip),%rdx
xor    %eax,%eax
jmp    1030 <snprintf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%d-%d\00"
define i32 @print_range(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %2, %3
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32 (i8*, i32, i8*, i32, ...) @snprintf(i8* %0, i32 %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %10
8: ; preds = %4
%9 = tail call i32 (i8*, i32, i8*, i32, ...) @snprintf(i8* %0, i32 %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %2, i32 %3)
br label %10
10: ; preds = %8, %6
%11 = phi i32 [ %7, %6 ], [ %9, %8 ]
ret i32 %11
}