#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 atoi(char *);
int ft_add(int, int);
int ft_div(int, int);
int ft_fact(int, int);
int ft_sous(int, int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int a;
  int b;
  if (argc - 1 <= 0) {
    return (0);
  }
  a = atoi(argv[1]);
  b = atoi(argv[3]);
  if (argv[2] == "-")
    printf("%d", ft_sous(a, b));
  if (argv[2] == "+")
    printf("%d", ft_add(a, b));
  if (argv[2] == "*")
    printf("%d", ft_fact(a, b));
  if (argv[2] == "/")
    printf("%d", ft_div(a, b));
  return (0);
}


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)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cmp    $0x0,%eax
jg     1191 <main+0x31>
movl   $0x0,-0x4(%rbp)
jmp    1270 <main+0x110>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
lea    0xe44(%rip),%rcx
cmp    %rcx,0x10(%rax)
jne    11df <main+0x7f>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1050 <ft_sous@plt>
mov    %eax,%esi
lea    0xe28(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rax
lea    0xe1b(%rip),%rcx
cmp    %rcx,0x10(%rax)
jne    120d <main+0xad>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1070 <ft_add@plt>
mov    %eax,%esi
lea    0xdfa(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rax
lea    0xdef(%rip),%rcx
cmp    %rcx,0x10(%rax)
jne    123b <main+0xdb>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <ft_fact@plt>
mov    %eax,%esi
lea    0xdcc(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rax
lea    0xdc3(%rip),%rcx
cmp    %rcx,0x10(%rax)
jne    1269 <main+0x109>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <ft_div@plt>
mov    %eax,%esi
lea    0xd9e(%rip),%rdi
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x2,%edi
jl     1227 <main+0xc7>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1080 <atoi@plt>
mov    %eax,%r14d
mov    0x18(%rbx),%rdi
call   1080 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rax
lea    0xe6e(%rip),%rcx
cmp    %rcx,%rax
jne    11b3 <main+0x53>
mov    %r14d,%edi
mov    %ebp,%esi
call   1050 <ft_sous@plt>
lea    0xe5a(%rip),%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    0x10(%rbx),%rax
lea    0xe4b(%rip),%rcx
cmp    %rcx,%rax
jne    11db <main+0x7b>
mov    %r14d,%edi
mov    %ebp,%esi
call   1070 <ft_add@plt>
lea    0xe32(%rip),%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    0x10(%rbx),%rax
lea    0xe25(%rip),%rcx
cmp    %rcx,%rax
jne    1203 <main+0xa3>
mov    %r14d,%edi
mov    %ebp,%esi
call   1030 <ft_fact@plt>
lea    0xe0a(%rip),%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    0x10(%rbx),%rax
lea    0xdff(%rip),%rcx
cmp    %rcx,%rax
jne    1227 <main+0xc7>
mov    %r14d,%edi
mov    %ebp,%esi
call   1040 <ft_div@plt>
lea    0xde2(%rip),%rdi
mov    %eax,%esi
call   1060 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"-\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"+\00"
@.str.3 = [2 x i8] c"*\00"
@.str.4 = [2 x i8] c"/\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = sub nsw i32 %8, 1
%10 = icmp sle i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 0, i32* %3
br label %61
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @atoi(i8* %15)
store i32 %16, i32* %6
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 3
%19 = load i8*, i8** %18
%20 = call i32 @atoi(i8* %19)
store i32 %20, i32* %7
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
%24 = icmp eq i8* %23, getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0)
br i1 %24, label %25, label %30
25: ; preds = %12
%26 = load i32, i32* %6
%27 = load i32, i32* %7
%28 = call i32 @ft_sous(i32 %26, i32 %27)
%29 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %25, %12
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 2
%33 = load i8*, i8** %32
%34 = icmp eq i8* %33, getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
br i1 %34, label %35, label %40
35: ; preds = %30
%36 = load i32, i32* %6
%37 = load i32, i32* %7
%38 = call i32 @ft_add(i32 %36, i32 %37)
%39 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %38)
br label %40
40: ; preds = %35, %30
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 2
%43 = load i8*, i8** %42
%44 = icmp eq i8* %43, getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
br i1 %44, label %45, label %50
45: ; preds = %40
%46 = load i32, i32* %6
%47 = load i32, i32* %7
%48 = call i32 @ft_fact(i32 %46, i32 %47)
%49 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %48)
br label %50
50: ; preds = %45, %40
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 2
%53 = load i8*, i8** %52
%54 = icmp eq i8* %53, getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0)
br i1 %54, label %55, label %60
55: ; preds = %50
%56 = load i32, i32* %6
%57 = load i32, i32* %7
%58 = call i32 @ft_div(i32 %56, i32 %57)
%59 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %58)
br label %60
60: ; preds = %55, %50
store i32 0, i32* %3
br label %61
61: ; preds = %60, %11
%62 = load i32, i32* %3
ret i32 %62
}

LLVM IR (-O2):
@.str = [2 x i8] c"-\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"+\00"
@.str.3 = [2 x i8] c"*\00"
@.str.4 = [2 x i8] c"/\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %38, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = getelementptr inbounds i8*, i8** %1, i64 3
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = icmp eq i8* %12, getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0)
br i1 %13, label %14, label %18
14: ; preds = %4
%15 = tail call i32 @ft_sous(i32 %7, i32 %10)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = load i8*, i8** %11
br label %18
18: ; preds = %14, %4
%19 = phi i8* [ %17, %14 ], [ %12, %4 ]
%20 = icmp eq i8* %19, getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
br i1 %20, label %21, label %25
21: ; preds = %18
%22 = tail call i32 @ft_add(i32 %7, i32 %10)
%23 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = load i8*, i8** %11
br label %25
25: ; preds = %21, %18
%26 = phi i8* [ %24, %21 ], [ %19, %18 ]
%27 = icmp eq i8* %26, getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
br i1 %27, label %28, label %32
28: ; preds = %25
%29 = tail call i32 @ft_fact(i32 %7, i32 %10)
%30 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %29)
%31 = load i8*, i8** %11
br label %32
32: ; preds = %28, %25
%33 = phi i8* [ %31, %28 ], [ %26, %25 ]
%34 = icmp eq i8* %33, getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0)
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = tail call i32 @ft_div(i32 %7, i32 %10)
%37 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %32, %35, %2
ret i32 0
}