#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 size1();
int size2();
int main() {
  int s1, s2;
  printf("size1: %d\n", s1 = size1());
  printf("size2: %d\n", s2 = size2());
  printf("(correct output is 8, then 12)\n");
  if (s1 == 8 && s2 == 12) {
    return 0;
  } else {
    return 2;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <size1@plt>
mov    %eax,%esi
mov    %esi,-0x8(%rbp)
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <size2@plt>
mov    %eax,%esi
mov    %esi,-0xc(%rbp)
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x8,-0x8(%rbp)
jne    11a1 <main+0x71>
cmpl   $0xc,-0xc(%rbp)
jne    11a1 <main+0x71>
movl   $0x0,-0x4(%rbp)
jmp    11a8 <main+0x78>
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <size1@plt>
mov    %eax,%ebx
lea    0xead(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <size2@plt>
mov    %eax,%ebp
lea    0xe9f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9a(%rip),%rdi
call   1030 <puts@plt>
xor    $0x8,%ebx
xor    $0xc,%ebp
xor    %eax,%eax
or     %ebx,%ebp
setne  %al
add    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"size1: %d\0A\00"
@.str.1 = [11 x i8] c"size2: %d\0A\00"
@.str.2 = [32 x i8] c"(correct output is 8, then 12)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @size1()
store i32 %4, i32* %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 (...) @size2()
store i32 %6, i32* %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 8
br i1 %10, label %11, label %15
11: ; preds = %0
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 12
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 0, i32* %1
br label %16
15: ; preds = %11, %0
store i32 2, i32* %1
br label %16
16: ; preds = %15, %14
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@.str = [11 x i8] c"size1: %d\0A\00"
@.str.1 = [11 x i8] c"size2: %d\0A\00"
@str = [31 x i8] c"(correct output is 8, then 12)\00"
define i32 @main() {
%1 = tail call i32 (...) @size1()
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 (...) @size2()
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%6 = icmp eq i32 %1, 8
%7 = icmp eq i32 %3, 12
%8 = and i1 %6, %7
%9 = select i1 %8, i32 0, i32 2
ret i32 %9
}