#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 /*<<< orphan*/ c;
typedef int /*<<< orphan*/ b;
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
int read(int /*<<< orphan*/, int *, int);
int main(int argc, char *argv[], char *envp[]) {
  int a;
  int b;
  int c;
  int x = 0;
  int y = 0;
  int z = 0;
  if (read(0, &a, sizeof(a)) != sizeof(a)) {
    printf("Error reading stdin!");
    exit(-1);
  }
  if (read(0, &b, sizeof(b)) != sizeof(b)) {
    printf("Error reading stdin!");
    exit(-1);
  }
  if (read(0, &c, sizeof(c)) != sizeof(c)) {
    printf("Error reading stdin!");
    exit(-1);
  }
  if (a) {
    x = -2;
  }
  if (b < 5) {
    if (!a && c) {
      y = 1;
    }
    z = 2;
  }
  if (x + y + z == 3) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
xor    %edi,%edi
lea    -0x1c(%rbp),%rsi
mov    $0x4,%edx
call   1040 <read@plt>
cltq
cmp    $0x4,%rax
je     1191 <main+0x61>
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
xor    %edi,%edi
lea    -0x20(%rbp),%rsi
mov    $0x4,%edx
call   1040 <read@plt>
cltq
cmp    $0x4,%rax
je     11c3 <main+0x93>
lea    0xe4c(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
xor    %edi,%edi
lea    -0x24(%rbp),%rsi
mov    $0x4,%edx
call   1040 <read@plt>
cltq
cmp    $0x4,%rax
je     11f5 <main+0xc5>
lea    0xe1a(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
cmpl   $0x0,-0x1c(%rbp)
je     1206 <main+0xd6>
movl   $0xfffffffe,-0x28(%rbp)
cmpl   $0x5,-0x20(%rbp)
jge    1232 <main+0x102>
cmpl   $0x0,-0x1c(%rbp)
jne    122b <main+0xfb>
cmpl   $0x0,-0x24(%rbp)
je     122b <main+0xfb>
movl   $0x1,-0x2c(%rbp)
movl   $0x2,-0x30(%rbp)
mov    -0x28(%rbp),%eax
add    -0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
cmp    $0x3,%eax
jne    1250 <main+0x120>
movl   $0xffffffff,-0x4(%rbp)
jmp    1257 <main+0x127>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0x14(%rsp),%rsi
xor    %edi,%edi
mov    $0x4,%edx
call   1040 <read@plt>
cmp    $0x4,%eax
jne    11b0 <main+0x80>
lea    0x10(%rsp),%rsi
xor    %edi,%edi
mov    $0x4,%edx
call   1040 <read@plt>
cmp    $0x4,%eax
jne    11b0 <main+0x80>
lea    0xc(%rsp),%rsi
xor    %edi,%edi
mov    $0x4,%edx
call   1040 <read@plt>
cmp    $0x4,%eax
jne    11b0 <main+0x80>
xor    %eax,%eax
cmpl   $0x0,0x14(%rsp)
sete   %al
xor    %ecx,%ecx
cmpl   $0x5,0x10(%rsp)
setl   %cl
lea    (%rcx,%rcx,1),%edx
lea    (%rdx,%rax,2),%esi
cmpl   $0x0,0xc(%rsp)
setne  %dl
and    %al,%cl
and    %dl,%cl
movzbl %cl,%ecx
or     %esi,%ecx
xor    %eax,%eax
cmp    $0x5,%ecx
sete   %al
neg    %eax
add    $0x18,%rsp
ret
lea    0xe49(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Error reading stdin!\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
store i32 0, i32* %11
store i32 0, i32* %12
store i32 0, i32* %13
%14 = call i32 @read(i32 0, i32* %8, i32 4)
%15 = sext i32 %14 to i64
%16 = icmp ne i64 %15, 4
br i1 %16, label %17, label %20
17: ; preds = %3
%18 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @exit(i32 -1)
unreachable
20: ; preds = %3
%21 = call i32 @read(i32 0, i32* %9, i32 4)
%22 = sext i32 %21 to i64
%23 = icmp ne i64 %22, 4
br i1 %23, label %24, label %27
24: ; preds = %20
%25 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%26 = call i32 @exit(i32 -1)
unreachable
27: ; preds = %20
%28 = call i32 @read(i32 0, i32* %10, i32 4)
%29 = sext i32 %28 to i64
%30 = icmp ne i64 %29, 4
br i1 %30, label %31, label %34
31: ; preds = %27
%32 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%33 = call i32 @exit(i32 -1)
unreachable
34: ; preds = %27
%35 = load i32, i32* %8
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %34
store i32 -2, i32* %11
br label %38
38: ; preds = %37, %34
%39 = load i32, i32* %9
%40 = icmp slt i32 %39, 5
br i1 %40, label %41, label %49
41: ; preds = %38
%42 = load i32, i32* %8
%43 = icmp ne i32 %42, 0
br i1 %43, label %48, label %44
44: ; preds = %41
%45 = load i32, i32* %10
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %48
47: ; preds = %44
store i32 1, i32* %12
br label %48
48: ; preds = %47, %44, %41
store i32 2, i32* %13
br label %49
49: ; preds = %48, %38
%50 = load i32, i32* %11
%51 = load i32, i32* %12
%52 = add nsw i32 %50, %51
%53 = load i32, i32* %13
%54 = add nsw i32 %52, %53
%55 = icmp eq i32 %54, 3
br i1 %55, label %56, label %57
56: ; preds = %49
store i32 -1, i32* %4
br label %58
57: ; preds = %49
store i32 0, i32* %4
br label %58
58: ; preds = %57, %56
%59 = load i32, i32* %4
ret i32 %59
}

LLVM IR (-O2):
@.str = [21 x i8] c"Error reading stdin!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = bitcast i32* %6 to i8*
%10 = call i32 @read(i32 0, i32* %4, i32 4)
%11 = icmp eq i32 %10, 4
br i1 %11, label %15, label %12
12: ; preds = %3
%13 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%14 = tail call i32 @exit(i32 -1)
unreachable
15: ; preds = %3
%16 = call i32 @read(i32 0, i32* %5, i32 4)
%17 = icmp eq i32 %16, 4
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%20 = tail call i32 @exit(i32 -1)
unreachable
21: ; preds = %15
%22 = call i32 @read(i32 0, i32* %6, i32 4)
%23 = icmp eq i32 %22, 4
br i1 %23, label %27, label %24
24: ; preds = %21
%25 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%26 = tail call i32 @exit(i32 -1)
unreachable
27: ; preds = %21
%28 = load i32, i32* %4
%29 = icmp eq i32 %28, 0
%30 = select i1 %29, i32 0, i32 -2
%31 = load i32, i32* %5
%32 = icmp slt i32 %31, 5
%33 = load i32, i32* %6
%34 = icmp ne i32 %33, 0
%35 = select i1 %32, i1 %29, i1 false
%36 = select i1 %35, i1 %34, i1 false
%37 = zext i1 %36 to i32
%38 = select i1 %32, i32 2, i32 0
%39 = add nsw i32 %38, %30
%40 = or i32 %39, %37
%41 = icmp eq i32 %40, 3
%42 = sext i1 %41 to i32
ret i32 %42
}