#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 */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};
typedef int /*<<< orphan*/ lineBuff;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ memcpy(char *, char *, size_t);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ start(char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
size_t strlen(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  int iterflag = 1;
  printf("Starting smsh - the sms shell for Linux remote computing\n");
  printf("===========================================================\n\n");
  printf("This is a very crude and rude version of the program.\n");
  printf("It sometimes works, it sometimes doesn't. DO NOT COMPLAIN.\n");
  printf("Original Author: Saurav Modak.\n\n");
  printf("... Krishnashish Gogoi ...\n");
  time_t curtime;
  struct tm *loctime;
  char setDate[30];
  FILE *fp;
  fp = fopen("lastmsg.txt", "w");
  curtime = time(NULL);
  loctime = localtime(&curtime);
  strftime(setDate, 30, "%d %b %Y %H:%M:%S", loctime);
  fputs(setDate, fp);
  fclose(fp);
  char lineBuff[30];
  char urlBuff[80] = "http://tagg.in/Rss/";
  int urlLength = strlen(urlBuff);
  int loopFlag = 1;
  do {
    printf("\n\nEnter your tagg.in username: ");
    if (fgets(lineBuff, sizeof(lineBuff), stdin) != NULL) {
      memcpy(urlBuff + urlLength, lineBuff, strlen(lineBuff));
      urlBuff[strlen(urlBuff)] = '\0';
      loopFlag = 0;
    } else
      printf("\nPlease enter a username.\n");
  } while (loopFlag == 1);
  while (iterflag) {
    start(urlBuff);
    printf("Waiting %d seconds for the next check\n\n", 60);
    sleep(60);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xedf(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xeed(%rip),%rdi
lea    0xef2(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x48(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <time@plt>
mov    %eax,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x1e,%esi
lea    0xebe(%rip),%rdx
call   10c0 <strftime@plt>
lea    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   1070 <fputs@plt>
mov    -0x48(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0xc0(%rbp),%rdi
lea    0xf0f(%rip),%rsi
mov    $0x50,%edx
call   10a0 <memcpy@plt>
lea    -0xc0(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0xc4(%rbp)
movl   $0x1,-0xc8(%rbp)
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x70(%rbp),%rdi
mov    0x2d08(%rip),%rax
mov    (%rax),%edx
mov    $0x1e,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     135b <main+0x19b>
lea    -0xc0(%rbp),%rax
movslq -0xc4(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0xd8(%rbp)
lea    -0x70(%rbp),%rax
mov    %rax,-0xd0(%rbp)
lea    -0x70(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0xd8(%rbp),%rdi
mov    -0xd0(%rbp),%rsi
mov    %rax,%rdx
call   10a0 <memcpy@plt>
lea    -0xc0(%rbp),%rdi
call   1050 <strlen@plt>
movb   $0x0,-0xc0(%rbp,%rax,1)
movl   $0x0,-0xc8(%rbp)
jmp    1369 <main+0x1a9>
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    136e <main+0x1ae>
cmpl   $0x1,-0xc8(%rbp)
je     12c7 <main+0x107>
jmp    1380 <main+0x1c0>
cmpl   $0x0,-0x14(%rbp)
je     13b8 <main+0x1f8>
lea    -0xc0(%rbp),%rdi
call   1090 <start@plt>
lea    0xde6(%rip),%rdi
mov    $0x3c,%esi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x3c,%edi
call   10e0 <sleep@plt>
jmp    1380 <main+0x1c0>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa0,%rsp
lea    0xe81(%rip),%rdi
call   1040 <puts@plt>
lea    0xeae(%rip),%rdi
call   1040 <puts@plt>
lea    0xedf(%rip),%rdi
call   1040 <puts@plt>
lea    0xf09(%rip),%rdi
call   1040 <puts@plt>
lea    0xf38(%rip),%rdi
call   1040 <puts@plt>
lea    0xf4c(%rip),%rdi
call   1040 <puts@plt>
lea    0xdd1(%rip),%rdi
lea    0xdd6(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,%rbx
xor    %edi,%edi
call   10c0 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
lea    0xdb4(%rip),%rdx
lea    0x80(%rsp),%r14
mov    %r14,%rdi
mov    $0x1e,%esi
mov    %rax,%rcx
call   10d0 <strftime@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1080 <fputs@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
movaps 0xf64(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xf48(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xf2c(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xf10(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xef4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x10(%rsp),%rdi
call   1060 <strlen@plt>
cltq
lea    (%rsp,%rax,1),%r14
add    $0x10,%r14
lea    0xd44(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2cfe(%rip),%r13
mov    0x0(%r13),%edx
lea    0x60(%rsp),%rdi
mov    $0x1e,%esi
call   1090 <fgets@plt>
test   %rax,%rax
jne    1348 <main+0x178>
lea    0xe81(%rip),%r15
lea    0xd10(%rip),%r12
lea    0x60(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x0(%r13),%edx
mov    %rbx,%rdi
mov    $0x1e,%esi
call   1090 <fgets@plt>
test   %rax,%rax
je     1320 <main+0x150>
lea    0x60(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   10b0 <memcpy@plt>
lea    0x10(%rsp),%r14
mov    %r14,%rdi
call   1060 <strlen@plt>
movb   $0x0,0x10(%rsp,%rax,1)
lea    0xcc4(%rip),%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
call   10a0 <start@plt>
mov    %rbx,%rdi
mov    $0x3c,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x3c,%edi
call   10f0 <sleep@plt>
jmp    1380 <main+0x1b0>

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [58 x i8] c"Starting smsh - the sms shell for Linux remote computing\0A\00"
@.str.1 = [62 x i8] c"===========================================================\0A\0A\00"
@.str.2 = [55 x i8] c"This is a very crude and rude version of the program.\0A\00"
@.str.3 = [60 x i8] c"It sometimes works, it sometimes doesn't. DO NOT COMPLAIN.\0A\00"
@.str.4 = [33 x i8] c"Original Author: Saurav Modak.\0A\0A\00"
@.str.5 = [28 x i8] c"... Krishnashish Gogoi ...\0A\00"
@.str.6 = [12 x i8] c"lastmsg.txt\00"
@.str.7 = [2 x i8] c"w\00"
@.str.8 = [18 x i8] c"%d %b %Y %H:%M:%S\00"
@__const.main.urlBuff = [80 x i8] c"http://tagg.in/Rss/\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str.9 = [32 x i8] c"\0A\0AEnter your tagg.in username: \00"
@stdin = global i32 0
@.str.10 = [27 x i8] c"\0APlease enter a username.\0A\00"
@.str.11 = [40 x i8] c"Waiting %d seconds for the next check\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.tm*
%9 = alloca [30 x i8]
%10 = alloca i32*
%11 = alloca [30 x i8]
%12 = alloca [80 x i8]
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
%21 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32* %21, i32** %10
%22 = call i32 @time(i32* null)
store i32 %22, i32* %7
%23 = call %struct.tm* @localtime(i32* %7)
store %struct.tm* %23, %struct.tm** %8
%24 = getelementptr inbounds [30 x i8], [30 x i8]* %9, i64 0, i64 0
%25 = load %struct.tm*, %struct.tm** %8
%26 = call i32 @strftime(i8* %24, i32 30, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), %struct.tm* %25)
%27 = getelementptr inbounds [30 x i8], [30 x i8]* %9, i64 0, i64 0
%28 = load i32*, i32** %10
%29 = call i32 @fputs(i8* %27, i32* %28)
%30 = load i32*, i32** %10
%31 = call i32 @fclose(i32* %30)
%32 = bitcast [80 x i8]* %12 to i8*
%33 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%34 = call i64 @strlen(i8* %33)
%35 = trunc i64 %34 to i32
store i32 %35, i32* %13
store i32 1, i32* %14
br label %36
36: ; preds = %57, %2
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0))
%38 = getelementptr inbounds [30 x i8], [30 x i8]* %11, i64 0, i64 0
%39 = load i32, i32* @stdin
%40 = call i32* @fgets(i8* %38, i32 30, i32 %39)
%41 = icmp ne i32* %40, null
br i1 %41, label %42, label %54
42: ; preds = %36
%43 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%44 = load i32, i32* %13
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8, i8* %43, i64 %45
%47 = getelementptr inbounds [30 x i8], [30 x i8]* %11, i64 0, i64 0
%48 = getelementptr inbounds [30 x i8], [30 x i8]* %11, i64 0, i64 0
%49 = call i64 @strlen(i8* %48)
%50 = call i32 @memcpy(i8* %46, i8* %47, i64 %49)
%51 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%52 = call i64 @strlen(i8* %51)
%53 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 %52
store i8 0, i8* %53
store i32 0, i32* %14
br label %56
54: ; preds = %36
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0))
br label %56
56: ; preds = %54, %42
br label %57
57: ; preds = %56
%58 = load i32, i32* %14
%59 = icmp eq i32 %58, 1
br i1 %59, label %36, label %60
60: ; preds = %57
br label %61
61: ; preds = %64, %60
%62 = load i32, i32* %6
%63 = icmp ne i32 %62, 0
br i1 %63, label %64, label %69
64: ; preds = %61
%65 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%66 = call i32 @start(i8* %65)
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.11, i64 0, i64 0), i32 60)
%68 = call i32 @sleep(i32 60)
br label %61
69: ; preds = %61
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str.6 = [12 x i8] c"lastmsg.txt\00"
@.str.7 = [2 x i8] c"w\00"
@.str.8 = [18 x i8] c"%d %b %Y %H:%M:%S\00"
@__const.main.urlBuff = [80 x i8] c"http://tagg.in/Rss/\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str.9 = [32 x i8] c"\0A\0AEnter your tagg.in username: \00"
@stdin = global i32 0
@.str.11 = [40 x i8] c"Waiting %d seconds for the next check\0A\0A\00"
@str = [57 x i8] c"Starting smsh - the sms shell for Linux remote computing\00"
@str.12 = [61 x i8] c"===========================================================\0A\00"
@str.13 = [54 x i8] c"This is a very crude and rude version of the program.\00"
@str.14 = [59 x i8] c"It sometimes works, it sometimes doesn't. DO NOT COMPLAIN.\00"
@str.15 = [32 x i8] c"Original Author: Saurav Modak.\0A\00"
@str.16 = [27 x i8] c"... Krishnashish Gogoi ...\00"
@str.17 = [26 x i8] c"\0APlease enter a username.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [30 x i8]
%5 = alloca [30 x i8]
%6 = alloca [80 x i8]
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.12, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.13, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.14, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.15, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.16, i64 0, i64 0))
%13 = bitcast i32* %3 to i8*
%14 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%15 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%16 = tail call i32 @time(i32* null)
store i32 %16, i32* %3
%17 = call %struct.tm* @localtime(i32* %3)
%18 = call i32 @strftime(i8* %14, i32 30, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), %struct.tm* %17)
%19 = call i32 @fputs(i8* %14, i32* %15)
%20 = call i32 @fclose(i32* %15)
%21 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%22 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%23 = call i64 @strlen(i8* %22)
%24 = shl i64 %23, 32
%25 = ashr exact i64 %24, 32
%26 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 %25
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0))
%28 = load i32, i32* @stdin
%29 = call i32* @fgets(i8* %21, i32 30, i32 %28)
%30 = icmp eq i32* %29, null
br i1 %30, label %31, label %37
31: ; preds = %2, %31
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.17, i64 0, i64 0))
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0))
%34 = load i32, i32* @stdin
%35 = call i32* @fgets(i8* %21, i32 30, i32 %34)
%36 = icmp eq i32* %35, null
br i1 %36, label %31, label %37
37: ; preds = %31, %2
%38 = call i64 @strlen(i8* %21)
%39 = call i32 @memcpy(i8* %26, i8* %21, i64 %38)
%40 = call i64 @strlen(i8* %22)
%41 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 %40
store i8 0, i8* %41
br label %42
42: ; preds = %37, %42
%43 = call i32 @start(i8* %22)
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.11, i64 0, i64 0), i32 60)
%45 = call i32 @sleep(i32 60)
br label %42
}