#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 JLValue {
  int dummy;
};
struct JLContext {
  int dummy;
};

/* Variables and functions */
struct JLValue *JLEvaluate(struct JLContext *, struct JLValue *);
struct JLValue *JLGetNext(struct JLValue *);
char *JLGetString(struct JLValue *);
scalar_t__ JLIsString(struct JLValue *);
int /*<<< orphan*/ JLPrint(struct JLContext *, struct JLValue *);
int /*<<< orphan*/ JLRelease(struct JLContext *, struct JLValue *);
int /*<<< orphan*/ printf(char *, char *);
struct JLValue *PrintFunc(struct JLContext *context, struct JLValue *args,
                          void *extra) {
  struct JLValue *vp;
  for (vp = JLGetNext(args); vp; vp = JLGetNext(vp)) {
    struct JLValue *result = JLEvaluate(context, vp);
    if (JLIsString(result)) {
      printf("%s", JLGetString(result));
    } else {
      JLPrint(context, result);
    }
    JLRelease(context, result);
  }
  return NULL;
}


x86 assembly (clang, -O0):
<PrintFunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1090 <JLGetNext@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1209 <PrintFunc+0x99>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1070 <JLEvaluate@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <JLIsString@plt>
cmp    $0x0,%rax
je     11dd <PrintFunc+0x6d>
mov    -0x28(%rbp),%rdi
call   1060 <JLGetString@plt>
mov    %rax,%rsi
lea    0xe2d(%rip),%rdi
call   1040 <printf@plt>
jmp    11ea <PrintFunc+0x7a>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <JLPrint@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1080 <JLRelease@plt>
mov    -0x20(%rbp),%rdi
call   1090 <JLGetNext@plt>
mov    %rax,-0x20(%rbp)
jmp    1191 <PrintFunc+0x21>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintFunc>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
mov    %rsi,%rdi
call   1090 <JLGetNext@plt>
test   %rax,%rax
je     11f6 <PrintFunc+0x86>
mov    %rax,%rbx
lea    0xe6e(%rip),%r15
jmp    11c6 <PrintFunc+0x56>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r12,%rsi
call   1030 <JLPrint@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   1080 <JLRelease@plt>
mov    %rbx,%rdi
call   1090 <JLGetNext@plt>
mov    %rax,%rbx
test   %rax,%rax
je     11f6 <PrintFunc+0x86>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <JLEvaluate@plt>
mov    %rax,%r12
mov    %rax,%rdi
call   1050 <JLIsString@plt>
test   %rax,%rax
je     11a0 <PrintFunc+0x30>
mov    %r12,%rdi
call   1060 <JLGetString@plt>
mov    %r15,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
jmp    11ab <PrintFunc+0x3b>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.JLContext = type { i32 }
%struct.JLValue = type { i32 }
@.str = [3 x i8] c"%s\00"
define %struct.JLValue* @PrintFunc(%struct.JLContext* %0, %struct.JLValue* %1, i8* %2) {
%4 = alloca %struct.JLContext*
%5 = alloca %struct.JLValue*
%6 = alloca i8*
%7 = alloca %struct.JLValue*
%8 = alloca %struct.JLValue*
store %struct.JLContext* %0, %struct.JLContext** %4
store %struct.JLValue* %1, %struct.JLValue** %5
store i8* %2, i8** %6
%9 = load %struct.JLValue*, %struct.JLValue** %5
%10 = call %struct.JLValue* @JLGetNext(%struct.JLValue* %9)
store %struct.JLValue* %10, %struct.JLValue** %7
br label %11
11: ; preds = %33, %3
%12 = load %struct.JLValue*, %struct.JLValue** %7
%13 = icmp ne %struct.JLValue* %12, null
br i1 %13, label %14, label %36
14: ; preds = %11
%15 = load %struct.JLContext*, %struct.JLContext** %4
%16 = load %struct.JLValue*, %struct.JLValue** %7
%17 = call %struct.JLValue* @JLEvaluate(%struct.JLContext* %15, %struct.JLValue* %16)
store %struct.JLValue* %17, %struct.JLValue** %8
%18 = load %struct.JLValue*, %struct.JLValue** %8
%19 = call i64 @JLIsString(%struct.JLValue* %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %14
%22 = load %struct.JLValue*, %struct.JLValue** %8
%23 = call i8* @JLGetString(%struct.JLValue* %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %23)
br label %29
25: ; preds = %14
%26 = load %struct.JLContext*, %struct.JLContext** %4
%27 = load %struct.JLValue*, %struct.JLValue** %8
%28 = call i32 @JLPrint(%struct.JLContext* %26, %struct.JLValue* %27)
br label %29
29: ; preds = %25, %21
%30 = load %struct.JLContext*, %struct.JLContext** %4
%31 = load %struct.JLValue*, %struct.JLValue** %8
%32 = call i32 @JLRelease(%struct.JLContext* %30, %struct.JLValue* %31)
br label %33
33: ; preds = %29
%34 = load %struct.JLValue*, %struct.JLValue** %7
%35 = call %struct.JLValue* @JLGetNext(%struct.JLValue* %34)
store %struct.JLValue* %35, %struct.JLValue** %7
br label %11
36: ; preds = %11
ret %struct.JLValue* null
}

LLVM IR (-O2):
%struct.JLContext = type { i32 }
%struct.JLValue = type { i32 }
@.str = [3 x i8] c"%s\00"
define noalias %struct.JLValue* @PrintFunc(%struct.JLContext* %0, %struct.JLValue* %1, i8* nocapture readnone %2) {
%4 = tail call %struct.JLValue* @JLGetNext(%struct.JLValue* %1)
%5 = icmp eq %struct.JLValue* %4, null
br i1 %5, label %20, label %6
6: ; preds = %3, %16
%7 = phi %struct.JLValue* [ %18, %16 ], [ %4, %3 ]
%8 = tail call %struct.JLValue* @JLEvaluate(%struct.JLContext* %0, %struct.JLValue* %7)
%9 = tail call i64 @JLIsString(%struct.JLValue* %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %6
%12 = tail call i8* @JLGetString(%struct.JLValue* %8)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %16
14: ; preds = %6
%15 = tail call i32 @JLPrint(%struct.JLContext* %0, %struct.JLValue* %8)
br label %16
16: ; preds = %14, %11
%17 = tail call i32 @JLRelease(%struct.JLContext* %0, %struct.JLValue* %8)
%18 = tail call %struct.JLValue* @JLGetNext(%struct.JLValue* %7)
%19 = icmp eq %struct.JLValue* %18, null
br i1 %19, label %20, label %6
20: ; preds = %16, %3
ret %struct.JLValue* null
}