#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 main(void) {
  int p;
  int q;
  for (int i = 1; i >= 0; i--)
    for (int j = 1; j >= 0; j--) {
      p = i;
      q = j;
      printf("%i\n", p || !q);
    };
  printf("+---------------------------------+\n");
  for (int i = 1; i >= 0; i--)
    for (int j = 1; j >= 0; j--) {
      p = i;
      q = j;
      printf("%i\n", p && (p == q));
    };
  printf("+---------------------------------+\n");
  for (int i = 1; i >= 0; i--)
    for (int j = 1; j >= 0; j--) {
      p = i;
      q = j;
      printf("%i\n", p && (p = q) || (p = !q));
    };
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x1,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1198 <main+0x88>
movl   $0x1,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     1185 <main+0x75>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x21(%rbp)
jne    1161 <main+0x51>
cmpl   $0x0,-0x8(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%esi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1130 <main+0x20>
jmp    118a <main+0x7a>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    111f <main+0xf>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1226 <main+0x116>
movl   $0x1,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     1213 <main+0x103>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x22(%rbp)
je     11ef <main+0xdf>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
sete   %al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
and    $0x1,%al
movzbl %al,%esi
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    11be <main+0xae>
jmp    1218 <main+0x108>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    11ad <main+0x9d>
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jl     12ce <main+0x1be>
movl   $0x1,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jl     12bb <main+0x1ab>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1280 <main+0x170>
mov    -0x8(%rbp),%ecx
mov    %ecx,-0x4(%rbp)
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x23(%rbp)
jne    1297 <main+0x187>
cmpl   $0x0,-0x8(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,%cl
and    $0x1,%cl
movzbl %cl,%ecx
mov    %ecx,-0x4(%rbp)
mov    %al,-0x23(%rbp)
mov    -0x23(%rbp),%al
and    $0x1,%al
movzbl %al,%esi
lea    0xd5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    124c <main+0x13c>
jmp    12c0 <main+0x1b0>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    123b <main+0x12b>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe99(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%i\0A\00"
@.str.1 = [37 x i8] c"+---------------------------------+\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 1, i32* %3
br label %9
9: ; preds = %33, %0
%10 = load i32, i32* %3
%11 = icmp sge i32 %10, 0
br i1 %11, label %12, label %36
12: ; preds = %9
store i32 1, i32* %4
br label %13
13: ; preds = %29, %12
%14 = load i32, i32* %4
%15 = icmp sge i32 %14, 0
br i1 %15, label %16, label %32
16: ; preds = %13
%17 = load i32, i32* %3
store i32 %17, i32* %1
%18 = load i32, i32* %4
store i32 %18, i32* %2
%19 = load i32, i32* %1
%20 = icmp ne i32 %19, 0
br i1 %20, label %25, label %21
21: ; preds = %16
%22 = load i32, i32* %2
%23 = icmp ne i32 %22, 0
%24 = xor i1 %23, true
br label %25
25: ; preds = %21, %16
%26 = phi i1 [ true, %16 ], [ %24, %21 ]
%27 = zext i1 %26 to i32
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %25
%30 = load i32, i32* %4
%31 = add nsw i32 %30, -1
store i32 %31, i32* %4
br label %13
32: ; preds = %13
br label %33
33: ; preds = %32
%34 = load i32, i32* %3
%35 = add nsw i32 %34, -1
store i32 %35, i32* %3
br label %9
36: ; preds = %9
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %5
br label %38
38: ; preds = %62, %36
%39 = load i32, i32* %5
%40 = icmp sge i32 %39, 0
br i1 %40, label %41, label %65
41: ; preds = %38
store i32 1, i32* %6
br label %42
42: ; preds = %58, %41
%43 = load i32, i32* %6
%44 = icmp sge i32 %43, 0
br i1 %44, label %45, label %61
45: ; preds = %42
%46 = load i32, i32* %5
store i32 %46, i32* %1
%47 = load i32, i32* %6
store i32 %47, i32* %2
%48 = load i32, i32* %1
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %54
50: ; preds = %45
%51 = load i32, i32* %1
%52 = load i32, i32* %2
%53 = icmp eq i32 %51, %52
br label %54
54: ; preds = %50, %45
%55 = phi i1 [ false, %45 ], [ %53, %50 ]
%56 = zext i1 %55 to i32
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %56)
br label %58
58: ; preds = %54
%59 = load i32, i32* %6
%60 = add nsw i32 %59, -1
store i32 %60, i32* %6
br label %42
61: ; preds = %42
br label %62
62: ; preds = %61
%63 = load i32, i32* %5
%64 = add nsw i32 %63, -1
store i32 %64, i32* %5
br label %38
65: ; preds = %38
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %7
br label %67
67: ; preds = %95, %65
%68 = load i32, i32* %7
%69 = icmp sge i32 %68, 0
br i1 %69, label %70, label %98
70: ; preds = %67
store i32 1, i32* %8
br label %71
71: ; preds = %91, %70
%72 = load i32, i32* %8
%73 = icmp sge i32 %72, 0
br i1 %73, label %74, label %94
74: ; preds = %71
%75 = load i32, i32* %7
store i32 %75, i32* %1
%76 = load i32, i32* %8
store i32 %76, i32* %2
%77 = load i32, i32* %1
%78 = icmp ne i32 %77, 0
br i1 %78, label %79, label %82
79: ; preds = %74
%80 = load i32, i32* %2
store i32 %80, i32* %1
%81 = icmp ne i32 %80, 0
br i1 %81, label %87, label %82
82: ; preds = %79, %74
%83 = load i32, i32* %2
%84 = icmp ne i32 %83, 0
%85 = xor i1 %84, true
%86 = zext i1 %85 to i32
store i32 %86, i32* %1
br label %87
87: ; preds = %82, %79
%88 = phi i1 [ true, %79 ], [ %85, %82 ]
%89 = zext i1 %88 to i32
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %89)
br label %91
91: ; preds = %87
%92 = load i32, i32* %8
%93 = add nsw i32 %92, -1
store i32 %93, i32* %8
br label %71
94: ; preds = %71
br label %95
95: ; preds = %94
%96 = load i32, i32* %7
%97 = add nsw i32 %96, -1
store i32 %97, i32* %7
br label %67
98: ; preds = %67
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
@str.2 = [36 x i8] c"+---------------------------------+\00"
define void @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.2, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.2, i64 0, i64 0))
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}