#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 get_st1_value();
int get_st2_value();
int get_st3_value();
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int val;
  val = get_st1_value();
  if (val != 5) {
    printf("st1 value was %i instead of 5\n", val);
    return -1;
  }
  val = get_st2_value();
  if (val != 4) {
    printf("st2 value was %i instead of 4\n", val);
    return -2;
  }
  val = get_st3_value();
  if (val != 3) {
    printf("st3 value was %i instead of 3\n", val);
    return -3;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <get_st1_value@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
je     117e <main+0x3e>
mov    -0x8(%rbp),%esi
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11e3 <main+0xa3>
mov    $0x0,%al
call   1030 <get_st2_value@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     11ad <main+0x6d>
mov    -0x8(%rbp),%esi
lea    0xe83(%rip),%rdi
call   1040 <printf@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    11e3 <main+0xa3>
mov    $0x0,%al
call   1050 <get_st3_value@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11dc <main+0x9c>
mov    -0x8(%rbp),%esi
lea    0xe73(%rip),%rdi
call   1040 <printf@plt>
movl   $0xfffffffd,-0x4(%rbp)
jmp    11e3 <main+0xa3>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1060 <get_st1_value@plt>
cmp    $0x5,%eax
jne    117c <main+0x3c>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <get_st2_value@plt>
cmp    $0x4,%eax
jne    1191 <main+0x51>
xor    %eax,%eax
call   1050 <get_st3_value@plt>
cmp    $0x3,%eax
je     11a4 <main+0x64>
lea    0xed0(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0xfffffffd,%ebx
jmp    11a4 <main+0x64>
lea    0xe7d(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0xffffffff,%ebx
jmp    11a4 <main+0x64>
lea    0xe87(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0xfffffffe,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"st1 value was %i instead of 5\0A\00"
@.str.1 = [31 x i8] c"st2 value was %i instead of 4\0A\00"
@.str.2 = [31 x i8] c"st3 value was %i instead of 3\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @get_st1_value()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 5
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %7)
store i32 -1, i32* %1
br label %24
9: ; preds = %0
%10 = call i32 (...) @get_st2_value()
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = icmp ne i32 %11, 4
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load i32, i32* %2
%15 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %14)
store i32 -2, i32* %1
br label %24
16: ; preds = %9
%17 = call i32 (...) @get_st3_value()
store i32 %17, i32* %2
%18 = load i32, i32* %2
%19 = icmp ne i32 %18, 3
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = load i32, i32* %2
%22 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %21)
store i32 -3, i32* %1
br label %24
23: ; preds = %16
store i32 0, i32* %1
br label %24
24: ; preds = %23, %20, %13, %6
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@.str = [31 x i8] c"st1 value was %i instead of 5\0A\00"
@.str.1 = [31 x i8] c"st2 value was %i instead of 4\0A\00"
@.str.2 = [31 x i8] c"st3 value was %i instead of 3\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @get_st1_value()
%2 = icmp eq i32 %1, 5
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %1)
br label %15
5: ; preds = %0
%6 = tail call i32 (...) @get_st2_value()
%7 = icmp eq i32 %6, 4
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %6)
br label %15
10: ; preds = %5
%11 = tail call i32 (...) @get_st3_value()
%12 = icmp eq i32 %11, 3
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %11)
br label %15
15: ; preds = %10, %13, %8, %3
%16 = phi i32 [ -1, %3 ], [ -2, %8 ], [ -3, %13 ], [ 0, %10 ]
ret i32 %16
}