#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 */
struct token {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ delete_tokens(struct token *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ print_tokens(struct token *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
struct token *tokenize(char *);
int main() {
  struct token *tokens;
  char user_input[80];
  printf("> Type a mathematical expression: ");
  fgets(user_input, 79, stdin);
  tokens = tokenize(user_input);
  print_tokens(tokens);
  delete_tokens(tokens);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    0x2e72(%rip),%rax
mov    (%rax),%edx
mov    $0x4f,%esi
call   1040 <fgets@plt>
lea    -0x60(%rbp),%rdi
call   1060 <tokenize@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <print_tokens@plt>
mov    -0x10(%rbp),%rdi
call   1050 <delete_tokens@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e80(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x4f,%esi
call   1040 <fgets@plt>
mov    %rbx,%rdi
call   1060 <tokenize@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <print_tokens@plt>
mov    %rbx,%rdi
call   1050 <delete_tokens@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.token = type { i32 }
@.str = [35 x i8] c"> Type a mathematical expression: \00"
@stdin = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.token*
%3 = alloca [80 x i8]
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %5, i32 79, i32 %6)
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%9 = call %struct.token* @tokenize(i8* %8)
store %struct.token* %9, %struct.token** %2
%10 = load %struct.token*, %struct.token** %2
%11 = call i32 @print_tokens(%struct.token* %10)
%12 = load %struct.token*, %struct.token** %2
%13 = call i32 @delete_tokens(%struct.token* %12)
ret i32 0
}

LLVM IR (-O2):
%struct.token = type { i32 }
@.str = [35 x i8] c"> Type a mathematical expression: \00"
@stdin = global i32 0
define i32 @main() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* %2, i32 79, i32 %4)
%6 = call %struct.token* @tokenize(i8* %2)
%7 = call i32 @print_tokens(%struct.token* %6)
%8 = call i32 @delete_tokens(%struct.token* %6)
ret i32 0
}