#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 *, ...);
void ICUnsignedRangeCalculation(long long int minValue,
                                long long int maxValue) {
  if (minValue < 0 && maxValue > 0) {
    signed long long int sum = minValue + maxValue;
    if (sum == -1) {
      unsigned long long int maxUnsignedValue = maxValue * 2 + 1;
      printf("Unsigned range is [%d, %llu]\n", 0, maxUnsignedValue);
    } else {
      printf("Range is not correct\n");
    }
  } else {
    printf("Range is not correct\n");
  }
}


x86 assembly (clang, -O0):
<ICUnsignedRangeCalculation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    1189 <ICUnsignedRangeCalculation+0x79>
cmpq   $0x0,-0x10(%rbp)
jle    1189 <ICUnsignedRangeCalculation+0x79>
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0xffffffffffffffff,-0x18(%rbp)
jne    1176 <ICUnsignedRangeCalculation+0x66>
mov    -0x10(%rbp),%rax
shl    $0x1,%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdx
lea    0xe98(%rip),%rdi
xor    %esi,%esi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1184 <ICUnsignedRangeCalculation+0x74>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1197 <ICUnsignedRangeCalculation+0x87>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ICUnsignedRangeCalculation>:
test   %rdi,%rdi
jns    1133 <ICUnsignedRangeCalculation+0x13>
test   %rsi,%rsi
jle    1133 <ICUnsignedRangeCalculation+0x13>
add    %rsi,%rdi
cmp    $0xffffffffffffffff,%rdi
je     113f <ICUnsignedRangeCalculation+0x1f>
lea    0xee4(%rip),%rdi
jmp    1030 <puts@plt>
lea    (%rsi,%rsi,1),%rdx
add    $0x1,%rdx
lea    0xeb2(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"Unsigned range is [%d, %llu]\0A\00"
@.str.1 = [22 x i8] c"Range is not correct\0A\00"
define void @ICUnsignedRangeCalculation(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%7 = load i64, i64* %3
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %27
9: ; preds = %2
%10 = load i64, i64* %4
%11 = icmp sgt i64 %10, 0
br i1 %11, label %12, label %27
12: ; preds = %9
%13 = load i64, i64* %3
%14 = load i64, i64* %4
%15 = add nsw i64 %13, %14
store i64 %15, i64* %5
%16 = load i64, i64* %5
%17 = icmp eq i64 %16, -1
br i1 %17, label %18, label %24
18: ; preds = %12
%19 = load i64, i64* %4
%20 = mul nsw i64 %19, 2
%21 = add nsw i64 %20, 1
store i64 %21, i64* %6
%22 = load i64, i64* %6
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 0, i64 %22)
br label %26
24: ; preds = %12
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %26
26: ; preds = %24, %18
br label %29
27: ; preds = %9, %2
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %29
29: ; preds = %27, %26
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"Unsigned range is [%d, %llu]\0A\00"
@str.2 = [21 x i8] c"Range is not correct\00"
define void @ICUnsignedRangeCalculation(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, 0
%4 = icmp sgt i64 %1, 0
%5 = and i1 %3, %4
br i1 %5, label %6, label %15
6: ; preds = %2
%7 = add nsw i64 %1, %0
%8 = icmp eq i64 %7, -1
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = shl nuw nsw i64 %1, 1
%11 = or i64 %10, 1
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 0, i64 %11)
br label %17
13: ; preds = %6
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.2, i64 0, i64 0))
br label %17
15: ; preds = %2
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.2, i64 0, i64 0))
br label %17
17: ; preds = %9, %13, %15
ret void
}