#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 base64decode(char *, char *);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
int SaveImage(char *source, char *dest, int size) {
  char Gif[1400];
  char temp[1400];
  int size2;
  if (!source || !dest || !size) {
    return (0);
  }
  strncpy(Gif,
          "R0lGODlhEAAQAIcAAAAAADQzez89ekEoJUkrMEU5O28zD3gwGGUzS0FCWUlNUUlJWE1N"
          "Wk9PXU5O"
          "X1BQXlBQX1FQX1NYUlpYWVJRYFNTcltbdHpaWmNjbGxseB8khSMkhSkqiigpmDA4mzlM"
          "ukpIgEZF"
          "kktInlVSgEFCrFBSpVhVsVtYtVtlvVpvtlNyvnNfq2pnlW5hmnx9mGJgvnJpv3lsvkdh"
          "ymVmx2hm"
          "w2lnx21owmN30ndswHBvz3Rz1H9+"
          "1Xl42XWR45BSB6dXG6xrAptbZptoQ4lxcKdzQ6d9VL5+WKJx"
          "baNycNJzAcplJ4FwwrOLVuyaAP+vF96zWOWuU+ywevvFAf/dBf/fGP/"
          "OK+vOZPPdbPfZbP/wRv/9"
          "WP/"
          "2YYWFi4yIjoyMjoKPnYeFqYqGoIyTp52dt5uguLiAg6ensLq6u42Dx42Hy4eO1I2Vxo2"
          "W05OC"
          "1JSQ1ZSb8ISizJquxZe105640Iut85i+4K6Z0KCyxqO0wquwwqS50ai/"
          "0Lm+zKCr6KWi8amr96S7"
          "/6i8/6m8/6m9/qq//6u+/72x5rK3/7O2/7Sz/ra0/rm3/rq4+by+/5jA85nB/"
          "qTC1q3C067I3rbE"
          "2rPN36zG/LbP57jD/7rQ5bfT/77e/8CPj8Cngei/jPPyrcDBzcjIyMzM19PT3sDG/"
          "8LE/8XG/8fP"
          "/8LZ6cHY7cnb78La8M3U/9fZ/9fe/8Pl/8Xl+8rt/9Hg6t3h7dnu+Nnx/9n1/9/3/"
          "+Li4ubm5uHm"
          "/+/v8unv/+L0+uT0+/f39/H8//n5+fn5+vr6//j8//n+//r8//39/f39/v7//////"
          "wAAAAAAAAAA"
          "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
          "AAAAAAAA"
          "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
          "AAAAAAAA"
          "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAMAAMkALAAA"
          "AAAQABAA"
          "AAjwAJMJHEiwYLIOJGbQsAEDR4wlK8IU1JCizyhTq1rl2iXMTotkm5Ak26ACjpo/"
          "hxA1KsWqmCEE"
          "RpQMESCjjhw2fhIpWkSKURkonqIcYPHBEaQ5a9KgcdMmyJMtVIgQGOPhkaQ4eyJRIiPE"
          "ipYpQAaA"
          "SsaBzis9d1DxYXIlixQfBQYG6AHLEqZJRbBUaWJgAsERN1ypOmWmk5MkRyoUBINCEy08"
          "Ejj9uJBK"
          "zBmCoUpksvVFQZc8sZB94lIwRKVas3j1+"
          "kVsmCwMBUG8ATQoUKFAgghdslDQhQgTJ17UyKGDx44E"
          "BjMwaPAAQgQKDhZ4GRgQADs=",
          1400);
  size2 = base64decode(temp, Gif);
  if (size2 < 1400) {
    size2 = 1400;
  }
  if (size2 > size) {
    return (0);
  }
  memcpy(dest, temp, size2);
  return (size2);
}


x86 assembly (clang, -O0):
<SaveImage>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1166 <SaveImage+0x36>
cmpq   $0x0,-0x18(%rbp)
je     1166 <SaveImage+0x36>
cmpl   $0x0,-0x1c(%rbp)
jne    1172 <SaveImage+0x42>
movl   $0x0,-0x4(%rbp)
jmp    11f7 <SaveImage+0xc7>
lea    -0x5a0(%rbp),%rdi
lea    0xe80(%rip),%rsi
mov    $0x578,%edx
call   1030 <strncpy@plt>
lea    -0xb20(%rbp),%rdi
lea    -0x5a0(%rbp),%rsi
call   1040 <base64decode@plt>
mov    %eax,-0xb24(%rbp)
cmpl   $0x578,-0xb24(%rbp)
jge    11bd <SaveImage+0x8d>
movl   $0x578,-0xb24(%rbp)
mov    -0xb24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    11d8 <SaveImage+0xa8>
movl   $0x0,-0x4(%rbp)
jmp    11f7 <SaveImage+0xc7>
mov    -0x18(%rbp),%rdi
lea    -0xb20(%rbp),%rsi
mov    -0xb24(%rbp),%edx
call   1050 <memcpy@plt>
mov    -0xb24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SaveImage>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xb00,%rsp
xor    %r14d,%r14d
test   %rdi,%rdi
je     119d <SaveImage+0x6d>
mov    %rsi,%r15
test   %rsi,%rsi
je     119d <SaveImage+0x6d>
mov    %edx,%ebp
test   %edx,%edx
je     119d <SaveImage+0x6d>
lea    0xea4(%rip),%rsi
lea    0x580(%rsp),%r12
mov    $0x578,%ebx
mov    %r12,%rdi
mov    $0x578,%edx
call   1030 <strncpy@plt>
mov    %rsp,%rdi
mov    %r12,%rsi
call   1040 <base64decode@plt>
cmp    $0x579,%eax
cmovge %eax,%ebx
cmp    %ebp,%ebx
jg     119d <SaveImage+0x6d>
mov    %rsp,%rsi
mov    %r15,%rdi
mov    %ebx,%edx
call   1050 <memcpy@plt>
mov    %ebx,%r14d
mov    %r14d,%eax
add    $0xb00,%rsp
pop    %rbx
pop    %r12
pop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AAAAAAAAAAAAAAAAAACH5BAMAAMkALAAAAAAQABAAAAjwAJMJHEiwYLIOJGbQsAEDR4wlK8IU1JCizyhTq1rl2iXMTotkm5Ak26ACjpo/hxA1KsWqmCEERpQMESCjjhw2fhIpWkSKURkonqIcYPHBEaQ5a9KgcdMmyJMtVIgQGOPhkaQ4eyJRIiPEipYpQAaASsaBzis9d1DxYXIlixQfBQYG6AHLEqZJRbBUaWJgAsERN1ypOmWmk5MkRyoUBINCEy08Ejj9uJBKzBmCoUpksvVFQZc8sZB94lIwRKVas3j1+kVsmCwMBUG8ATQoUKFAgghdslDQhQgTJ17UyKGDx44EBjMwaPAAQgQKDhZ4GRgQADs=\00"
define i32 @SaveImage(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca [1400 x i8]
%9 = alloca [1400 x i8]
%10 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%11 = load i8*, i8** %5
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %19
13: ; preds = %3
%14 = load i8*, i8** %6
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i32, i32* %7
%18 = icmp ne i32 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %16, %13, %3
store i32 0, i32* %4
br label %40
20: ; preds = %16
%21 = getelementptr inbounds [1400 x i8], [1400 x i8]* %8, i64 0, i64 0
%22 = call i32 @strncpy(i8* %21, i8* getelementptr inbounds ([1393 x i8], [1393 x i8]* @.str, i64 0, i64 0), i32 1400)
%23 = getelementptr inbounds [1400 x i8], [1400 x i8]* %9, i64 0, i64 0
%24 = getelementptr inbounds [1400 x i8], [1400 x i8]* %8, i64 0, i64 0
%25 = call i32 @base64decode(i8* %23, i8* %24)
store i32 %25, i32* %10
%26 = load i32, i32* %10
%27 = icmp slt i32 %26, 1400
br i1 %27, label %28, label %29
28: ; preds = %20
store i32 1400, i32* %10
br label %29
29: ; preds = %28, %20
%30 = load i32, i32* %10
%31 = load i32, i32* %7
%32 = icmp sgt i32 %30, %31
br i1 %32, label %33, label %34
33: ; preds = %29
store i32 0, i32* %4
br label %40
34: ; preds = %29
%35 = load i8*, i8** %6
%36 = getelementptr inbounds [1400 x i8], [1400 x i8]* %9, i64 0, i64 0
%37 = load i32, i32* %10
%38 = call i32 @memcpy(i8* %35, i8* %36, i32 %37)
%39 = load i32, i32* %10
store i32 %39, i32* %4
br label %40
40: ; preds = %34, %33, %19
%41 = load i32, i32* %4
ret i32 %41
}

LLVM IR (-O2):
@.str = [1393 x i8] c"R0lGODlhEAAQAIcAAAAAADQzez89ekEoJUkrMEU5O28zD3gwGGUzS0FCWUlNUUlJWE1NWk9PXU5OX1BQXlBQX1FQX1NYUlpYWVJRYFNTcltbdHpaWmNjbGxseB8khSMkhSkqiigpmDA4mzlMukpIgEZFkktInlVSgEFCrFBSpVhVsVtYtVtlvVpvtlNyvnNfq2pnlW5hmnx9mGJgvnJpv3lsvkdhymVmx2hmw2lnx21owmN30ndswHBvz3Rz1H9+1Xl42XWR45BSB6dXG6xrAptbZptoQ4lxcKdzQ6d9VL5+WKJxbaNycNJzAcplJ4FwwrOLVuyaAP+vF96zWOWuU+ywevvFAf/dBf/fGP/OK+vOZPPdbPfZbP/wRv/9WP/2YYWFi4yIjoyMjoKPnYeFqYqGoIyTp52dt5uguLiAg6ensLq6u42Dx42Hy4eO1I2Vxo2W05OC1JSQ1ZSb8ISizJquxZe105640Iut85i+4K6Z0KCyxqO0wquwwqS50ai/0Lm+zKCr6KWi8amr96S7/6i8/6m8/6m9/qq//6u+/72x5rK3/7O2/7Sz/ra0/rm3/rq4+by+/5jA85nB/qTC1q3C067I3rbE2rPN36zG/LbP57jD/7rQ5bfT/77e/8CPj8Cngei/jPPyrcDBzcjIyMzM19PT3sDG/8LE/8XG/8fP/8LZ6cHY7cnb78La8M3U/9fZ/9fe/8Pl/8Xl+8rt/9Hg6t3h7dnu+Nnx/9n1/9/3/+Li4ubm5uHm/+/v8unv/+L0+uT0+/f39/H8//n5+fn5+vr6//j8//n+//r8//39/f39/v7//////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAMAAMkALAAAAAAQABAAAAjwAJMJHEiwYLIOJGbQsAEDR4wlK8IU1JCizyhTq1rl2iXMTotkm5Ak26ACjpo/hxA1KsWqmCEERpQMESCjjhw2fhIpWkSKURkonqIcYPHBEaQ5a9KgcdMmyJMtVIgQGOPhkaQ4eyJRIiPEipYpQAaASsaBzis9d1DxYXIlixQfBQYG6AHLEqZJRbBUaWJgAsERN1ypOmWmk5MkRyoUBINCEy08Ejj9uJBKzBmCoUpksvVFQZc8sZB94lIwRKVas3j1+kVsmCwMBUG8ATQoUKFAgghdslDQhQgTJ17UyKGDx44EBjMwaPAAQgQKDhZ4GRgQADs=\00"
define i32 @SaveImage(i8* readnone %0, i8* %1, i32 %2) {
%4 = alloca [1400 x i8]
%5 = alloca [1400 x i8]
%6 = getelementptr inbounds [1400 x i8], [1400 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [1400 x i8], [1400 x i8]* %5, i64 0, i64 0
%8 = icmp ne i8* %0, null
%9 = icmp ne i8* %1, null
%10 = and i1 %8, %9
%11 = icmp ne i32 %2, 0
%12 = and i1 %10, %11
br i1 %12, label %13, label %21
13: ; preds = %3
%14 = call i32 @strncpy(i8* %6, i8* getelementptr inbounds ([1393 x i8], [1393 x i8]* @.str, i64 0, i64 0), i32 1400)
%15 = call i32 @base64decode(i8* %7, i8* %6)
%16 = icmp sgt i32 %15, 1400
%17 = select i1 %16, i32 %15, i32 1400
%18 = icmp sgt i32 %17, %2
br i1 %18, label %21, label %19
19: ; preds = %13
%20 = call i32 @memcpy(i8* %1, i8* %7, i32 %17)
br label %21
21: ; preds = %13, %3, %19
%22 = phi i32 [ %17, %19 ], [ 0, %3 ], [ 0, %13 ]
ret i32 %22
}