#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 get1();
int get2();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(int);
void get_com(int kind) {
  int l, c;
  l = get2();
  printf("COM len=%d '", l);
  for (l -= 2; l > 0; l--)
    putchar(c = get1());
  printf("'\n");
}


x86 assembly (clang, -O0):
<get_com>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <get2@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1198 <get_com+0x58>
mov    $0x0,%al
call   1060 <get1@plt>
mov    %eax,%edi
mov    %edi,-0xc(%rbp)
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    116f <get_com+0x2f>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_com>:
push   %rbx
xor    %eax,%eax
call   1050 <get2@plt>
mov    %eax,%ebx
lea    0xe9f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    $0x3,%ebx
jl     1196 <get_com+0x46>
add    $0xffffffff,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1070 <get1@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1180 <get_com+0x30>
lea    0xe6e(%rip),%rdi
pop    %rbx
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"COM len=%d '\00"
@.str.1 = [3 x i8] c"'\0A\00"
define void @get_com(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = call i32 (...) @get2()
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %3
%9 = sub nsw i32 %8, 2
store i32 %9, i32* %3
br label %10
10: ; preds = %16, %1
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %19
13: ; preds = %10
%14 = call i32 (...) @get1()
store i32 %14, i32* %4
%15 = call i32 @putchar(i32 %14)
br label %16
16: ; preds = %13
%17 = load i32, i32* %3
%18 = add nsw i32 %17, -1
store i32 %18, i32* %3
br label %10
19: ; preds = %10
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"COM len=%d '\00"
@str = [2 x i8] c"'\00"
define void @get_com(i32 %0) {
%2 = tail call i32 (...) @get2()
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = icmp sgt i32 %2, 2
br i1 %4, label %5, label %13
5: ; preds = %1
%6 = add nsw i32 %2, -2
br label %7
7: ; preds = %5, %7
%8 = phi i32 [ %11, %7 ], [ %6, %5 ]
%9 = tail call i32 (...) @get1()
%10 = tail call i32 @putchar(i32 %9)
%11 = add nsw i32 %8, -1
%12 = icmp ugt i32 %8, 1
br i1 %12, label %7, label %13
13: ; preds = %7, %1
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}