#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 atoll(char *);
int bail(char *);
int shout_get_cn(void *to, int argc, char **argv, char **coln) {
  coln = 0;
  long long *cn = (long long *)to;
  if (argc != 1)
    return bail("shout_get_cn: failed sanity check\n");
  if (cn)
    *cn = argv ? atoll(argv[0]) : -1;
  return 0;
}


x86 assembly (clang, -O0):
<shout_get_cn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
cmpl   $0x1,-0x14(%rbp)
je     1165 <shout_get_cn+0x45>
lea    0xea8(%rip),%rdi
call   1040 <bail@plt>
mov    %eax,-0x4(%rbp)
jmp    11b0 <shout_get_cn+0x90>
cmpq   $0x0,-0x30(%rbp)
je     11a9 <shout_get_cn+0x89>
cmpq   $0x0,-0x20(%rbp)
je     118f <shout_get_cn+0x6f>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
call   1030 <atoll@plt>
mov    %eax,-0x34(%rbp)
jmp    119c <shout_get_cn+0x7c>
mov    $0xffffffff,%eax
mov    %eax,-0x34(%rbp)
jmp    119c <shout_get_cn+0x7c>
mov    -0x34(%rbp),%eax
movslq %eax,%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shout_get_cn>:
cmp    $0x1,%esi
jne    113f <shout_get_cn+0x1f>
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
je     1155 <shout_get_cn+0x35>
test   %rdx,%rdx
je     114b <shout_get_cn+0x2b>
mov    (%rdx),%rdi
call   1030 <atoll@plt>
cltq
jmp    1152 <shout_get_cn+0x32>
lea    0xeba(%rip),%rdi
jmp    1040 <bail@plt>
mov    $0xffffffffffffffff,%rax
mov    %rax,(%rbx)
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"shout_get_cn: failed sanity check\0A\00"
define i32 @shout_get_cn(i8* %0, i32 %1, i8** %2, i8** %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i8**
%10 = alloca i64*
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8** %2, i8*** %8
store i8** %3, i8*** %9
store i8** null, i8*** %9
%11 = load i8*, i8** %6
%12 = bitcast i8* %11 to i64*
store i64* %12, i64** %10
%13 = load i32, i32* %7
%14 = icmp ne i32 %13, 1
br i1 %14, label %15, label %17
15: ; preds = %4
%16 = call i32 @bail(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
store i32 %16, i32* %5
br label %34
17: ; preds = %4
%18 = load i64*, i64** %10
%19 = icmp ne i64* %18, null
br i1 %19, label %20, label %33
20: ; preds = %17
%21 = load i8**, i8*** %8
%22 = icmp ne i8** %21, null
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = load i8**, i8*** %8
%25 = getelementptr inbounds i8*, i8** %24, i64 0
%26 = load i8*, i8** %25
%27 = call i32 @atoll(i8* %26)
br label %29
28: ; preds = %20
br label %29
29: ; preds = %28, %23
%30 = phi i32 [ %27, %23 ], [ -1, %28 ]
%31 = sext i32 %30 to i64
%32 = load i64*, i64** %10
store i64 %31, i64* %32
br label %33
33: ; preds = %29, %17
store i32 0, i32* %5
br label %34
34: ; preds = %33, %15
%35 = load i32, i32* %5
ret i32 %35
}

LLVM IR (-O2):
@.str = [35 x i8] c"shout_get_cn: failed sanity check\0A\00"
define i32 @shout_get_cn(i8* writeonly %0, i32 %1, i8** %2, i8** nocapture readnone %3) {
%5 = bitcast i8* %0 to i64*
%6 = icmp eq i32 %1, 1
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @bail(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %19
9: ; preds = %4
%10 = icmp eq i8* %0, null
br i1 %10, label %19, label %11
11: ; preds = %9
%12 = icmp eq i8** %2, null
br i1 %12, label %17, label %13
13: ; preds = %11
%14 = load i8*, i8** %2
%15 = tail call i32 @atoll(i8* %14)
%16 = sext i32 %15 to i64
br label %17
17: ; preds = %11, %13
%18 = phi i64 [ %16, %13 ], [ -1, %11 ]
store i64 %18, i64* %5
br label %19
19: ; preds = %9, %17, %7
%20 = phi i32 [ %8, %7 ], [ 0, %17 ], [ 0, %9 ]
ret i32 %20
}