#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*/ printf(char *, long, ...);
int range(long a, int b) {
  if (b == 16384)
    printf("%ld,$", a);
  else if (b == 0)
    printf("%ld", a);
  else
    printf("%ld,%ld", a, a + b);
}


x86 assembly (clang, -O0):
<range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x4000,-0x14(%rbp)
jne    1143 <range+0x33>
mov    -0x10(%rbp),%rsi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1186 <range+0x76>
cmpl   $0x0,-0x14(%rbp)
jne    1164 <range+0x54>
mov    -0x10(%rbp),%rsi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1181 <range+0x71>
mov    -0x10(%rbp),%rsi
mov    -0x10(%rbp),%rdx
movslq -0x14(%rbp),%rax
add    %rax,%rdx
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1186 <range+0x76>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<range>:
push   %rax
mov    %rdi,%rax
test   %esi,%esi
je     1129 <range+0x19>
cmp    $0x4000,%esi
jne    113c <range+0x2c>
lea    0xed9(%rip),%rdi
jmp    1130 <range+0x20>
lea    0xeda(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
pop    %rcx
ret
movslq %esi,%rdx
add    %rax,%rdx
lea    0xebd(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%ld,$\00"
@.str.1 = [4 x i8] c"%ld\00"
@.str.2 = [8 x i8] c"%ld,%ld\00"
define i32 @range(i64 %0, i32 %1) {
switch i32 %1, label %7 [
i32 16384, label %3
i32 0, label %5
]
3: ; preds = %2
%4 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %0)
br label %11
5: ; preds = %2
%6 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %0)
br label %11
7: ; preds = %2
%8 = sext i32 %1 to i64
%9 = add nsw i64 %8, %0
%10 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i64 %0, i64 %9)
br label %11
11: ; preds = %5, %7, %3
ret i32 undef
}