#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);
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(argc - 1);
  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)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1070 <stacka_create@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    119c <main+0x3c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1226 <main+0xc6>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1216 <main+0xb6>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe3e(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11ee <main+0x8e>
mov    -0x20(%rbp),%rdi
call   1030 <stacka_pop@plt>
mov    %rax,%rsi
lea    0xe1e(%rip),%rdi
call   1040 <printf@plt>
jmp    1203 <main+0xa3>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1060 <stacka_push@plt>
jmp    1208 <main+0xa8>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a3 <main+0x43>
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,%r15d
lea    -0x1(%r15),%edi
call   1070 <stacka_create@plt>
test   %rax,%rax
je     11e7 <main+0x87>
mov    %rax,%r14
cmp    $0x2,%r15d
jl     11db <main+0x7b>
mov    %r15d,%r13d
mov    $0x1,%ebp
lea    0xe69(%rip),%r15
lea    0xe64(%rip),%r12
jmp    11b5 <main+0x55>
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 = load i32, i32* %4
%9 = sub nsw i32 %8, 1
%10 = call %struct.stacka* @stacka_create(i32 %9)
store %struct.stacka* %10, %struct.stacka** %7
%11 = load %struct.stacka*, %struct.stacka** %7
%12 = icmp eq %struct.stacka* %11, null
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 -1, i32* %3
br label %47
14: ; preds = %2
store i32 1, i32* %6
br label %15
15: ; preds = %41, %14
%16 = load i32, i32* %6
%17 = load i32, i32* %4
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %44
19: ; preds = %15
%20 = load i8**, i8*** %5
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %20, i64 %22
%24 = load i8*, i8** %23
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %32
27: ; preds = %19
%28 = load %struct.stacka*, %struct.stacka** %7
%29 = call i64 @stacka_pop(%struct.stacka* %28)
%30 = inttoptr i64 %29 to i8*
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %30)
br label %40
32: ; preds = %19
%33 = load %struct.stacka*, %struct.stacka** %7
%34 = load i8**, i8*** %5
%35 = load i32, i32* %6
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %34, i64 %36
%38 = load i8*, i8** %37
%39 = call i32 @stacka_push(%struct.stacka* %33, i8* %38)
br label %40
40: ; preds = %32, %27
br label %41
41: ; preds = %40
%42 = load i32, i32* %6
%43 = add nsw i32 %42, 1
store i32 %43, i32* %6
br label %15
44: ; preds = %15
%45 = load %struct.stacka*, %struct.stacka** %7
%46 = call i32 @stacka_destroy(%struct.stacka* %45)
store i32 0, i32* %3
br label %47
47: ; preds = %44, %13
%48 = load i32, i32* %3
ret i32 %48
}

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 = add nsw i32 %0, -1
%4 = tail call %struct.stacka* @stacka_create(i32 %3)
%5 = icmp eq %struct.stacka* %4, null
br i1 %5, label %28, label %6
6: ; preds = %2
%7 = icmp sgt i32 %0, 1
br i1 %7, label %8, label %26
8: ; preds = %6
%9 = zext i32 %0 to i64
br label %10
10: ; preds = %8, %23
%11 = phi i64 [ 1, %8 ], [ %24, %23 ]
%12 = getelementptr inbounds i8*, i8** %1, i64 %11
%13 = load i8*, i8** %12
%14 = tail call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %10
%17 = tail call i64 @stacka_pop(%struct.stacka* %4)
%18 = inttoptr i64 %17 to i8*
%19 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %18)
br label %23
20: ; preds = %10
%21 = load i8*, i8** %12
%22 = tail call i32 @stacka_push(%struct.stacka* %4, i8* %21)
br label %23
23: ; preds = %16, %20
%24 = add nuw nsw i64 %11, 1
%25 = icmp eq i64 %24, %9
br i1 %25, label %26, label %10
26: ; preds = %23, %6
%27 = tail call i32 @stacka_destroy(%struct.stacka* %4)
br label %28
28: ; preds = %2, %26
%29 = phi i32 [ 0, %26 ], [ -1, %2 ]
ret i32 %29
}