#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*/ exit(int);
int /*<<< orphan*/ printf(char *, int);
void foo(int invok) {
  static const int honour_longs = (4 > 4) || (4 > 4);
  static int bar = 0;
  if (invok == 0) {
    if (honour_longs != 0) {
      printf("Error %d\n", (int)1);
      exit(1);
    };
    if (bar != 0) {
      printf("Error %d\n", (int)2);
      exit(2);
    };
    bar = 1;
    return;
  }
  if (bar != 1) {
    printf("Error %d\n", (int)3);
    exit(3);
  };
  return;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    116c <foo+0x4c>
cmpl   $0x0,0x2ef8(%rip)
je     115d <foo+0x3d>
lea    0xebb(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>
movl   $0x1,0x2ecd(%rip)
jmp    1199 <foo+0x79>
cmpl   $0x1,0x2ec1(%rip)
je     1194 <foo+0x74>
lea    0xe84(%rip),%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    $0x3,%edi
call   1040 <exit@plt>
jmp    1199 <foo+0x79>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
mov    0x2f0d(%rip),%al
test   %edi,%edi
je     1131 <foo+0x11>
test   $0x1,%al
je     113e <foo+0x1e>
pop    %rax
ret
test   $0x1,%al
jne    1159 <foo+0x39>
movb   $0x1,0x2ef8(%rip)
pop    %rax
ret
lea    0xebb(%rip),%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    $0x3,%edi
call   1040 <exit@plt>
lea    0xea0(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@foo.honour_longs = internal constant i32 0
@foo.bar = internal global i32 0
@.str = [10 x i8] c"Error %d\0A\00"
define void @foo(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = load i32, i32* @foo.bar
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 2)
%10 = call i32 @exit(i32 2)
unreachable
11: ; preds = %5
store i32 1, i32* @foo.bar
br label %19
12: ; preds = %1
%13 = load i32, i32* @foo.bar
%14 = icmp ne i32 %13, 1
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 3)
%17 = call i32 @exit(i32 3)
unreachable
18: ; preds = %12
br label %19
19: ; preds = %18, %11
ret void
}

LLVM IR (-O2):
@foo.bar = internal unnamed_addr global i1 false
@.str = [10 x i8] c"Error %d\0A\00"
define void @foo(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = load i1, i1* @foo.bar
br i1 %2, label %4, label %9
4: ; preds = %1
br i1 %3, label %5, label %8
5: ; preds = %4
%6 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 2)
%7 = tail call i32 @exit(i32 2)
unreachable
8: ; preds = %4
store i1 true, i1* @foo.bar
br label %13
9: ; preds = %1
br i1 %3, label %13, label %10
10: ; preds = %9
%11 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 3)
%12 = tail call i32 @exit(i32 3)
unreachable
13: ; preds = %9, %8
ret void
}