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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
struct stacka *stacka_create(int /*<<< orphan*/);
int /*<<< orphan*/ stacka_destroy(struct stacka *);
scalar_t__ stacka_pop(struct stacka *);
int /*<<< orphan*/ stacka_push(struct stacka *, char *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  int i;
  struct stacka *stacka;
  stacka = stacka_create(0);
  if (stacka == NULL) {
    return -1;
  }
  for (i = 1; i < argc; i++) {
    if (strcmp(argv[i], "-") == 0) {
      printf("%s ", (char *)stacka_pop(stacka));
    } else {
      stacka_push(stacka, argv[i]);
    }
  }
  stacka_destroy(stacka);
  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)
xor    %edi,%edi
call   1070 <stacka_create@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1198 <main+0x38>
movl   $0xffffffff,-0x4(%rbp)
jmp    1222 <main+0xc2>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1212 <main+0xb2>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe42(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11ea <main+0x8a>
mov    -0x20(%rbp),%rdi
call   1030 <stacka_pop@plt>
mov    %rax,%rsi
lea    0xe22(%rip),%rdi
call   1040 <printf@plt>
jmp    11ff <main+0x9f>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1060 <stacka_push@plt>
jmp    1204 <main+0xa4>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    119f <main+0x3f>
mov    -0x20(%rbp),%rdi
call   1080 <stacka_destroy@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %edi,%edi
call   1070 <stacka_create@plt>
test   %rax,%rax
je     11e7 <main+0x87>
mov    %rax,%r14
cmp    $0x2,%ebp
jl     11db <main+0x7b>
mov    %ebp,%r13d
mov    $0x1,%ebp
lea    0xe6d(%rip),%r15
lea    0xe68(%rip),%r12
jmp    11b5 <main+0x55>
nopl   0x0(%rax)
mov    (%rbx,%rbp,8),%rsi
mov    %r14,%rdi
call   1060 <stacka_push@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
je     11db <main+0x7b>
mov    (%rbx,%rbp,8),%rdi
mov    %r15,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    11a0 <main+0x40>
mov    %r14,%rdi
call   1030 <stacka_pop@plt>
mov    %r12,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
jmp    11ac <main+0x4c>
mov    %r14,%rdi
call   1080 <stacka_destroy@plt>
xor    %eax,%eax
jmp    11ec <main+0x8c>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stacka = type { i32 }
@.str = [2 x i8] c"-\00"
@.str.1 = [4 x i8] c"%s \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.stacka*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call %struct.stacka* @stacka_create(i32 0)
store %struct.stacka* %8, %struct.stacka** %7
%9 = load %struct.stacka*, %struct.stacka** %7
%10 = icmp eq %struct.stacka* %9, null
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 -1, i32* %3
br label %45
12: ; preds = %2
store i32 1, i32* %6
br label %13
13: ; preds = %39, %12
%14 = load i32, i32* %6
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %42
17: ; preds = %13
%18 = load i8**, i8*** %5
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %30
25: ; preds = %17
%26 = load %struct.stacka*, %struct.stacka** %7
%27 = call i64 @stacka_pop(%struct.stacka* %26)
%28 = inttoptr i64 %27 to i8*
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %28)
br label %38
30: ; preds = %17
%31 = load %struct.stacka*, %struct.stacka** %7
%32 = load i8**, i8*** %5
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %32, i64 %34
%36 = load i8*, i8** %35
%37 = call i32 @stacka_push(%struct.stacka* %31, i8* %36)
br label %38
38: ; preds = %30, %25
br label %39
39: ; preds = %38
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
br label %13
42: ; preds = %13
%43 = load %struct.stacka*, %struct.stacka** %7
%44 = call i32 @stacka_destroy(%struct.stacka* %43)
store i32 0, i32* %3
br label %45
45: ; preds = %42, %11
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
%struct.stacka = type { i32 }
@.str = [2 x i8] c"-\00"
@.str.1 = [4 x i8] c"%s \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call %struct.stacka* @stacka_create(i32 0)
%4 = icmp eq %struct.stacka* %3, null
br i1 %4, label %27, label %5
5: ; preds = %2
%6 = icmp sgt i32 %0, 1
br i1 %6, label %7, label %25
7: ; preds = %5
%8 = zext i32 %0 to i64
br label %9
9: ; preds = %7, %22
%10 = phi i64 [ 1, %7 ], [ %23, %22 ]
%11 = getelementptr inbounds i8*, i8** %1, i64 %10
%12 = load i8*, i8** %11
%13 = tail call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %9
%16 = tail call i64 @stacka_pop(%struct.stacka* %3)
%17 = inttoptr i64 %16 to i8*
%18 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %17)
br label %22
19: ; preds = %9
%20 = load i8*, i8** %11
%21 = tail call i32 @stacka_push(%struct.stacka* %3, i8* %20)
br label %22
22: ; preds = %15, %19
%23 = add nuw nsw i64 %10, 1
%24 = icmp eq i64 %23, %8
br i1 %24, label %25, label %9
25: ; preds = %22, %5
%26 = tail call i32 @stacka_destroy(%struct.stacka* %3)
br label %27
27: ; preds = %2, %25
%28 = phi i32 [ 0, %25 ], [ -1, %2 ]
ret i32 %28
}