Script started on Wed Sep 11 12:44:19 2024 mweeks@air:Desktop$ cat hello.c /* hello world */ #include int main (int argc, char *argv[]) { printf("hello world.\n"); return 0; } mweeks@air:Desktop$ vi hello.c mweeks@air:Desktop$ gcc hello.c -o hello mweeks@air:Desktop$ ./hello hello world. mweeks@air:Desktop$ cat hello.c /* hello world */ #include int main (int argc, char *argv[]) { printf("hello world.\n"); // in-line comment return 0; } mweeks@air:Desktop$ cp hello.c io_example.c mweeks@air:Desktop$ vi io_example.c mweeks@air:Desktop$ gcc io_example.c -o io_example mweeks@air:Desktop$ vi io_example.c mweeks@air:Desktop$ ./io_example hello. 7 the number is 7 mweeks@air:Desktop$ cat io_example.c /* hello world gcc io_example.c -o io_example */ #include int main (int argc, char *argv[]) { int n; printf("hello.\n"); // in-line comment scanf("%d", &n); printf("the number is %d\n", n); return 0; } mweeks@air:Desktop$ shal mweeks@hallertau.cs.gsu.edu's password: Connected to mweeks@hallertau.cs.gsu.edu. sftp> cd public_html sftp> cd csc3320 sftp> put io_example.c Uploading io_example.c to /home/mweeks/public_html/csc3320/io_example.c io_example.c 100% 242 36.6KB/s 00:00 sftp> quit mweeks@air:Desktop$ hal mweeks@hallertau.cs.gsu.edu's password: Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.4.0-193-generic x86_64) + | GSU Computer Science | Faculty Research Server | HALLERTAU.cs.gsu.edu + No mail. Last login: Tue Sep 10 13:16:25 2024 from 131.96.216.152 mweeks@hallertau:~$ cd public_html mweeks@hallertau:~/public_html$ cd csc3320 mweeks@hallertau:~/public_html/csc3320$ vi index.html mweeks@hallertau:~/public_html/csc3320$ exit logout Connection to hallertau.cs.gsu.edu closed. mweeks@air:Desktop$ mweeks@air:Desktop$ mweeks@air:Desktop$ cp io_example.c io_example2.c mweeks@air:Desktop$ vi io_example2.c mweeks@air:Desktop$ cat io_example2.c /* hello world gcc io_example2.c -o io_example2 */ #include #define num 4 int main (int argc, char *argv[]) { int n; printf("hello. Enter a number: "); // in-line comment scanf("%d", &n); if (n < num) printf("the number is %d less than %d\n", n, num); else printf("the number is %d greater than or equal to %d\n", n, num); return 0; } mweeks@air:Desktop$ gcc io_example2.c -o io_example2 mweeks@air:Desktop$ mweeks@air:Desktop$ ./io_example2 hello. Enter a number: 7 the number is 7 greater than or equal to 4 mweeks@air:Desktop$ ./io_example2 hello. Enter a number: 3 the number is 3 less than 4 mweeks@air:Desktop$ gcc -S io_example.c mweeks@air:Desktop$ ls -l io* -rwxr-xr-x 1 mweeks staff 8480 Sep 11 13:01 io_example -rw-r--r--@ 1 mweeks staff 242 Sep 11 13:13 io_example(1).c -rw-r--r--@ 1 mweeks staff 242 Sep 11 13:01 io_example.c -rw-r--r-- 1 mweeks staff 1200 Sep 11 13:21 io_example.s -rwxr-xr-x 1 mweeks staff 8480 Sep 11 13:16 io_example2 -rw-r--r--@ 1 mweeks staff 385 Sep 11 13:16 io_example2.c mweeks@air:Desktop$ cat io_example.s .section __TEXT,__text,regular,pure_instructions .macosx_version_min 10, 13 .globl _main ## -- Begin function main .p2align 4, 0x90 _main: ## @main .cfi_startproc ## %bb.0: pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset %rbp, -16 movq %rsp, %rbp .cfi_def_cfa_register %rbp subq $32, %rsp leaq L_.str(%rip), %rax movl $0, -4(%rbp) movl %edi, -8(%rbp) movq %rsi, -16(%rbp) movq %rax, %rdi movb $0, %al callq _printf leaq L_.str.1(%rip), %rdi leaq -20(%rbp), %rsi movl %eax, -24(%rbp) ## 4-byte Spill movb $0, %al callq _scanf leaq L_.str.2(%rip), %rdi movl -20(%rbp), %esi movl %eax, -28(%rbp) ## 4-byte Spill movb $0, %al callq _printf xorl %esi, %esi movl %eax, -32(%rbp) ## 4-byte Spill movl %esi, %eax addq $32, %rsp popq %rbp retq .cfi_endproc ## -- End function .section __TEXT,__cstring,cstring_literals L_.str: ## @.str .asciz "hello.\n" L_.str.1: ## @.str.1 .asciz "%d" L_.str.2: ## @.str.2 .asciz "the number is %d\n" .subsections_via_symbols mweeks@air:Desktop$ sftp mweeks@snowball.cs.gsu.edu mweeks@snowball.cs.gsu.edu's password: Connected to mweeks@snowball.cs.gsu.edu. sftp> put io_example*.c Uploading io_example(1).c to /home/mweeks/io_example(1).c io_example(1).c 100% 242 78.6KB/s 00:00 Uploading io_example.c to /home/mweeks/io_example.c io_example.c 100% 242 64.9KB/s 00:00 Uploading io_example2.c to /home/mweeks/io_example2.c io_example2.c 100% 385 98.7KB/s 00:00 sftp> quit mweeks@air:Desktop$ ssh mweeks@snowball.cs.gsu.edu mweeks@snowball.cs.gsu.edu's password: Last login: Mon Sep 9 13:05:03 2024 from 131.96.223.230 + | GSU Computer Science | Instructional Server | SNOWBALL.cs.gsu.edu + [mweeks@gsuad.gsu.edu@snowball ~]$ gcc -S io_example.c [mweeks@gsuad.gsu.edu@snowball ~]$ ls -lio total 108 5525990 -rwxrwxr-x. 1 mweeks@gsuad.gsu.edu 8360 Sep 9 13:23 bad_example.c 5525968 -rw-rw-r--. 1 mweeks@gsuad.gsu.edu 0 Sep 4 13:29 donotdothis 5525234 -rw-rw-r--. 1 mweeks@gsuad.gsu.edu 39 Aug 26 13:18 example1 5505228 -rw-r--r--. 1 mweeks@gsuad.gsu.edu 49 Aug 26 13:34 example2 5525975 -rw-r--r--. 1 mweeks@gsuad.gsu.edu 49 Sep 4 13:38 example3 5525977 -rwxrwxr-x. 1 mweeks@gsuad.gsu.edu 8360 Sep 9 13:22 hello 5525982 -rw-r--r--. 1 mweeks@gsuad.gsu.edu 125 Sep 9 13:03 hello.c 5525980 -rw-r--r--. 1 mweeks@gsuad.gsu.edu 242 Sep 11 13:22 io_example(1).c 5525997 -rw-r--r--. 1 mweeks@gsuad.gsu.edu 385 Sep 11 13:22 io_example2.c 5525992 -rw-r--r--. 1 mweeks@gsuad.gsu.edu 242 Sep 11 13:22 io_example.c 5525991 -rw-rw-r--. 1 mweeks@gsuad.gsu.edu 736 Sep 11 13:23 io_example.s 5525985 -rw-r--r--. 1 mweeks@gsuad.gsu.edu 40677 Sep 4 17:50 Sept4_2024.log 5525986 -rw-r--r--. 1 mweeks@gsuad.gsu.edu 7926 Sep 4 18:33 Sept4_2024.txt 5525231 -rw-rw-r--. 1 mweeks@gsuad.gsu.edu 115 Sep 4 13:18 testfile [mweeks@gsuad.gsu.edu@snowball ~]$ cat io_example.s .file "io_example.c" .section .rodata .LC0: .string "hello." .LC1: .string "%d" .LC2: .string "the number is %d\n" .text .globl main .type main, @function main: .LFB0: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movl %edi, -20(%rbp) movq %rsi, -32(%rbp) movl $.LC0, %edi call puts leaq -4(%rbp), %rax movq %rax, %rsi movl $.LC1, %edi movl $0, %eax call __isoc99_scanf movl -4(%rbp), %eax movl %eax, %esi movl $.LC2, %edi movl $0, %eax call printf movl $0, %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-44)" .section .note.GNU-stack,"",@progbits [mweeks@gsuad.gsu.edu@snowball ~]$ exit logout Connection to snowball.cs.gsu.edu closed. mweeks@air:Desktop$ which cc /usr/bin/cc mweeks@air:Desktop$ ls -l /usr/bin/cc lrwxr-xr-x 1 root wheel 5 Jan 19 2018 /usr/bin/cc -> clang mweeks@air:Desktop$ cp hello.c hello2.c mweeks@air:Desktop$ vi hello2.c mweeks@air:Desktop$ cat hello2.c /* hello world */ #include // directives int main (int argc, char *argv[]) { // function(s) // statements printf("hello world.\n"); // in-line comment return 0; } mweeks@air:Desktop$ exit exit Script done on Wed Sep 11 13:48:03 2024