#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 EXIT_SUCCESS;
scalar_t__ count_fucks(int, char **);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ get_fucks(int /*<<< orphan*/ *, unsigned long *);
int /*<<< orphan*/ store_fucks(int /*<<< orphan*/ *, unsigned long *);
int main(int argc, char **argv) {
  unsigned long fucks;
  FILE *fp;
  if ((fp = fopen("/tmp/accumulatedfucks", "r+b")) == NULL) {
    fp = fopen("/tmp/accumulatedfucks", "w+b");
  }
  get_fucks(fp, &fucks);
  fucks += count_fucks(argc, argv);
  store_fucks(fp, &fucks);
  fclose(fp);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe93(%rip),%rdi
lea    0xea2(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    119e <main+0x4e>
lea    0xe72(%rip),%rdi
lea    0xe85(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <get_fucks@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <count_fucks@plt>
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1060 <store_fucks@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    0x2e04(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%r15d
lea    0xe9c(%rip),%rdi
lea    0xeab(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    118e <main+0x3e>
lea    0xe81(%rip),%rdi
lea    0xe94(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
mov    %rsp,%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1050 <get_fucks@plt>
mov    %r15d,%edi
mov    %r14,%rsi
call   1040 <count_fucks@plt>
add    %rax,(%rsp)
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1060 <store_fucks@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    0x2e1b(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"/tmp/accumulatedfucks\00"
@.str.1 = [4 x i8] c"r+b\00"
@.str.2 = [4 x i8] c"w+b\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32* @fopen(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32* %8, i32** %7
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32* @fopen(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
store i32* %11, i32** %7
br label %12
12: ; preds = %10, %2
%13 = load i32*, i32** %7
%14 = call i32 @get_fucks(i32* %13, i64* %6)
%15 = load i32, i32* %4
%16 = load i8**, i8*** %5
%17 = call i64 @count_fucks(i32 %15, i8** %16)
%18 = load i64, i64* %6
%19 = add i64 %18, %17
store i64 %19, i64* %6
%20 = load i32*, i32** %7
%21 = call i32 @store_fucks(i32* %20, i64* %6)
%22 = load i32*, i32** %7
%23 = call i32 @fclose(i32* %22)
%24 = load i32, i32* @EXIT_SUCCESS
ret i32 %24
}

LLVM IR (-O2):
@.str = [22 x i8] c"/tmp/accumulatedfucks\00"
@.str.1 = [4 x i8] c"r+b\00"
@.str.2 = [4 x i8] c"w+b\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32* @fopen(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %9
9: ; preds = %7, %2
%10 = phi i32* [ %8, %7 ], [ %5, %2 ]
%11 = call i32 @get_fucks(i32* %10, i64* %3)
%12 = call i64 @count_fucks(i32 %0, i8** %1)
%13 = load i64, i64* %3
%14 = add i64 %13, %12
store i64 %14, i64* %3
%15 = call i32 @store_fucks(i32* %10, i64* %3)
%16 = call i32 @fclose(i32* %10)
%17 = load i32, i32* @EXIT_SUCCESS
ret i32 %17
}