#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 */
scalar_t__ isspace(int);
const char *Fix_val(const char *s) {
  int c = 0;
  if (s) {
    c = (int)(*(unsigned const char *)(s));
    ++s;
    while (isspace((int)(*(unsigned const char *)(s))))
      ++s;
  }
  if (c == 0) {
    s = "1";
  } else if (c == '@') {
    s = "0";
  }
  return (s);
}


x86 assembly (clang, -O0):
<Fix_val>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1170 <Fix_val+0x60>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     116b <Fix_val+0x5b>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1144 <Fix_val+0x34>
jmp    1170 <Fix_val+0x60>
cmpl   $0x0,-0xc(%rbp)
jne    118a <Fix_val+0x7a>
lea    0xe7f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a4 <Fix_val+0x94>
cmpl   $0x40,-0xc(%rbp)
jne    119f <Fix_val+0x8f>
lea    0xe67(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a4 <Fix_val+0x94>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fix_val>:
push   %rbp
push   %r14
push   %rbx
lea    0xee5(%rip),%r14
test   %rdi,%rdi
je     1159 <Fix_val+0x49>
mov    %rdi,%rbx
mov    (%rdi),%bpl
cs nopw 0x0(%rax,%rax,1)
movzbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <isspace@plt>
test   %rax,%rax
jne    1130 <Fix_val+0x20>
test   %bpl,%bpl
je     1159 <Fix_val+0x49>
cmp    $0x40,%bpl
jne    1156 <Fix_val+0x46>
lea    0xeae(%rip),%r14
jmp    1159 <Fix_val+0x49>
mov    %rbx,%r14
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"1\00"
@.str.1 = [2 x i8] c"0\00"
define i8* @Fix_val(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %22
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
store i32 %9, i32* %3
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %2
br label %12
12: ; preds = %18, %6
%13 = load i8*, i8** %2
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = call i64 @isspace(i32 %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %12
%19 = load i8*, i8** %2
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %2
br label %12
21: ; preds = %12
br label %22
22: ; preds = %21, %1
%23 = load i32, i32* %3
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %22
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %2
br label %31
26: ; preds = %22
%27 = load i32, i32* %3
%28 = icmp eq i32 %27, 64
br i1 %28, label %29, label %30
29: ; preds = %26
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %30
30: ; preds = %29, %26
br label %31
31: ; preds = %30, %25
%32 = load i8*, i8** %2
ret i8* %32
}

LLVM IR (-O2):
@.str = [2 x i8] c"1\00"
@.str.1 = [2 x i8] c"0\00"
define i8* @Fix_val(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %15, label %3
3: ; preds = %1
%4 = load i8, i8* %0
br label %5
5: ; preds = %5, %3
%6 = phi i8* [ %0, %3 ], [ %7, %5 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = tail call i64 @isspace(i32 %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5
switch i8 %4, label %14 [
i8 0, label %15
i8 64, label %13
]
13: ; preds = %12
br label %15
14: ; preds = %12
br label %15
15: ; preds = %1, %12, %14, %13
%16 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %13 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %12 ], [ %7, %14 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %16
}