#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 */
scalar_t__ Str_exists(char const *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *, char *);
int /*<<< orphan*/ remove(char *);
scalar_t__ strcmp(char const *, char *);
int Str_remove(const char *name1) {
  if (Str_exists(name1)) {
    char name[30];
    char value[1000];
    FILE *f = fopen("strvalues.tmp", "r");
    FILE *wppstr = fopen("wppstr", "w+");
    while (!feof(f)) {
      fscanf(f, "%s %s\n", name, value);
      if (strcmp(name1, name) != 0)
        fprintf(wppstr, "%s %s\n", name, value);
    }
    fclose(f);
    fclose(wppstr);
    f = fopen("strvalues.tmp", "w+");
    wppstr = fopen("wppstr", "r");
    while (!feof(wppstr)) {
      fscanf(wppstr, "%s %s\n", name, value);
      fprintf(f, "%s %s\n", name, value);
    }
    fclose(f);
    fclose(wppstr);
    remove("wppstr");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<Str_remove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1090 <Str_exists@plt>
cmp    $0x0,%rax
je     132d <Str_remove+0x1ad>
lea    0xe57(%rip),%rdi
lea    0xe63(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x428(%rbp)
lea    0xe4b(%rip),%rdi
lea    0xe4b(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x430(%rbp)
mov    -0x428(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11f7 <Str_remove+0x77>
jmp    124f <Str_remove+0xcf>
mov    -0x428(%rbp),%rdi
lea    -0x30(%rbp),%rdx
lea    -0x420(%rbp),%rcx
lea    0xe08(%rip),%rsi
call   1050 <fscanf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     124a <Str_remove+0xca>
mov    -0x430(%rbp),%rdi
lea    -0x30(%rbp),%rdx
lea    -0x420(%rbp),%rcx
lea    0xdd3(%rip),%rsi
call   1070 <fprintf@plt>
jmp    11d6 <Str_remove+0x56>
mov    -0x428(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x430(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xd92(%rip),%rdi
lea    0xda0(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x428(%rbp)
lea    0xd86(%rip),%rdi
lea    0xd84(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x430(%rbp)
mov    -0x430(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12bc <Str_remove+0x13c>
jmp    12fd <Str_remove+0x17d>
mov    -0x430(%rbp),%rdi
lea    -0x30(%rbp),%rdx
lea    -0x420(%rbp),%rcx
lea    0xd43(%rip),%rsi
call   1050 <fscanf@plt>
mov    -0x428(%rbp),%rdi
lea    -0x30(%rbp),%rdx
lea    -0x420(%rbp),%rcx
lea    0xd25(%rip),%rsi
call   1070 <fprintf@plt>
jmp    129b <Str_remove+0x11b>
mov    -0x428(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x430(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xcf2(%rip),%rdi
call   1030 <remove@plt>
movl   $0x1,-0x4(%rbp)
jmp    1334 <Str_remove+0x1b4>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Str_remove>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %rdi,%r14
call   1090 <Str_exists@plt>
test   %rax,%rax
je     1291 <Str_remove+0x111>
lea    0xe57(%rip),%rdi
lea    0xe63(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%rbx
lea    0xe4f(%rip),%rdi
lea    0xe4f(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %eax,%eax
je     12a5 <Str_remove+0x125>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
lea    0xe0b(%rip),%rdi
lea    0xe19(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%r14
lea    0xe03(%rip),%rdi
lea    0xe01(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1080 <feof@plt>
test   %eax,%eax
jne    126e <Str_remove+0xee>
lea    0xdeb(%rip),%r15
mov    %rsp,%r12
lea    0x20(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %rbp,%rcx
call   1050 <fscanf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %rbp,%rcx
call   1070 <fprintf@plt>
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %eax,%eax
je     1240 <Str_remove+0xc0>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xd89(%rip),%rdi
call   1030 <remove@plt>
mov    $0x1,%eax
jmp    1293 <Str_remove+0x113>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd6c(%rip),%r12
mov    %rsp,%r13
lea    0x20(%rsp),%rbp
jmp    12d0 <Str_remove+0x150>
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %eax,%eax
jne    11de <Str_remove+0x5e>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbp,%rcx
call   1050 <fscanf@plt>
mov    %r14,%rdi
mov    %r13,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     12c0 <Str_remove+0x140>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbp,%rcx
call   1070 <fprintf@plt>
jmp    12c0 <Str_remove+0x140>

LLVM IR (-O0):
@.str = [14 x i8] c"strvalues.tmp\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"wppstr\00"
@.str.3 = [3 x i8] c"w+\00"
@.str.4 = [7 x i8] c"%s %s\0A\00"
define i32 @Str_remove(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [30 x i8]
%5 = alloca [1000 x i8]
%6 = alloca i32*
%7 = alloca i32*
store i8* %0, i8** %3
%8 = load i8*, i8** %3
%9 = call i64 @Str_exists(i8* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %61
11: ; preds = %1
%12 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %12, i32** %6
%13 = call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %13, i32** %7
br label %14
14: ; preds = %33, %11
%15 = load i32*, i32** %6
%16 = call i32 @feof(i32* %15)
%17 = icmp ne i32 %16, 0
%18 = xor i1 %17, true
br i1 %18, label %19, label %34
19: ; preds = %14
%20 = load i32*, i32** %6
%21 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%22 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%23 = call i32 @fscanf(i32* %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %21, i8* %22)
%24 = load i8*, i8** %3
%25 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%26 = call i64 @strcmp(i8* %24, i8* %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %33
28: ; preds = %19
%29 = load i32*, i32** %7
%30 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%31 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%32 = call i32 @fprintf(i32* %29, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %30, i8* %31)
br label %33
33: ; preds = %28, %19
br label %14
34: ; preds = %14
%35 = load i32*, i32** %6
%36 = call i32 @fclose(i32* %35)
%37 = load i32*, i32** %7
%38 = call i32 @fclose(i32* %37)
%39 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %39, i32** %6
%40 = call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %40, i32** %7
br label %41
41: ; preds = %46, %34
%42 = load i32*, i32** %7
%43 = call i32 @feof(i32* %42)
%44 = icmp ne i32 %43, 0
%45 = xor i1 %44, true
br i1 %45, label %46, label %55
46: ; preds = %41
%47 = load i32*, i32** %7
%48 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%49 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%50 = call i32 @fscanf(i32* %47, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %48, i8* %49)
%51 = load i32*, i32** %6
%52 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%53 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%54 = call i32 @fprintf(i32* %51, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %52, i8* %53)
br label %41
55: ; preds = %41
%56 = load i32*, i32** %6
%57 = call i32 @fclose(i32* %56)
%58 = load i32*, i32** %7
%59 = call i32 @fclose(i32* %58)
%60 = call i32 @remove(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %2
br label %62
61: ; preds = %1
store i32 0, i32* %2
br label %62
62: ; preds = %61, %55
%63 = load i32, i32* %2
ret i32 %63
}

LLVM IR (-O2):
@.str = [14 x i8] c"strvalues.tmp\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"wppstr\00"
@.str.3 = [3 x i8] c"w+\00"
@.str.4 = [7 x i8] c"%s %s\0A\00"
define i32 @Str_remove(i8* %0) {
%2 = alloca [30 x i8]
%3 = alloca [1000 x i8]
%4 = tail call i64 @Str_exists(i8* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %38, label %6
6: ; preds = %1
%7 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%9 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @feof(i32* %9)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %22
13: ; preds = %6, %19
%14 = call i32 @fscanf(i32* %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %7, i8* %8)
%15 = call i64 @strcmp(i8* %0, i8* %7)
%16 = icmp eq i64 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %13
%18 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %7, i8* %8)
br label %19
19: ; preds = %17, %13
%20 = call i32 @feof(i32* %9)
%21 = icmp eq i32 %20, 0
br i1 %21, label %13, label %22
22: ; preds = %19, %6
%23 = call i32 @fclose(i32* %9)
%24 = call i32 @fclose(i32* %10)
%25 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%26 = call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%27 = call i32 @feof(i32* %26)
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %34
29: ; preds = %22, %29
%30 = call i32 @fscanf(i32* %26, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %7, i8* %8)
%31 = call i32 @fprintf(i32* %25, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %7, i8* %8)
%32 = call i32 @feof(i32* %26)
%33 = icmp eq i32 %32, 0
br i1 %33, label %29, label %34
34: ; preds = %29, %22
%35 = call i32 @fclose(i32* %25)
%36 = call i32 @fclose(i32* %26)
%37 = call i32 @remove(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %38
38: ; preds = %1, %34
%39 = phi i32 [ 1, %34 ], [ 0, %1 ]
ret i32 %39
}