#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 midStack {
  int dummy;
};

/* Variables and functions */
int findMiddle(struct midStack *);
struct midStack *midStack_create();
int midStack_pop(struct midStack *);
int /*<<< orphan*/ midStack_push(struct midStack *, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  struct midStack *ms = midStack_create();
  midStack_push(ms, 11);
  midStack_push(ms, 22);
  midStack_push(ms, 33);
  midStack_push(ms, 44);
  midStack_push(ms, 55);
  midStack_push(ms, 66);
  midStack_push(ms, 77);
  printf("Item midStack_popped is %d\n", midStack_pop(ms));
  printf("Item midStack_popped is %d\n", midStack_pop(ms));
  printf("Middle Element is %d\n", findMiddle(ms));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <midStack_create@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0xb,%esi
call   1060 <midStack_push@plt>
mov    -0x10(%rbp),%rdi
mov    $0x16,%esi
call   1060 <midStack_push@plt>
mov    -0x10(%rbp),%rdi
mov    $0x21,%esi
call   1060 <midStack_push@plt>
mov    -0x10(%rbp),%rdi
mov    $0x2c,%esi
call   1060 <midStack_push@plt>
mov    -0x10(%rbp),%rdi
mov    $0x37,%esi
call   1060 <midStack_push@plt>
mov    -0x10(%rbp),%rdi
mov    $0x42,%esi
call   1060 <midStack_push@plt>
mov    -0x10(%rbp),%rdi
mov    $0x4d,%esi
call   1060 <midStack_push@plt>
mov    -0x10(%rbp),%rdi
call   1070 <midStack_pop@plt>
mov    %eax,%esi
lea    0xe22(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1070 <midStack_pop@plt>
mov    %eax,%esi
lea    0xe0b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <findMiddle@plt>
mov    %eax,%esi
lea    0xe10(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <midStack_create@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0xb,%esi
call   1060 <midStack_push@plt>
mov    %rbx,%rdi
mov    $0x16,%esi
call   1060 <midStack_push@plt>
mov    %rbx,%rdi
mov    $0x21,%esi
call   1060 <midStack_push@plt>
mov    %rbx,%rdi
mov    $0x2c,%esi
call   1060 <midStack_push@plt>
mov    %rbx,%rdi
mov    $0x37,%esi
call   1060 <midStack_push@plt>
mov    %rbx,%rdi
mov    $0x42,%esi
call   1060 <midStack_push@plt>
mov    %rbx,%rdi
mov    $0x4d,%esi
call   1060 <midStack_push@plt>
mov    %rbx,%rdi
call   1070 <midStack_pop@plt>
lea    0xe38(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1070 <midStack_pop@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <findMiddle@plt>
lea    0xe29(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.midStack = type { i32 }
@.str = [28 x i8] c"Item midStack_popped is %d\0A\00"
@.str.1 = [22 x i8] c"Middle Element is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.midStack*
store i32 0, i32* %1
%3 = call %struct.midStack* (...) @midStack_create()
store %struct.midStack* %3, %struct.midStack** %2
%4 = load %struct.midStack*, %struct.midStack** %2
%5 = call i32 @midStack_push(%struct.midStack* %4, i32 11)
%6 = load %struct.midStack*, %struct.midStack** %2
%7 = call i32 @midStack_push(%struct.midStack* %6, i32 22)
%8 = load %struct.midStack*, %struct.midStack** %2
%9 = call i32 @midStack_push(%struct.midStack* %8, i32 33)
%10 = load %struct.midStack*, %struct.midStack** %2
%11 = call i32 @midStack_push(%struct.midStack* %10, i32 44)
%12 = load %struct.midStack*, %struct.midStack** %2
%13 = call i32 @midStack_push(%struct.midStack* %12, i32 55)
%14 = load %struct.midStack*, %struct.midStack** %2
%15 = call i32 @midStack_push(%struct.midStack* %14, i32 66)
%16 = load %struct.midStack*, %struct.midStack** %2
%17 = call i32 @midStack_push(%struct.midStack* %16, i32 77)
%18 = load %struct.midStack*, %struct.midStack** %2
%19 = call i32 @midStack_pop(%struct.midStack* %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = load %struct.midStack*, %struct.midStack** %2
%22 = call i32 @midStack_pop(%struct.midStack* %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = load %struct.midStack*, %struct.midStack** %2
%25 = call i32 @findMiddle(%struct.midStack* %24)
%26 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %25)
ret i32 0
}

LLVM IR (-O2):
%struct.midStack = type { i32 }
@.str = [28 x i8] c"Item midStack_popped is %d\0A\00"
@.str.1 = [22 x i8] c"Middle Element is %d\0A\00"
define i32 @main() {
%1 = tail call %struct.midStack* (...) @midStack_create()
%2 = tail call i32 @midStack_push(%struct.midStack* %1, i32 11)
%3 = tail call i32 @midStack_push(%struct.midStack* %1, i32 22)
%4 = tail call i32 @midStack_push(%struct.midStack* %1, i32 33)
%5 = tail call i32 @midStack_push(%struct.midStack* %1, i32 44)
%6 = tail call i32 @midStack_push(%struct.midStack* %1, i32 55)
%7 = tail call i32 @midStack_push(%struct.midStack* %1, i32 66)
%8 = tail call i32 @midStack_push(%struct.midStack* %1, i32 77)
%9 = tail call i32 @midStack_pop(%struct.midStack* %1)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = tail call i32 @midStack_pop(%struct.midStack* %1)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = tail call i32 @findMiddle(%struct.midStack* %1)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %13)
ret i32 0
}