#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 */
int /*<<< orphan*/ calculate(char *, char, char *);
int /*<<< orphan*/ input_data_correct(char **);
int write(int, char *, int);
int main(int argc, char **argv) {
  if (argc != 4)
    return (0);
  if (!input_data_correct(argv))
    return (write(1, "0\n", 2));
  calculate(argv[1], argv[2][0], argv[3]);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     115c <main+0x2c>
movl   $0x0,-0x4(%rbp)
jmp    11b5 <main+0x85>
mov    -0x10(%rbp),%rdi
call   1050 <input_data_correct@plt>
cmp    $0x0,%eax
jne    118c <main+0x5c>
mov    $0x1,%edi
lea    0xe86(%rip),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
mov    %eax,-0x4(%rbp)
jmp    11b5 <main+0x85>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    (%rax),%al
mov    -0x10(%rbp),%rcx
mov    0x18(%rcx),%rdx
movsbl %al,%esi
call   1040 <calculate@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x4,%edi
jne    1159 <main+0x29>
mov    %rsi,%rbx
mov    %rsi,%rdi
call   1050 <input_data_correct@plt>
test   %eax,%eax
je     115d <main+0x2d>
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rax
movsbl (%rax),%esi
mov    0x18(%rbx),%rdx
call   1040 <calculate@plt>
xor    %eax,%eax
pop    %rbx
ret
lea    0xe9c(%rip),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
pop    %rbx
jmp    1030 <write@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"0\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %4, label %18
4: ; preds = %2
%5 = tail call i32 @input_data_correct(i8** %1)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
br label %18
9: ; preds = %4
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = load i8, i8* %13
%15 = getelementptr inbounds i8*, i8** %1, i64 3
%16 = load i8*, i8** %15
%17 = tail call i32 @calculate(i8* %11, i8 signext %14, i8* %16)
br label %18
18: ; preds = %2, %9, %7
%19 = phi i32 [ 0, %9 ], [ %8, %7 ], [ 0, %2 ]
ret i32 %19
}