#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, int, int, int, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
void writeFlowGraph() {
  int v = 23, e = 0, s = 1, t = 2;
  printf("%d\n%d %d\n%d\n", v, s, t, e);
  for (int i = 0; i < e; ++i) {
    int u, v, c;
    printf("%d %d %d\n", u, v, c);
  }
  fflush(stdout);
  fprintf(stderr, "Skickade iväg flödesgrafen\n");
}


x86 assembly (clang, -O0):
<writeFlowGraph>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x17,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x2,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%r8d
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a7 <writeFlowGraph+0x77>
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1176 <writeFlowGraph+0x46>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    0x2e24(%rip),%rax
mov    (%rax),%edi
lea    0xe52(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeFlowGraph>:
push   %rax
lea    0xec8(%rip),%rdi
mov    $0x17,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
xor    %r8d,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
lea    0xe9e(%rip),%rsi
pop    %rax
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"%d\0A%d %d\0A%d\0A\00"
@.str.1 = [10 x i8] c"%d %d %d\0A\00"
@stdout = global i32 0
@stderr = global i32 0
@.str.2 = [30 x i8] c"Skickade iv\C3\A4g fl\C3\B6desgrafen\0A\00"
define void @writeFlowGraph() {
%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 23, i32* %1
store i32 0, i32* %2
store i32 1, i32* %3
store i32 2, i32* %4
%9 = load i32, i32* %1
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = load i32, i32* %2
%13 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %10, i32 %11, i32 %12)
store i32 0, i32* %5
br label %14
14: ; preds = %23, %0
%15 = load i32, i32* %5
%16 = load i32, i32* %2
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %26
18: ; preds = %14
%19 = load i32, i32* %6
%20 = load i32, i32* %7
%21 = load i32, i32* %8
%22 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %19, i32 %20, i32 %21)
br label %23
23: ; preds = %18
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
br label %14
26: ; preds = %14
%27 = load i32, i32* @stdout
%28 = call i32 @fflush(i32 %27)
%29 = load i32, i32* @stderr
%30 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"%d\0A%d %d\0A%d\0A\00"
@stdout = global i32 0
@stderr = global i32 0
@.str.2 = [30 x i8] c"Skickade iv\C3\A4g fl\C3\B6desgrafen\0A\00"
define void @writeFlowGraph() {
%1 = tail call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 23, i32 1, i32 2, i32 0)
%2 = load i32, i32* @stdout
%3 = tail call i32 @fflush(i32 %2)
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
ret void
}