#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 */
typedef int off_t;

/* Variables and functions */
scalar_t__ getpid();
scalar_t__ getppid();
int /*<<< orphan*/ printf(char *);
int main(void) {
  off_t value;
  off_t value2;
  value = (off_t)getpid();
  value2 = (off_t)-1;
  if (value > (off_t)1) {
    --value;
  }
  if (value <= (off_t)getppid()) {
    --value;
  }
  if (value == value2) {
    value += value2;
  }
  value <<= 1;
  if (!value) {
    printf("/* something for the off_t to do */\n");
  }
  printf("#undef HAVE_OFF_T_SCALAR\n");
  printf("#define HAVE_OFF_T_SCALAR /* off_t is a simple value */\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1163 <main+0x33>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <getppid@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jg     1187 <main+0x57>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    119c <main+0x6c>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    11bb <main+0x8b>
lea    0xe4a(%rip),%rdi
call   1040 <printf@plt>
lea    0xe63(%rip),%rdi
call   1040 <printf@plt>
lea    0xe71(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %rax,%rbx
xor    %eax,%eax
cmp    $0x2,%ebx
setge  %al
sub    %eax,%ebx
xor    %eax,%eax
call   1050 <getppid@plt>
xor    %ecx,%ecx
cmp    %eax,%ebx
setle  %cl
sub    %ecx,%ebx
cmp    $0xffffffff,%ebx
je     116e <main+0x3e>
and    $0x7fffffff,%ebx
jne    116e <main+0x3e>
lea    0xe97(%rip),%rdi
call   1030 <puts@plt>
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"/* something for the off_t to do */\0A\00"
@.str.1 = [26 x i8] c"#undef HAVE_OFF_T_SCALAR\0A\00"
@.str.2 = [57 x i8] c"#define HAVE_OFF_T_SCALAR /* off_t is a simple value */\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i64 (...) @getpid()
%5 = trunc i64 %4 to i32
store i32 %5, i32* %2
store i32 -1, i32* %3
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 1
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = load i32, i32* %2
%10 = add nsw i32 %9, -1
store i32 %10, i32* %2
br label %11
11: ; preds = %8, %0
%12 = load i32, i32* %2
%13 = call i64 (...) @getppid()
%14 = trunc i64 %13 to i32
%15 = icmp sle i32 %12, %14
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = load i32, i32* %2
%18 = add nsw i32 %17, -1
store i32 %18, i32* %2
br label %19
19: ; preds = %16, %11
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %27
23: ; preds = %19
%24 = load i32, i32* %3
%25 = load i32, i32* %2
%26 = add nsw i32 %25, %24
store i32 %26, i32* %2
br label %27
27: ; preds = %23, %19
%28 = load i32, i32* %2
%29 = shl i32 %28, 1
store i32 %29, i32* %2
%30 = load i32, i32* %2
%31 = icmp ne i32 %30, 0
br i1 %31, label %34, label %32
32: ; preds = %27
%33 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %34
34: ; preds = %32, %27
%35 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%36 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [36 x i8] c"/* something for the off_t to do */\00"
@str.3 = [25 x i8] c"#undef HAVE_OFF_T_SCALAR\00"
@str.4 = [56 x i8] c"#define HAVE_OFF_T_SCALAR /* off_t is a simple value */\00"
define i32 @main() {
%1 = tail call i64 (...) @getpid()
%2 = trunc i64 %1 to i32
%3 = icmp sgt i32 %2, 1
%4 = sext i1 %3 to i32
%5 = add nsw i32 %4, %2
%6 = tail call i64 (...) @getppid()
%7 = trunc i64 %6 to i32
%8 = icmp sle i32 %5, %7
%9 = sext i1 %8 to i32
%10 = add nsw i32 %5, %9
%11 = icmp ne i32 %10, -1
%12 = and i32 %10, 2147483647
%13 = icmp eq i32 %12, 0
%14 = and i1 %11, %13
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
br label %17
17: ; preds = %15, %0
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.3, i64 0, i64 0))
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.4, i64 0, i64 0))
ret i32 0
}