#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 geral_verificarExistencia(char *);
int /*<<< orphan*/ strcat(int /*<<< orphan*/, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int system(char *);
int geral_criarPasta(char pasta[]) {
  char temp[255];
  if (geral_verificarExistencia(pasta) == 2) {
    if (strcmp("Linux", "Linux") == 0) {
      strcat(strcat(strcpy(temp, "mkdir -p \""), pasta), "\"");
      if ((system(temp)) != -1) {
        return 1;
      }
    } else if (strcmp("Linux", "Windows") == 0) {
      strcat(
          strcat(strcpy(temp, "@echo off & setlocal enableextensions & md \""),
                 pasta),
          "\" & endlocal");
      if ((system(temp)) != -1) {
        return 1;
      }
    }
    return 2;
  }
  return 3;
}


x86 assembly (clang, -O0):
<geral_criarPasta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <geral_verificarExistencia@plt>
cmp    $0x2,%eax
jne    125c <geral_criarPasta+0x10c>
lea    0xe88(%rip),%rsi
mov    %rsi,%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11dc <geral_criarPasta+0x8c>
lea    -0x110(%rbp),%rdi
lea    0xe6e(%rip),%rsi
call   1030 <strcpy@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
call   1060 <strcat@plt>
mov    %eax,%edi
lea    0xe93(%rip),%rsi
call   1060 <strcat@plt>
lea    -0x110(%rbp),%rdi
call   1040 <system@plt>
cmp    $0xffffffff,%eax
je     11d7 <geral_criarPasta+0x87>
movl   $0x1,-0x4(%rbp)
jmp    1263 <geral_criarPasta+0x113>
jmp    1250 <geral_criarPasta+0x100>
lea    0xe1d(%rip),%rdi
lea    0xe27(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    124b <geral_criarPasta+0xfb>
lea    -0x110(%rbp),%rdi
lea    0xe12(%rip),%rsi
call   1030 <strcpy@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
call   1060 <strcat@plt>
mov    %eax,%edi
lea    0xe26(%rip),%rsi
call   1060 <strcat@plt>
lea    -0x110(%rbp),%rdi
call   1040 <system@plt>
cmp    $0xffffffff,%eax
je     1246 <geral_criarPasta+0xf6>
movl   $0x1,-0x4(%rbp)
jmp    1263 <geral_criarPasta+0x113>
jmp    124b <geral_criarPasta+0xfb>
jmp    1250 <geral_criarPasta+0x100>
movl   $0x2,-0x4(%rbp)
jmp    1263 <geral_criarPasta+0x113>
movl   $0x3,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geral_criarPasta>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rdi,%rbx
call   1070 <geral_verificarExistencia@plt>
mov    %eax,%ecx
mov    $0x3,%eax
cmp    $0x2,%ecx
jne    1206 <geral_criarPasta+0xb6>
lea    0xe87(%rip),%rdi
mov    %rdi,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11c3 <geral_criarPasta+0x73>
lea    0xe73(%rip),%rdi
lea    0xe7d(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    1201 <geral_criarPasta+0xb1>
lea    0xe74(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <strcat@plt>
lea    0xe85(%rip),%rsi
jmp    11e6 <geral_criarPasta+0x96>
lea    0xe3c(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <strcat@plt>
lea    0xe5e(%rip),%rsi
mov    %eax,%edi
call   1060 <strcat@plt>
mov    %r14,%rdi
call   1040 <system@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0xffffffff,%ecx
jne    1206 <geral_criarPasta+0xb6>
mov    $0x2,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"Linux\00"
@.str.1 = [11 x i8] c"mkdir -p \22\00"
@.str.2 = [2 x i8] c"\22\00"
@.str.3 = [8 x i8] c"Windows\00"
@.str.4 = [45 x i8] c"@echo off & setlocal enableextensions & md \22\00"
@.str.5 = [13 x i8] c"\22 & endlocal\00"
define i32 @geral_criarPasta(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [255 x i8]
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @geral_verificarExistencia(i8* %5)
%7 = icmp eq i32 %6, 2
br i1 %7, label %8, label %38
8: ; preds = %1
%9 = call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %22
11: ; preds = %8
%12 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%13 = call i32 @strcpy(i8* %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%14 = load i8*, i8** %3
%15 = call i32 @strcat(i32 %13, i8* %14)
%16 = call i32 @strcat(i32 %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%18 = call i32 @system(i8* %17)
%19 = icmp ne i32 %18, -1
br i1 %19, label %20, label %21
20: ; preds = %11
store i32 1, i32* %2
br label %39
21: ; preds = %11
br label %37
22: ; preds = %8
%23 = call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %36
25: ; preds = %22
%26 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%27 = call i32 @strcpy(i8* %26, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0))
%28 = load i8*, i8** %3
%29 = call i32 @strcat(i32 %27, i8* %28)
%30 = call i32 @strcat(i32 %29, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%31 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%32 = call i32 @system(i8* %31)
%33 = icmp ne i32 %32, -1
br i1 %33, label %34, label %35
34: ; preds = %25
store i32 1, i32* %2
br label %39
35: ; preds = %25
br label %36
36: ; preds = %35, %22
br label %37
37: ; preds = %36, %21
store i32 2, i32* %2
br label %39
38: ; preds = %1
store i32 3, i32* %2
br label %39
39: ; preds = %38, %37, %34, %20
%40 = load i32, i32* %2
ret i32 %40
}

LLVM IR (-O2):
@.str = [6 x i8] c"Linux\00"
@.str.1 = [11 x i8] c"mkdir -p \22\00"
@.str.2 = [2 x i8] c"\22\00"
@.str.3 = [8 x i8] c"Windows\00"
@.str.4 = [45 x i8] c"@echo off & setlocal enableextensions & md \22\00"
@.str.5 = [13 x i8] c"\22 & endlocal\00"
define i32 @geral_criarPasta(i8* %0) {
%2 = alloca [255 x i8]
%3 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @geral_verificarExistencia(i8* %0)
%5 = icmp eq i32 %4, 2
br i1 %5, label %6, label %25
6: ; preds = %1
%7 = tail call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %6
%10 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @strcat(i32 %10, i8* %0)
%12 = call i32 @strcat(i32 %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @system(i8* %3)
%14 = icmp eq i32 %13, -1
br i1 %14, label %24, label %25
15: ; preds = %6
%16 = tail call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %15
%19 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0))
%20 = call i32 @strcat(i32 %19, i8* %0)
%21 = call i32 @strcat(i32 %20, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%22 = call i32 @system(i8* %3)
%23 = icmp eq i32 %22, -1
br i1 %23, label %24, label %25
24: ; preds = %15, %18, %9
br label %25
25: ; preds = %1, %18, %9, %24
%26 = phi i32 [ 2, %24 ], [ 1, %9 ], [ 1, %18 ], [ 3, %1 ]
ret i32 %26
}