#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 *, char *);
char *prj_get_language();
int prj_get_numpackages();
char *prj_get_pkgname();
scalar_t__ prj_is_lang(char *);
int /*<<< orphan*/ prj_select_package(int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ vs6_cpp();
int writeWorkspace();
int vs6_generate() {
  int i;
  puts("Generating Visual Studio 6 workspace and project files:");
  for (i = 0; i < prj_get_numpackages(); ++i) {
    prj_select_package(i);
    printf("...%s\n", prj_get_pkgname());
    if (prj_is_lang("c++") || prj_is_lang("c")) {
      vs6_cpp();
    } else if (prj_is_lang("c#")) {
      puts("** Error: C# projects are not supported by Visual Studio 6");
      return 0;
    } else {
      printf("** Error: unrecognized language '%s'\n", prj_get_language());
      return 0;
    }
  }
  return writeWorkspace();
}


x86 assembly (clang, -O0):
<vs6_generate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe61(%rip),%rdi
call   1050 <puts@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1080 <prj_get_numpackages@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cmp    %ecx,%eax
jge    127e <vs6_generate+0xee>
mov    -0x8(%rbp),%edi
call   10b0 <prj_select_package@plt>
mov    $0x0,%al
call   10a0 <prj_get_pkgname@plt>
mov    %rax,%rsi
lea    0xe5a(%rip),%rdi
call   1070 <printf@plt>
lea    0xe55(%rip),%rdi
call   1040 <prj_is_lang@plt>
cmp    $0x0,%rax
jne    120f <vs6_generate+0x7f>
lea    0xe43(%rip),%rdi
call   1040 <prj_is_lang@plt>
cmp    $0x0,%rax
je     121b <vs6_generate+0x8b>
mov    $0x0,%al
call   1090 <vs6_cpp@plt>
jmp    126b <vs6_generate+0xdb>
lea    0xe23(%rip),%rdi
call   1040 <prj_is_lang@plt>
cmp    $0x0,%rax
je     1249 <vs6_generate+0xb9>
lea    0xe10(%rip),%rdi
call   1050 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    1288 <vs6_generate+0xf8>
mov    $0x0,%al
call   1060 <prj_get_language@plt>
mov    %rax,%rsi
lea    0xe29(%rip),%rdi
call   1070 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1288 <vs6_generate+0xf8>
jmp    1270 <vs6_generate+0xe0>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11ab <vs6_generate+0x1b>
mov    $0x0,%al
call   1030 <writeWorkspace@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vs6_generate>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xe62(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1080 <prj_get_numpackages@plt>
test   %eax,%eax
jle    1237 <vs6_generate+0xa7>
lea    0xe7f(%rip),%r14
lea    0xe7f(%rip),%rbx
lea    0xe7c(%rip),%r15
xor    %ebp,%ebp
jmp    11e5 <vs6_generate+0x55>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1090 <vs6_cpp@plt>
add    $0x1,%ebp
xor    %eax,%eax
call   1080 <prj_get_numpackages@plt>
cmp    %eax,%ebp
jge    1237 <vs6_generate+0xa7>
mov    %ebp,%edi
call   10b0 <prj_select_package@plt>
xor    %eax,%eax
call   10a0 <prj_get_pkgname@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1040 <prj_is_lang@plt>
test   %rax,%rax
jne    11d0 <vs6_generate+0x40>
mov    %r15,%rdi
call   1040 <prj_is_lang@plt>
test   %rax,%rax
jne    11d0 <vs6_generate+0x40>
lea    0xe26(%rip),%rdi
call   1040 <prj_is_lang@plt>
test   %rax,%rax
je     1248 <vs6_generate+0xb8>
lea    0xe18(%rip),%rdi
call   1050 <puts@plt>
jmp    125e <vs6_generate+0xce>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <writeWorkspace@plt>
xor    %eax,%eax
call   1060 <prj_get_language@plt>
lea    0xe2d(%rip),%rdi
mov    %rax,%rsi
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [56 x i8] c"Generating Visual Studio 6 workspace and project files:\00"
@.str.1 = [7 x i8] c"...%s\0A\00"
@.str.2 = [4 x i8] c"c++\00"
@.str.3 = [2 x i8] c"c\00"
@.str.4 = [3 x i8] c"c#\00"
@.str.5 = [59 x i8] c"** Error: C# projects are not supported by Visual Studio 6\00"
@.str.6 = [38 x i8] c"** Error: unrecognized language '%s'\0A\00"
define i32 @vs6_generate() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @puts(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %4
4: ; preds = %29, %0
%5 = load i32, i32* %2
%6 = call i32 (...) @prj_get_numpackages()
%7 = icmp slt i32 %5, %6
br i1 %7, label %8, label %32
8: ; preds = %4
%9 = load i32, i32* %2
%10 = call i32 @prj_select_package(i32 %9)
%11 = call i8* (...) @prj_get_pkgname()
%12 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = call i64 @prj_is_lang(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp ne i64 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %8
%16 = call i64 @prj_is_lang(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15, %8
%19 = call i32 (...) @vs6_cpp()
br label %28
20: ; preds = %15
%21 = call i64 @prj_is_lang(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 @puts(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %1
br label %34
25: ; preds = %20
%26 = call i8* (...) @prj_get_language()
%27 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i8* %26)
store i32 0, i32* %1
br label %34
28: ; preds = %18
br label %29
29: ; preds = %28
%30 = load i32, i32* %2
%31 = add nsw i32 %30, 1
store i32 %31, i32* %2
br label %4
32: ; preds = %4
%33 = call i32 (...) @writeWorkspace()
store i32 %33, i32* %1
br label %34
34: ; preds = %32, %25, %23
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
@.str = [56 x i8] c"Generating Visual Studio 6 workspace and project files:\00"
@.str.1 = [7 x i8] c"...%s\0A\00"
@.str.2 = [4 x i8] c"c++\00"
@.str.3 = [2 x i8] c"c\00"
@.str.4 = [3 x i8] c"c#\00"
@.str.5 = [59 x i8] c"** Error: C# projects are not supported by Visual Studio 6\00"
@.str.6 = [38 x i8] c"** Error: unrecognized language '%s'\0A\00"
define i32 @vs6_generate() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @prj_get_numpackages()
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %27
4: ; preds = %0, %14
%5 = phi i32 [ %16, %14 ], [ 0, %0 ]
%6 = tail call i32 @prj_select_package(i32 %5)
%7 = tail call i8* (...) @prj_get_pkgname()
%8 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = tail call i64 @prj_is_lang(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %4
%12 = tail call i64 @prj_is_lang(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %19, label %14
14: ; preds = %11, %4
%15 = tail call i32 (...) @vs6_cpp()
%16 = add nuw nsw i32 %5, 1
%17 = tail call i32 (...) @prj_get_numpackages()
%18 = icmp slt i32 %16, %17
br i1 %18, label %4, label %27
19: ; preds = %11
%20 = tail call i64 @prj_is_lang(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %19
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.5, i64 0, i64 0))
br label %29
24: ; preds = %19
%25 = tail call i8* (...) @prj_get_language()
%26 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i8* %25)
br label %29
27: ; preds = %14, %0
%28 = tail call i32 (...) @writeWorkspace()
br label %29
29: ; preds = %27, %24, %22
%30 = phi i32 [ 0, %22 ], [ 0, %24 ], [ %28, %27 ]
ret i32 %30
}