#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 /*<<< orphan*/ printf(char *, ...);
void funca(int i, int n) {
  if (i < n) {
    char sign = (i & 0x01) == 0 ? '+' : '-';
    printf("sin(%d%c", i, sign);
    funca(i + 1, n);
    printf(")");
  } else {
    printf("sin(%d)", n);
  }
}


x86 assembly (clang, -O0):
<funca>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1189 <funca+0x69>
mov    -0x4(%rbp),%edx
and    $0x1,%edx
mov    $0x2d,%eax
mov    $0x2b,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
mov    %al,-0x9(%rbp)
mov    -0x4(%rbp),%esi
movsbl -0x9(%rbp),%edx
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    -0x8(%rbp),%esi
call   1030 <funca@plt>
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    119a <funca+0x7a>
mov    -0x8(%rbp),%esi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<funca>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
cmp    %esi,%edi
jge    1172 <funca+0x42>
mov    %edi,%ebp
mov    %edi,%eax
and    $0x1,%eax
lea    (%rax,%rax,1),%edx
add    $0x2b,%edx
lea    0xeb3(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebp
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <funca@plt>
mov    $0x29,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>
lea    0xe90(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"sin(%d%c\00"
@.str.1 = [2 x i8] c")\00"
@.str.2 = [8 x i8] c"sin(%d)\00"
define void @funca(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %24
9: ; preds = %2
%10 = load i32, i32* %3
%11 = and i32 %10, 1
%12 = icmp eq i32 %11, 0
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 43, i32 45
%15 = trunc i32 %14 to i8
store i8 %15, i8* %5
%16 = load i32, i32* %3
%17 = load i8, i8* %5
%18 = sext i8 %17 to i32
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %16, i32 %18)
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
%22 = load i32, i32* %4
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %27
24: ; preds = %2
%25 = load i32, i32* %4
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %24, %9
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"sin(%d%c\00"
@.str.2 = [8 x i8] c"sin(%d)\00"
define void @funca(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
br i1 %3, label %5, label %12
4: ; preds = %12, %5
ret void
5: ; preds = %2
%6 = and i32 %0, 1
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i32 43, i32 45
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %8)
%10 = add nsw i32 %0, 1
tail call void @funca(i32 %10, i32 %1)
%11 = tail call i32 @putchar(i32 41)
br label %4
12: ; preds = %2
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %1)
br label %4
}