#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 *);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  srand(time(NULL));
  int i = rand();
  int j = rand();
  if (i == 1) {
    i--;
    if (j == 0) {
    label:
      printf("1\n");
    }
  } else {
    printf("2\n");
    if (i == 2)
      goto label;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1060 <rand@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    11a6 <main+0x66>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    11a1 <main+0x61>
jmp    1195 <main+0x55>
lea    0xe64(%rip),%rdi
call   1030 <printf@plt>
jmp    11c6 <main+0x86>
lea    0xe56(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x2,-0x8(%rbp)
jne    11c1 <main+0x81>
jmp    1195 <main+0x55>
jmp    11c6 <main+0x86>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <rand@plt>
cmp    $0x1,%ebx
jne    116a <main+0x2a>
test   %eax,%eax
jne    1187 <main+0x47>
jmp    117b <main+0x3b>
lea    0xe8f(%rip),%rdi
call   1030 <puts@plt>
cmp    $0x2,%ebx
jne    1187 <main+0x47>
lea    0xe80(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"1\0A\00"
@.str.1 = [3 x i8] c"2\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @time(i32* null)
%5 = call i32 @srand(i32 %4)
%6 = call i32 (...) @rand()
store i32 %6, i32* %2
%7 = call i32 (...) @rand()
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %19
10: ; preds = %0
%11 = load i32, i32* %2
%12 = add nsw i32 %11, -1
store i32 %12, i32* %2
%13 = load i32, i32* %3
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %10
br label %16
16: ; preds = %23, %15
%17 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %10
br label %25
19: ; preds = %0
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 2
br i1 %22, label %23, label %24
23: ; preds = %19
br label %16
24: ; preds = %19
br label %25
25: ; preds = %24, %18
ret i32 0
}

LLVM IR (-O2):
@str = [2 x i8] c"2\00"
@str.2 = [2 x i8] c"1\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 (...) @rand()
%4 = tail call i32 (...) @rand()
%5 = icmp eq i32 %3, 1
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = icmp eq i32 %4, 0
br i1 %7, label %8, label %13
8: ; preds = %10, %6
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.2, i64 0, i64 0))
br label %13
10: ; preds = %0
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%12 = icmp eq i32 %3, 2
br i1 %12, label %8, label %13
13: ; preds = %10, %6, %8
ret i32 0
}