#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
void flatuicolorsdataToTakeawaycolors() {
  FILE *fptrwrite = fopen("../src/takeawaycolors.css", "wb");
  char c[1000];
  FILE *fptr;
  if ((fptr = fopen("../data/flatuicolorsdata.txt", "r")) == NULL) {
    printf("Error! opening file");
  } else {
    fscanf(fptr, "%[^,]", c);
    fputs(c, fptrwrite);
    printf("Data from the file:%s\n", c);
    fclose(fptr);
  }
  fclose(fptrwrite);
}


x86 assembly (clang, -O0):
<flatuicolorsdataToTakeawaycolors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
lea    0xe9e(%rip),%rdi
lea    0xeb1(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x8(%rbp)
lea    0xea4(%rip),%rdi
lea    0xeba(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x3f8(%rbp)
cmp    $0x0,%rax
jne    11a9 <flatuicolorsdataToTakeawaycolors+0x59>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11f4 <flatuicolorsdataToTakeawaycolors+0xa4>
mov    -0x3f8(%rbp),%rdi
lea    -0x3f0(%rbp),%rdx
lea    0xe92(%rip),%rsi
call   1060 <fscanf@plt>
lea    -0x3f0(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <fputs@plt>
lea    -0x3f0(%rbp),%rsi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x3f8(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flatuicolorsdataToTakeawaycolors>:
push   %r15
push   %r14
push   %rbx
sub    $0x3f0,%rsp
lea    0xe9d(%rip),%rdi
lea    0xeb0(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r14
lea    0xea4(%rip),%rdi
lea    0xeba(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     11c8 <flatuicolorsdataToTakeawaycolors+0x78>
mov    %rax,%rbx
lea    0xebc(%rip),%rsi
mov    %rsp,%r15
mov    %rax,%rdi
mov    %r15,%rdx
call   1060 <fscanf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <fputs@plt>
lea    0xea2(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
jmp    11d6 <flatuicolorsdataToTakeawaycolors+0x86>
lea    0xe6d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
add    $0x3f0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [26 x i8] c"../src/takeawaycolors.css\00"
@.str.1 = [3 x i8] c"wb\00"
@.str.2 = [29 x i8] c"../data/flatuicolorsdata.txt\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [20 x i8] c"Error! opening file\00"
@.str.5 = [6 x i8] c"%[^,]\00"
@.str.6 = [23 x i8] c"Data from the file:%s\0A\00"
define void @flatuicolorsdataToTakeawaycolors() {
%1 = alloca i32*
%2 = alloca [1000 x i8]
%3 = alloca i32*
%4 = call i32* @fopen(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %1
%5 = call i32* @fopen(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %5, i32** %3
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %20
9: ; preds = %0
%10 = load i32*, i32** %3
%11 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%12 = call i32 @fscanf(i32* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%14 = load i32*, i32** %1
%15 = call i32 @fputs(i8* %13, i32* %14)
%16 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i8* %16)
%18 = load i32*, i32** %3
%19 = call i32 @fclose(i32* %18)
br label %20
20: ; preds = %9, %7
%21 = load i32*, i32** %1
%22 = call i32 @fclose(i32* %21)
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"../src/takeawaycolors.css\00"
@.str.1 = [3 x i8] c"wb\00"
@.str.2 = [29 x i8] c"../data/flatuicolorsdata.txt\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [20 x i8] c"Error! opening file\00"
@.str.5 = [6 x i8] c"%[^,]\00"
@.str.6 = [23 x i8] c"Data from the file:%s\0A\00"
define void @flatuicolorsdataToTakeawaycolors() {
%1 = alloca [1000 x i8]
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%3 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %13
8: ; preds = %0
%9 = call i32 @fscanf(i32* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %3)
%10 = call i32 @fputs(i8* %3, i32* %2)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i8* %3)
%12 = call i32 @fclose(i32* %4)
br label %13
13: ; preds = %8, %6
%14 = call i32 @fclose(i32* %2)
ret void
}