#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;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ get_fucks(int /*<<< orphan*/ *, unsigned long *);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  unsigned long fucks;
  FILE *fp;
  fp = fopen("/tmp/accumulatedfucks", "r+b");
  if (fp == NULL) {
    printf("Zero fucks given!\n");
    return EXIT_SUCCESS;
  }
  get_fucks(fp, &fucks);
  switch (fucks) {
  case 0:
    printf("Not even a single one!\n");
    break;
  case 1:
    printf("One little fuck given!\n");
    break;
  default:
    printf("%d fucks given!\n", fucks);
  }
  fclose(fp);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xeb9(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1190 <main+0x50>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e5a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1213 <main+0xd3>
mov    -0x18(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <get_fucks@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
test   %rax,%rax
je     11c6 <main+0x86>
jmp    11b3 <main+0x73>
mov    -0x20(%rbp),%rax
sub    $0x1,%rax
je     11d9 <main+0x99>
jmp    11ec <main+0xac>
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11fe <main+0xbe>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11fe <main+0xbe>
mov    -0x10(%rbp),%rsi
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    0x2dd2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xea4(%rip),%rdi
lea    0xeb3(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     119b <main+0x4b>
mov    %rax,%rbx
lea    0x8(%rsp),%rsi
mov    %rax,%rdi
call   1060 <get_fucks@plt>
mov    0x8(%rsp),%rsi
cmp    $0x1,%rsi
je     11a9 <main+0x59>
test   %rsi,%rsi
jne    11b7 <main+0x67>
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
jmp    11c5 <main+0x75>
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
jmp    11cd <main+0x7d>
lea    0xe7b(%rip),%rdi
call   1030 <puts@plt>
jmp    11c5 <main+0x75>
lea    0xe5c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    0x2e0c(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"/tmp/accumulatedfucks\00"
@.str.1 = [4 x i8] c"r+b\00"
@.str.2 = [19 x i8] c"Zero fucks given!\0A\00"
@EXIT_SUCCESS = global i32 0
@.str.3 = [24 x i8] c"Not even a single one!\0A\00"
@.str.4 = [24 x i8] c"One little fuck given!\0A\00"
@.str.5 = [17 x i8] c"%d fucks given!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32*
store i32 0, i32* %1
%4 = 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* %4, i32** %3
%5 = load i32*, i32** %3
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%9 = load i32, i32* @EXIT_SUCCESS
store i32 %9, i32* %1
br label %25
10: ; preds = %0
%11 = load i32*, i32** %3
%12 = call i32 @get_fucks(i32* %11, i64* %2)
%13 = load i64, i64* %2
switch i64 %13, label %18 [
i64 0, label %14
i64 1, label %16
]
14: ; preds = %10
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
br label %21
16: ; preds = %10
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
br label %21
18: ; preds = %10
%19 = load i64, i64* %2
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i64 %19)
br label %21
21: ; preds = %18, %16, %14
%22 = load i32*, i32** %3
%23 = call i32 @fclose(i32* %22)
%24 = load i32, i32* @EXIT_SUCCESS
store i32 %24, i32* %1
br label %25
25: ; preds = %21, %7
%26 = load i32, i32* %1
ret i32 %26
}

LLVM IR (-O2):
@.str = [22 x i8] c"/tmp/accumulatedfucks\00"
@.str.1 = [4 x i8] c"r+b\00"
@EXIT_SUCCESS = global i32 0
@.str.5 = [17 x i8] c"%d fucks given!\0A\00"
@str = [23 x i8] c"One little fuck given!\00"
@str.6 = [23 x i8] c"Not even a single one!\00"
@str.7 = [18 x i8] c"Zero fucks given!\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = 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))
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.7, i64 0, i64 0))
br label %18
7: ; preds = %0
%8 = call i32 @get_fucks(i32* %3, i64* %1)
%9 = load i64, i64* %1
switch i64 %9, label %14 [
i64 0, label %10
i64 1, label %12
]
10: ; preds = %7
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.6, i64 0, i64 0))
br label %16
12: ; preds = %7
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
br label %16
14: ; preds = %7
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i64 %9)
br label %16
16: ; preds = %14, %12, %10
%17 = call i32 @fclose(i32* %3)
br label %18
18: ; preds = %16, %5
%19 = load i32, i32* @EXIT_SUCCESS
ret i32 %19
}